Conditions and their parameters. Full list

Actions and their parameters. Full list


Conditions and Actions

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

Conditions


Condition structure

{ "c": "ConditionName", "p": [ "parameter1", "parameter2" ], "counter": X }

Conditions WITHOUT parameters can be used in any of the following forms:

Condition description

❗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>

Complex conditions

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>

Actions


Action structure

{ "a": "ActionName", "p": [ "parameter1", "parameter2" ] }

Actions WITHOUT parameters can be used in any of the following forms:

Action description

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>

Adding scripts to the map

Scripting logic is added to the map in two forms:

<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>

Scripting via a Quest file

Conditions and their parameters. Full list

Actions and their parameters. Full list