Skip to content

How to make a guide

DmitryS edited this page Mar 7, 2022 · 120 revisions

First, set the debugging parameters using the commands described here (to add hooks and display the necessary information), then enter the dungeon for which you want to create a guide. Once you are logged in, look in the console for the ID. Also, a list of dungeon IDs can be found here.

Next, create a file in the guides folder. The file name must consist of a dungeon id (number) with the extension .js. The first line in the file must be a comment with the name of the dungeon in English. No editing of the config.json file is required, all information about the configuration of the created guide will be added automatically upon entering the game.

Hooks

Hook is a function called when a certain event generated by the game is triggered (for example, when a boss is attacked, an abnormality is applied, etc.). Each hook can be associated with the required processing algorithm using a guide script. How to write your script and associate the necessary hooks with the needed actions (displaying text on the screen, spawning markers, etc.) – read below.

Note: all hooks associated with the enabled debug options will be forcibly added to any guide when it is loaded, even if its script does not contain keys adding these hooks.

Making a script

To generate a initial template for a guide script, you can use: https://github.com/hsdn/tera-guide-generator

For making a script, a specific format is used, defined as a JavaScript object {...} returned by the exported anonymous function in the guide file (in the value of the return operator).

/**
 * Function arguments:
 *   dispatch - instance of the Dispatch class (the module instance is available as dispatch._mod).
 *   handlers - instance of the Handlers class that contains all the event handler functions.
 *   guide - data object of the loaded guide.
 *   lang - language setting data object.
 */
module.exports = (dispatch, handlers, guide, lang) => {

	// helper functions are placed here

	return {
		// the script of the guide is placed here

     		"Key-1": [/* array of event handling objects */],
     		"Key-2": [/* array of event handling objects */],
     		// ...
	}; 
};

Each entry of the object specified in return is a key (property), the value of which specifies an array [...] with objects {...}, containing the parameters required for event processing.

The key and event handling object formats are described below.


Keys format

The key is a string, separated by "-" characters, in the format: Prefix-huntingZoneId-templateId-Information

  • Prefix – Indicates the type of the triggered event.
  • huntingZoneId – Zone identifier (dungeon or location ID).
  • templateId – Identifier of NPC/boss/mob.
  • Information – Boss HP%, skill ID, skill animation stage, etc.

Key prefixes

Prefix Description
s Start of the NPC (boss) skill animation.
e End of the NPC (boss) skill animation.
h Health level of the NPC (boss).
am Abnormality was applied by a NPC (boss) to you.
ae Abnormality was applied by server to you.
af Abnormality was applied by server to party.
ap Abnormality was applied to party by mob (boss).
ab Abnormality was applied to the NPC (boss).
ar Removed abnormality applied to you.
at Removed abnormality applied to party.
ad Removed abnormality applied to the NPC (boss).
ns Spawn events (executed when a boss spawns).
nd Despawn events (triggered after death/wipe of the boss).
rb Begin of the NPC (boss) rage.
re End of the NPC (boss) rage.
dm Dungeon Message events.
qb Quest Balloon events.

All hooks associated with the prefix specified in the key will be added automatically when loading the guide.

Features of prefix s (start of skill animation)

For entries indicating NPC skill processing, the action stage value is always indicated after the last "-" (number 0 or above). For example, to trigger a skill with ID 304 at the zero (0) stage of action, specify: s-735-1000-304-0.

Key example:

"s-735-1000-304-0": [...]

s – prefix indicating the processing of the boss's skill.
735 – dungeon ID (usually the same as guide ID).
1000 – boss ID (the first boss usually has an ID 1000, the second boss 2000, etc.).
304 – boss skill ID (format may differ depending on the specified guide type, see below).
0 – stage of animation for the boss skill (many skill animations have several stages, indicated from 0 to n).

Features of prefixes am, ae, ab (abnormality applying)

For entries indicating the processing of the applying of an abnormality, it is possible to specify an additional value at the end of the key, indicating the number of applied stacks of this abnormality.

Key example:

"ab-735-1000-7351060-1": [...]

ab – prefix indicating the processing of abnormality applying.
735 – dungeon ID.
1000 – boss ID.
7351060 – abnormality ID (see: https://github.com/neowutran/TeraDpsMeterData/tree/master/hotdot).
1 – number of applied stacks for the abnormality (number from 1 to n).

Global keys

There are also special keys that describe the handling of individual (global) player-related events. These keys are shown in the table below.

Key Description
die Death of the player.
resurrect Resurrection of the player.

Usage example:

"die": [...]

Guide types (skill ID ranges)

There are several types of boss skill ID formatting designed to make scripting easier. For example, if you want all boss skills to take the state of his rage, you can specify the type SP, after which an additional number will be added at the beginning of the identifier, indicating the status of the boss. Below is a table with a description of all types.

Type Skill ranges Possible usage
SP 1000-1999
2000-2999
3000-3999
Processing skills in a state of rage (2000-2999) and without rage (1000-1999), as well as processing of special skills.
ES 100-299
3000-3999
Processing skills regardless to the state of rage, as well as processing special skills.
100-399 Processing skills regardless to the state of rage.

The type of formatting is specified in the type property for argument guide in the guide file inside the exported anonymous function. The value is specified as the constants SP or ES, for example:

guide.type = SP;

If no type or property is specified, default formatting will be applied (range 100-399).


Event handling object format

To handle the event called by the hook when the corresponding key is found in the script, you must specify one or more event handling objects in the key value array. An event handling object is a set of parameters that describe an action to be performed when an event is triggered.

Note: Each array can contain no more than 30 event handling objects.

Example object:

{ type: "text", sub_type: "message", message: "Out", message_RU: "От него" }

type – type of action to be performed (text – displaying text message on the screen).
sub_type – additional parameter for the text type (message is a standard message).
message and message_RU – message texts in different languages.

The set of parameters is not limited to those refered in the example above. Event objects can describe not only displaying messages on the screen, but also spawning complex figures, calling functions, playing voice, etc.

Event handling types

All available types and parameters of event processing objects described here.

Record links (aliases)

In addition to the standard record format (key – array), it is possible to create records that refer to other existing records in the guide file. To do this, instead of an array of objects, in the key value, you should specify a string containing the name of another key that exists in the file.

Usage example:

"s-3034-1003-205-0": [{type: "text", sub_type: "message", message: "Wind (Kaia)" }],
"s-3034-1004-205-0": "s-3034-1003-205-0",
"s-3034-1005-205-0": "s-3034-1003-205-0",
"s-3034-1006-205-0": "s-3034-1003-205-0",
"s-3034-1007-205-0": "s-3034-1003-205-0",

A similar feature is also available using event handler type alias.

Example of the complete script file

guides/9053.js

// Kezzel's Gorge
//
// Made by Multarix

module.exports = (dispatch, handlers, guide, lang) => {
	return {
		"nd-453-999": [
			{ type: "stop_timers" },
			{ type: "despawn_all" }
		],
		"s-453-999-103-0": [{ type: "text", sub_type: "message", message: "Smash (Left)", message_RU: "Удар (лево)" }],
		"s-453-999-104-0": [{ type: "text", sub_type: "message", message: "Smash (Right)", message_RU: "Удар (право)" }],
		"s-453-999-105-0": [
			{ type: "text", sub_type: "message", message: "Rock Smash", message_RU: "Удар (танк)", class_position: "tank" },
			{ type: "spawn", func: "circle", args: [true, 553, 0, 210, 14, 190, 0, 3000] }
		],
		"s-453-999-106-0": [
			{ type: "text", sub_type: "message", message: "Blast", message_RU: "Выстрел" },
			{ type: "text", sub_type: "message", message: "Dodge!", message_RU: "Эвейд!", delay: 2000 }
		],
		"s-453-999-107-0": [{ type: "text", sub_type: "message", message: "Whip", message_RU: "Кнут" }],
		"s-453-999-116-0": [{ type: "text", sub_type: "message", message: "Shield", message_RU: "Щит" }],
		"s-453-999-119-0": [
			{ type: "text", sub_type: "message", message: "Kaia's Shield", message_RU: "Кайа", class_position: "priest" },
			{ type: "text", sub_type: "message", message: "Thrall of Protection", message_RU: "Кайа", class_position: "mystic" },
			{ type: "spawn", func: "circle", args: [true, 553, 0, 0, 10, 500, 0, 6000] }
		],
		"s-453-999-120-0": [
			{ type: "text", sub_type: "message", message: "AoE Waves", message_RU: "AoE волны" },
			{ type: "spawn", func: "circle", args: [false, 445, 0, 0, 14, 200, 0, 7000] },
			{ type: "spawn", func: "circle", args: [false, 445, 0, 0, 10, 390, 0, 7000] },
			{ type: "spawn", func: "circle", args: [false, 445, 0, 0, 8, 590, 0, 7000] }
		]
	};
};