Conditions and their parameters. Full list
Actions and their parameters. Full list
ALL the scripting logic in the game is assembled by combining and pairing simple building blocks called “Triggers”:
IF “*Condition-X*” is fulfilled → THEN “*Action-Y*” is activated.
Any “Condition-X” is called “Condition” Any “Action-Y” is called “Action”
{ "c": "ConditionName", "p": [ "parameter1", "parameter2" ], "counter": X }
Conditions WITHOUT parameters can be used in any of the following forms:
❗Any ”condition" is technically a listener. Meaning it will trigger the actions corresponding to it only one time — when its requirement is met for the first time. After that the condition turns itself off.
A condition will not re-enable itself or trigger again if the condition ceases to be met. For example, a "Counter" condition that has triggered once will not detect if the counter has taken a value that no longer satisfies the condition’s requirement.
<aside> ❗
All conditions are checked ONLY for those players who have the quest containing them active (determined by the "sharing" field of the quest. For more details — see DETAILED DESCRIPTION OF FIELDS within “quests”
HOWEVER, Player X's conditions can still check heroes / captured objects belonging to Player Y — if their specific sids are used in the parameters.
</aside>
It is possible to create complex listeners that require the fulfillment / non-fulfillment of several conditions simultaneously. For this purpose, the auxiliary optional field “conditionsLogic” is used.
Example:
{
"conditionsLogic": "Or",
"conditions":
[
{ "c": "HeroKill", "p": [ "campaign_hero_1" ] },
{ "c": "HeroKill", "p": [ "campaign_hero_2" ] }
],
"actions":
[
{ "a": "GameLose" }
]
}
Possible values of the “conditionsLogic” field:
<aside> ❗
Since conditions are one-time listeners, combined "And" conditions will be considered fulfilled as soon as each of the conditions has triggered once — EVEN if the conditions of both are never satisfied simultaneously.
To solve this problem, the auxiliary actions TriggerClear and TriggerClearCustom are used. For more details — see Questlog manipulations
</aside>
{ "a": "ActionName", "p": [ "parameter1", "parameter2" ] }
Actions WITHOUT parameters can be used in any of the following forms:
Action is the simplest event that is triggered instantaneously.
All actions are performed sequentially one after another. Actions in the script file trigger immediately one after another (unless one of the actions in the chain has an additional "break" parameter specified, which interrupts the execution of all subsequent actions).
<aside> ❗
All actions, except dialogs, by default do not know how to "wait" for the completion of the previously called action.
For example, if two MoveCamera actions are called in a row, the camera will only begin moving toward the first point for a fraction of a second before immediately proceeding to fully move toward the second.
</aside>
<aside> ❗
If a mistake was made in writing an action, not only that action but ALL actions of the given trigger will not work.
</aside>
Scripting logic is added to the map in two forms:
Scripts More complex logical sequences of several triggers, not necessarily attached to any specific object on the map. Written in the quest file.
❗By default, cannot interrupt the execution of standard game logic. (For example, a script "call a dialog upon interaction with a squad" will not be able to pause the initialization of combat — the dialog will open upon interaction and immediately close due to the start of the battle.)
For more details — see Scripting via a Quest file
Interaction triggers Simple actions that trigger when a hero interacts with an object. Set in the Actions Before and Action After properties of the object in the editor.
💡Completely interrupt the execution of standard game logic. (For example, the death animation of a defeated squad will only play AFTER the dialog called via Action After has finished.)
For more details — see Interaction triggers (on the objects)
<aside> ❗
For ANY scripting logic to work on a map, in the same folder where the **map_name**.map file is stored, a quest file **map_name**.json with a "quests" block must be created
(even an empty one — see Blank — script file: map_name.json )
Otherwise even the simplest interaction triggers attached via Actions Before / After to objects will break map loading.
</aside>
Conditions and their parameters. Full list
Actions and their parameters. Full list