Skill and Battle Directives in Combat

来自部落与弯刀Wiki

Please pay special attention: when editing scripts, you must use half-size punctuations!!! Meanwhile, in scenarios and all configuration tables, please avoid using strings that contain special characters. Otherwise, there might be errors when scripts are injected.

Script Directives in Battles

We use an independent event operating system to realize specific scenario events or complex battle mechanics in battles. The way this system function resembles that of the scenario executor in common scenario events. The difference is that the system will not pause the game by force unless players call PAUSE/RESUME directives manually.

You can open the Console in battles and use “bs@” followed by script directives to debug. For example, you can enter “bs@KILL_ALL*1” to eliminate all enemies.

List of Script Directives in Battles

Directive Instruction
(null) Character Text Box

Function: show a paragraph with a character painting and typewriter effect.

Format: *Character ID(@position of character painting)# paragraph 1# paragraph 2# paragraph 3#...#paragraph N

NOTHING Empty Directive

Function: an empty directive. Nothing happens.

Format: NOTHING*1.

EVENT Jump To

Function: jump to and execute another scenario event ID.

Format: EVENT*EVENT ID#ID of the user who runs the client (0 means executing everything)#index value of the subcommand line of the target event (starting from 0.)

SELECT Dialogue Option

Function: based on the text box, after the dialogue, is printed, an option box pops up, let the player choose an option, and returns the result (the according [%result_code%] of the resulting directive in the event.)

Format: SELECT*character ID#dialogue content#1:option 1*condition group 1;2:option 2*condition group 2;…:N: option N*condition group N (only when a set of conditions are met or the group is empty will the option shows up; otherwise, it will be hidden.)

SCREEN Fullscreen Subtitle

Function: show a subtitle in full screen (default background colour is black; transparency is adjustable.)

Format: SCREEN*subtitle#resource name of background image#transparency (optional; default: 1).

SHAKE_SCREEN Screen Shake

Function: execute a screen shake effect.

Format: SHAKE_SCREEN*Time(second)#intensity (e.g., SHAKE_SCREEN*0.3#3)

DELAY Delay

Function: delay the current situation for a while (counts by seconds in the real world; the player cannot perform any action during the delay.)

Format: DELAY*waiting time (second)

PAUSE Pause Current Game

Function: pause the current battle scene.

Format: PAUSE*.

RESUME Continue Current Game

Function: continue the current battle scene.

Format: RESUME*.

SET_WEATHER Set Weather

Function: set and replace the current weather in the game.

Format: SET_WEATHER*weather effect directive.

Please refer to Format of Weather Effect Info.

BB Character Icon Pop-up

Function: a character text box pops up at the specific position, without disturbing the current game. The player does not need to perform actions. The text box will disappear in a while.

Format: BB*character ID#dialogue content#extra existing time (counts by second; based on the original current time of the dialogue, which is measured by the length of text).

B_TALK Unit Chat Bubble

Function: units on the battlefield can have chat bubbles over their heads, which show their words.

Format: B_TALK*object ID#random paragraph 1#random paragraph 2#random paragraph 3#...#random paragraph N.

ENEMY_REINF Enemy Reinforcement

Function: all enemies send reinforcement according to a specific unit list.

Format: ENEMY_REINF*minion list.

Please refer to the format of Minion List.

FRIEND_REINF Ally Reinforcement

Function: all allies send reinforcement according to a specific unit configuration list.

Format: FRIEND _REINF*minion list

Please refer to the format of Minion List.

CMD_RETREAT Retreat Order

Function: order all allies to retreat.

Format: CMD_RETREAT*0 (0: All allies; 1: All enemies).

BATTLE_OVER End Battle by Force

Function: end the current battle instantly.

Format: BATTLE_OVER*code (0: Victory; 1: Loss).

KILL_ALL Eliminate All Targets

Function: deals massive damage to all units of one side to kill them within a second.

Format: KILL_ALL*0 (0: Ally; 1: Enemy).

UNDEAD_PLAYER Player Will Not Die

Function: buff the character controlled by the player so that it will not die.

Format: UNDEAD_PLAYER*1.

UNDEAD_ALL All Units Will Not Die

Function: buff all units on the battlefield so that they will not die.

Format: UNDEAD_ALL*0 (0: Ally; 1: All units).

EXEC_SKILL Unit Uses Ability

Function: command-specific units on the battlefield to use skills.

Format: EXEC_SKILL*caster ID#skill ID, skill level (set 1 by default by)#x, y of target’s coordinate#x, y of the coordinate parameter 1.

Caster ID is the identification ID of the target and can have the following unique values:

· PLAYER: player GM_A: the pre-set object of the attacking side GM_B: the pre-set object of the defending side.

· THIS: directive giver (usually goes back to the emitter itself).

· EMITTER=ID: a dungeon emitter of a specific ID, which can be “THIS” to represent the current dungeon emitter.

· RND_FRIEND_UNIT: random ally units RND_ENEMY_UNIT: random enemy units.

When a caster is a pre-set object, coordinate parameter 1 represents its initial coordinate.

DUNGEON_SPAWN Refresh Dungeon Unit

Function: refresh units that have been defined on the battlefield.

Format: DUNGEON_SPAWN*control ID#value of ignoring status (unit will be refreshed even they are defeated; 0: Yes by default; 1: No).

SET_DUNGEON_TS Set Dungeon Emitter Status

Function: set the status of a specific emitter in a dungeon.

Format: SET_DUNGEON_TS*control ID#status (0: Enabled; -1: Disabled).

DUNGEON_OVER End Dungeon Fight

Function: end this dungeon fight and execute relative actions.

Format: DUNGEON_OVER*result value (0: exit; 1: victory; 2: loss).

SET_AREA Set Obstacle Area Status

Function: enable or disable a specific obstacle area.

Format: SET_AREA*control ID#status (0: Enabled; -1: Disabled).

SET_WIDGET Set Decoration Status

Function: enable or disable a specific map decoration.

Format: SET_WIDGET*control ID#status (0: Normal; -1: Hidden).

SET_TP Set Dungeon Teleporter Status

Function: set the status of a dungeon teleporter and its relevant model.

Format:  SET_TP*control ID#status (0: Enabled; -1: Disabled).

SET_EMITTER Set Emitter Status

Function: set the status of a specific emitter.

Format: SET_EMITTER*control ID#status (0: Enabled; -1: Disabled).

SET_PLAYER_MODEL Set Player Model

Function: set the model of the character controlled by the player.

Format: SET_PLAYER_MODE*unit model description info.

SET_PLAYER_SKILL Set Player’s Current Skills

Function: set the current skills of the player’s character.

Format: SET_PLAYER_SKILL*skill ID 1, level| skill ID 1, level| …| skill ID N, level (4 skills at most).

SKILL_CMD Execute Skill Directive

Function: execute skill directives.

Format: SKILL_CMD*content of the skill directive.

SET_DG_INTVAR Set Custom Int Field in Battles

Function: set a custom int field in battles

Format: SET_DG_INTVAR*field ID#set value#mode setting (1: Addition Mode, adds set value based on the original value; other numbers: Direct Mode)#monitor info (optional; you can view the variable info on the monitor panel).

SET_CAMERA Set Camera Mode

Function: set the camera mode in battles.

Format: SET_CAMERA*camera mode#parameter.


Currently, available camera modes and meanings of the parameters are:

· 0: follows the player’s character. No parameter (default)..

· 1: follows a specific target. The parameter is the object ID of the target unit.

· 2: coordinate on the battlefield. The parameter is X and Y.

ATTACK Compulsory Attack

Function: command a unit to attack another unit.

Format: ATTACK*attacker object ID#target object ID.

CMD_QUEUE Unit Control Directive Sequence

Function: give an array of directives to one unit. The unit will execute the directives according to their sequence.

Format: CMD_QUEUE*target object ID#event IDs in the commanding script (fill the content of command sequence into this event to execute).


The command sequence (the time parameter stands for the time before the next directive is executed) can be:

Directive type 1 [,time parameter]:directive parameter.

Directive type 2 [,time parameter]:directive parameter.

...

Currently, available sequence directive types are:

· skill_cmd: execute skill directives: the parameter is a line of skill directives.

· use_skill: use abilities: ability ID, ability level#target unit object parameter#target position parameter.

· event: execute battle events: event ID in battles#execution condition (optional).

· move_to: move to the target position: target coordinate parameter#speed parameter (in this directive, time parameter is invalidated. Only when the target has reached the current position will the next directive be executed).

· set_dir: set unit’s direction: direction is the parameter.

· keep_act: keep performing one action: action ID (default action when empty)#loop times (loop endlessly when <=0; 1 by default)#time per action (default action when <=0; 0 by default).

Please note: in this directive, the time parameter is invalidated before the action loop is over. When in an endless loop, you need to give a new directive to the unit to end the old action.

When the coordinate has 2 parameters, the directive shows the X and Y of the target on the map; when there are 3 parameters, the third stands for the type of the position (0: map coordinate; 1: battlefield coordinate).

SET_POLICY Set Unit Battle Tactic

Function: set the current battle tactic for a unit.

Format: SET_POLICY*target object ID#main tactic type#parameter 1#position parameter#unit filter tag (validated when the target object ID is empty)#target ID (used for target-oriented tactic like Follow).


Currently, available main tactic types are:

· 0: Attack (the parameter is the radius of awakening, which becomes endless long when the parameter is lower than 0).

· 1: Defend (the parameter is the radius of defending).

· 2: Follow (the parameter is the radius of following).

· 3: Occupy.

SET_UNIT_TIMER Set Unit Timer

Function: set a timer on a unit, which will trigger and complete a specific event.

Format: SET_UNIT_TIMER*target object ID#timer ID#time parameter (disabled when <=0; a timer only works when the unit has an “on timer” trigger event).

FINISH_CAST Use Channeling Skill Instantly

Function: stop channeling and use the skill instantly (works only when the target is channeling their skill.)

Field 1, value 1|Field 2, value 2|…

REPLACE_SKILLS Replace Unit Skill

Function: replace the current skill of a unit.

Format: REPLACE_SKILLS*target object ID#skill ID 1, level| skill ID 2, level|…|skill ID N, level (4 skills at most; a skill is removed when its level is 0.)

REPLACE_DGSKILL Replace Unit Dungeon Skill

Function: replace the current dungeon skill of a unit.

Format: REPLACE_DGSKILL*target object ID#dungeon skill ID, level (empty skill ID or null means the dungeon skill is disabled).

BATTLE_MSG Battlefield Message

Function: broadcast a battlefield message.

Format: BATTLE_MSG*message type (0: Normal; 1: Warning).

SET_BATTLE_CHECKER Set Battle Checker Status

Function: set the status of Battle Checker.

Format: SET_BATTLE_CHECKER*status (0: Disabled; 1: Enabled).

SHOW_BATTLEOVER_BTN Show End-Battle Button

Function: show the button for the player to end battles manually.

Format: SHOW_BATTLEOVER_BTN*1.

SHOW_DEBUG_INFO Show Debug Info

Function: show debug info.

Format: SHOW_DEBUG_INFO*status value (0: Disabled; 1: Show buff info of player’s character).

OPENSTORE Open Trade Panel

Function: open the trade panel between the player’s character and a specific merchant.

Format: OPENSTORE*merchant ID.

RESET_STORE Refresh Merchant’s Items

Function: refresh a merchant’s item based on the configuration.

Format: RESET_STORE*merchant ID.

SET_TIMER Set Global Timer

Function: set a timer to delay the execution of some scripts.

Format: SET_TIMER*timer ID#time parameter (second; function is disabled when the parameter <= 0)#ID of event that will be executed when the timing ends#monitor field info (optional; allows you to view the remaining time on the variable monitor UI).

AREA_SPAWN Generate Unit in Area

Function: generate units in batch in a specific area.

Format: AREA_SPAWN*target area control ID#hero list#unit list (same format as the ENEMY_REINF directive)#faction index#default tactic (format: tactic code:tactic parameter; same as the SET_POLICY directive)#refreshed unit tag (optional)#extra unit attribute list (optional).

GETITEMS Player Gets Items or Resources

Function: player’s character gains a list of items (please note: money, EXP, and resources in the game can all be gained this way, as long as you have the correct mapping IDs).

Format: GETITEMS*item list info.

REMOVE_ITEMS Remove Items or Resources

Function: remove a certain number of items from the player’s inventory.

Format: REMOVE_ITEMS*item list.

LOOT Execute Drop Check

Function: execute a check according to the loot list (please refer to the format of Item Dropping Info).

Format: LOOT*Loot list.

ADD_EXP Hero Gains EXP

Function: a specific hero gains EXP.

Format: ADD_EXP*EXP#target hero ID(optional; player’s character by default).

SETSKILL Manage Hero Skill

Function: manage the skills of a hero. You can add, replace, or remove the skills of the hero.

Format: SETSKILL*Character ID (optional; player’s character by default)#skill list that needs to be added (format: skill ID 1, level| skill ID 2, level|…)#skill list that needs to be removed (optional; use “|” to separate skills).

CALL_LUAFUNC Execute LUA Function

Function: execute specific functions in the currently loaded LUA script.

Format: CALL_LUAFUNC*function name in the script.

ADD_INTER_OBJECT Add Interactive Object in Battles

Function: add an interactive object on the current battlefield.

Format: ADD_INTER_OBJECT*Interactive Instruction Info#location coordinate#normal model ID (defined in the D World Map Unit Model Table)#visible but noninteractive model ID#particle effect info (visible under normal status; format file name of particle effect: path: Asset\BuildSource\map_res\Particles\), offset X, offset Y)#initial status (0: Normal; 1: Visible but non-interactive; 2: Hidden)#control ID (used to control navigation)#built-in item info list (can be empty)#IDs of events triggered during interaction (optional)#behaviours after the interaction (optional; set default by 0). (0: remove from the scene;1: hide “waiting to auto-refresh” or refresh manually; 2: visible but non-interactive, waiting to be refreshed; 3: do not perform the action and handle this in the script)#auto refreshment time (optional; validated only when this parameter is not 0; set default by 0; manually refresh when >= 0)# event ID after refreshment (the ID of the event-triggered after refreshment).

REMOVE_INTER_OBJECT Remove Interactive Object in Battles

Function: remove an interactive object based on its ID.

Format: REMOVE_INTER_OBJECT#control ID (“THIS” can be used to refer to the object itself in an interactive script event).

SET_INTER_OBJECT Change Status of Interactive Object

Function: change the status of an interactive object based on its ID.

Format: SET_INTER_OBJECT#control ID (“THIS” can be used to refer to the object itself in an interactive script event)#new status value (0: Normal; 1: Visible but non-interactive 2: Hidden).

TELEPORT Teleport to Other Instance Maps

Function: teleport all allies to the target instance map.

Format: TELEPORT*map ID (needs to be defined in “F副本地图信息表”); X coordinate, Y coordinate.

REMOTE_EVENT Remote Execution Request

Function: Send a request to all clients to execute an event.

Format: REMOTE_EVENT*event ID.



Value Query in Battles

Query Directive Explanation
[%result_code%] Results of different event scripts in battles (e.g., the result of an option box).
[%bs_time%] How long the current battle has been going on (integer).
[%rnd:A,B%] Return a different random number each time (A<= this number <= B.)
[%last_rnd%] Return the result of the last [%rnd:A,B%] query.
[%const_rnd%] Return a random number (0~100)that stays the same during the execution period.
[%last_rnd_pos_x%] Return the X value of the last random position.
[%last_rnd_pos_y%] Return the Y value of the last random position.
[%last_rnd_pos%] Return the coordinate of the last random position.
[%last_skill%] The ID of the last skill used by the current queried source object.
[%this_type%] Type of the executor of the current directive (0: Hero; 1: Minion).
[%aim_type%] Type of the current queried target object (0: Hero; 1: Minion).
[%this_level%] Level of the executor of the current directive.
[%aim_level%] Level of the current queried target object.
[%this_hp_pct%] HP percentage of the executor of the current directive.
[%aim_hp_pct%] HP percentage of the current queried target object.
[%this_mp_pct%] MP percentage of the executor of the current directive.
[%aim_mp_pct%] MP percentage of the current queried target object.
[%friends_num%] The number of ally units left.
[%enemy_num%] The number of enemy units left.
[%hit_enemy%] Check if the current hit target is an enemy of the caster (1: Enemy; 0: Not Enemy.)
[%battle_res%] Current battle result.
[%skill_lv:SKILL_ID%] Level of a specific skill ID of the current source object; returns 0 if the level is 0.
[%base_atk%] A basic physical attack based on the current skill level.
[%base_magic_atk%] A basic magic attack based on the current skill level.
[%standard_magic_atk%] An overall magic attack based on the current skill level.
[%this_buff:BUFF_ID%] Number of stacks of source object’s current BUFF_ID.
[%aim_buff:BUFF_ID%] The current number of stacks of target object’s specific BUFF_ID.
[%stat:STAT_FIELD%] The current value of a specific field attribute of a source object.
[%aim_stat:STAT_FIELD%] The current value of a specific field attribute of a target object.
[%this_weapon%] Weapon type of the queried source object.
[%aim_weapon%] Weapon type of the queried target object.
[%charge_val%] Value of charging of this damage(0~100).
[%cmd_argval%] The parameter of the current command line.
[%cmd_argval_next%] Return the parameter of the current command line, and the parameter increases by 1 instantly.
[%rpt_index%] INDEX value of the loop where the current command line is located.
[%find_tag:TAGINFO%] Execute target unit searching once. TAGINFO is the target unit info (format: please refer to the instruction on Skill Object Format). When a proper target is found, returns 1, otherwise, 0.
[%add_find_tag:TAGINFO%] Add the target unit to the unit list that has been searched. Always returns 1. TAGINFO is the same as the explanation above.
[%rm_find_tag:TAGINFO%] Remove the target unit from the unit list that has been searched. Always returns 1. TAGINFO is the same as the explanation above.
[%reset_find_list%] Reset the current search list. It always returns 1.
[%rnd_enum:PROB_A,RES_A:PROB_B,RES_B:PROB_C,RES_C[:...]%] Randomly enumerate values, and return the RES value of one of the enumerated ones according to their probability distribution.

E.g.,

[%rnd_enum:25,1:40,2:35,3%] means that is a 25% chance to return “1”, 40% for “2”, and 35% for “3”.

[%dg_sp_state:ID%] Return the current status of the refreshed units whose Control ID is the ID field in the directive on the current battlefield (0:Not refreshed; 1: Refreshed; -1: Defeated).
[%dg_unitnum:TAG%] Return the number of refreshed units that have not been defeated and have the “TAG” tag on the current battlefield.
[%fd_sum%] Value of the defeated ally counter of the current source object.
[%ed_sum%] Value of the defeated enemy counter of the current source object.
[%fd_mod:MOD_VAL%] Value of defeated-ally counter of source object divided by MOD_VAL, and take the remainder.
[%ed_mod:MOD_VAL%] Value of defeated enemy -counter of source object divided by MOD_VAL, and take the remainder.
[%dg_int_val:KEY%] Return the value in a custom dungeon int field of a specific KEY.
[%emitter_pos:ID,MIN-MAX%] Return the emitter’s central position of a specific ID and a random position between its centre MIN and MAX. Record them in last_rnd_pos.
[%unit_timer:UNIT_ID,TIMER_ID%] Return the remaining time of the timer (whose ID is “TIMER_ID”) on a unit with a specific UNIT_ID.
[%this_intvar:ID%] Return the custom int value of the current directive executor (skill directive set_unit_intvar setting).
[%aim_intvar:ID%] Return the custom int value of the current queried target object (skill directive set_unit_intvar setting).
[%defeat_hit%] Check if the current directive is executed in a kill-unit directive and if the target unit has been killed (0: No; 1: Yes). Please note this only works in the hit directive.
[%eft_count:TAG%] Number of special effect units with a specific TAG

Please note: this only counts the special effect units created by the caster.

[%this_id%] The unit ID of the current queried object.
[%aim_id%] The unit ID of the current queried target object.
[%hit_dmg_val%] Actual damage or healing amount to a target unit in the current casting.

Please: this only works in the hit directive.

[%stealth_hit%] Check if the current skill or damage comes into effect when the caster is invisible (0: No; 1: Yes).
[%hit_count%] Times of the current skill is actually hitting units.
Following directives need client higher than 0.7.4.2 to be executed.
[%this_skills%] Return the skill list of the current source object.
[%aim_skills%] Return the skill list of the current target object.
Following directives need client higher than 0.8.0.1 to be executed
[%this_userid%] Return the client ID of the current source object.
[%aim_userid%] Return the client ID of the current target object.
[%player_money%] Player’s money in the game.
[%item_number:物品key%] Return the number of a specific item or resource in the player’s bag.

Format of Damage Expression

All kinds of damages from attacks, skills, special effects, and directives towards units are settled through a unified port. The primary parameter injected into the port is a data structure, which can be decided by damage expressions in various scripts. The common format of damage expressions is:

key1:value1;key2:value2;...;keyN:valueN

Damage expressions can be put into some data lists (e.g., the status value of the BUFF list), or into a value calculation expression (the [&expression&] format);

Currently supported damage expression key-value is:

  • type: damage type: 0: melee attack 1: ranged attack 2: skill damage 3: healing 4: MP regen
  • dmg: physical damage value. The value is the damage expression.
  • t_dmg: true damage value (all healing effects are counted as this type of value). The value is the damage expression.
  • hit: hit parameter (-1000~1000). When an attack cannot be evaded, the value is -1000.
  • blk: block parameter (-1000~1000). When an attack cannot be blocked, the value is -1000.
  • cri: critical rate parameter (-1000~1000). When an attack cannot deal critical damage, the value is -1000.
  • act: play unit action when they are hit. 0: No; 1: Yes
  • eft ID: special effect ID (when the unit is hit).
  • trig: trigger damage effect (e.g., damage reflection).
  • attack_type: decide the type of weapon attacks that caused the damage.
  • buff: Gain buffs when receiving damage, Format: BuffID,[time],[overlay]. The two parameters are optional, meaning time and the number of stacks.


Damage expressions only support standard mathematic expressions, containing the following math symbols: +-*/^%(). Certain pre-defined fields can be used, and all pre-defined fields should follow the format of [%cmd%]. Currently, we support the following pre-defined fields:

  • [%rnd:min_val,max_val%]: a random integer (min_val<= this integer<= max_val).
  • [%field%]: field stands for a random value defined in a character attribute field.


Skill Directive Editing

Skill directives are the essential elements used to realize different skill effects in battles. On the battlefield, when units cast abilities, their skill directives will be put into an execution queue, carried out one by one according to their execution environment.

In the skill configuration table, skill directive strings are separated with ”\n” , a line breaker. Every directive consists of: delay time*[conditional expression(optional)]#directive content. Please refer to the following format:

0*conditional expression 1#skill directive 1
0.2#skill directive 2
……

When the conditional expression is not empty, the execution of results will be judged accordingly.

In conditional statements, you can use built-in directives to realize some special effects, such as repetition.

*REPEAT_START:9
Statement 1
Statement 1
[@0.01*[%rpt_index%]@]#skill directive
...
Statement N
*REPEAT_END

The lines above repeat all lines between REPEAT_START and REPEAT_END for 9 times, during which you can use [%rpt_index%] to see how many times the lines have been repeated.

*SELECT_UNITS:[目标筛选条件表达式](注意,次数查询cast_info中的target为当前单位)
语句1
语句2
...
语句N
*SELECT_END

The lines above contain all command lines between SELECT_UNITS and SELECT_END, which will be used towards all objects that meet specific conditional expressions after “SELECT_UNITS:” make these objects “caster objects”.

The first two digits after the decimal point of the result of statements embedded in [@...@] will be maintained. This kind of query only works in skill directives.

Currently, supported skill directives are:

Skill Directive Instruction
stop_act Stop all current skill casting actions instantly and act according to previous directives.


stop_act#1
add_eft Add a pre-defined special effect unit onto the battlefield.


add_eft#special effect unit ID#intial position#movement parameter#change object of damage check (optional; set empty by default)#addtional damage expression (optional; calculate according to the damage expression defined in the special effect table when this is empty; format: please refer to Section 6.4)#target parameter (see Section 7.4)#special effect unit TAG (used for a query on replace_eft directive.)

Initial position format: position type, offset X, offset Y, offset Z (the offset value is the offset from the initial direction.)


Supported position types:

  • cast_pos: the preset position of skill casting.
  • tag_pos: the target position or target coordinate of skills.
  • hit_pos: the position of units hit by skills.
  • unit_pos: the position of the skilled caster.
  • start_pos: the beginning position of the caster when they cast skills.  
  • rnd_pos: any position around the skilled caster.
  • dim_pos: the preset position defined by the set_dimpos directive.
  • reinf_pos: the position of reinforcement of the skill caster’s side.
  • emitter_pos=EMITTER_ID: the position of emitter whose ID is EMITTER_ID.
  • unit_round=DIR:LEN: the position that is LEN away from the skilled caster, with an offset degree of DIR from the positive direction.
  • rnd_round=RAD[-MIN_RAD]: a random position within a radius of RAD around the skilled caster (MIN_RAD stands for the minimum distance between this random position and the  centre, set default by 0).
  • eft_pos=TAG: return the special effect position of the first specific special effect unit TAG. If there is no result, return to the current position of the caster. Note: this only supports query on special effect units created by the caster.
  • ……


Supported movement types are:

  • 0: No movement and no parameter.
  • 1: move to the target position of a skill. Offset X, offset Y, and offset Z.
  • 2: move to the target position of a skill. No parameter (when the target parameter is not empty, use the selected target of the parameter. Otherwise, cast the skill to its original target unit).
  • 3: move in a specific direction. Offset degree, distance (no longer than the width of the battlefield).
  • 4: move back and forth in a specific direction. Offset degree, distance (no longer than the width of the battlefield).
  • 5: follow a target. Following type (0: Fixed Relative Position; 1: Emitter’s Position), offset X, offset Y, offset Z, duration (-1: Eternal).
  • 6: move to dim_pos. Offset X, offset Y, offset Z.
dmg_check Damage check


dmg_check#check type#damage expression#target object parameter#check parameter list (use “,” to separate)# filter repetitive check object(optional; set disabled by default.)

Supported check types are:

  • 0: single check (see next section when the target unit is the target object parameter; emptiness means the target of skills).
  • 1: radius check. The target object parameter is the target type (0: Enemy; 1: Ally; 2: Both Sides). Parameter 1 in the parameter list stands for the reference position type (see the position type of the add_eft directive). Parameter 2~5 stands for the X, Y, Z, and radius in the offset coordinate.
  • 2: polygon check. The target object parameter and parameter 1 are the same as the second type. Parameter 3 is the number of vertices of the polygon; parameter 4 and the following parameters are the coordinate info of the polygon whose reference point coordinate is (0,0).


add_buff Grant a BUFF on a target
add_buff#buff ID#BUFF target parameter#duration (same as the default BUFF duration if designed specifically)#number of stacks(set default by 1)#uppder limit of stacks (same as the value in the configuration table by default; comes into effect when the number is bigger than 0.)


Currently, supported built-in target parameters are:

  • caster: skill caster.
  • target: target unit (unit of target-oriented skills or unit hit by skills.)
  • roleid,ROLEID: search for a target object whose unit-bound ID is ROLEID.
  • buffgiver,BUFFID: search for a buff giver who gave the buff (whose ID is BUFFID field) to the current caster.
  • find_tag_res: search for a result of a specific target (must execute [%find_tag:TAGINFO%] before calling.)
  • tag_next_fu,distance D:the next ally unit whose distance from the current hit target is shorter than distance D.
  • caster_next_fu,distance D: the next ally unit whose distance from the current caster is shorter than distance D.
  • caster_next_eu,distance D: the next enemy unit whose distance from the current caster is shorter than distance D.


remove_buff Remove a BUFF from a target
remove_buff#remove target (same as above)#removal type#parameter 1, parameter 2,parameter 3...

Currently, supported removal methods are:

  • 0· : remove all.
  • 1: remove a specific buff. Parameter 1 is the BUFF ID; parameter 2 is the number of removed stacks (-1: remove all by default).
  • 2: remove a negative buff (debuff). Parameter 1 is the number of removed buffs (-1: remove all by default), parameter 2 is the subtype of buffs (-1: unlimited by default).
  • 3: remove a buff. Parameter 1 is the number of removed buffs (-1: remove all by default), parameter 2 is the subtype of buffs (-1: unlimited by default).


dart_move Dash
dart_move#action ID#movement type#speed parameter#collision quallity#bound special effect#skill to cast after the movement, skill level(set default by 1)[can be empty], time offset(count by second; if a skill is cast before the movement ends, the time offset >= 0) [can be empty]#operation object (optional; caster by default)#correct target position (optional; see Section 2 for the format)#compulsory or not(set 0 by default; 1: compulsory move).

Movement types are:

  • 0: uniform motion.
  • 1: jump.
  • 2: knockback.
  • 3: knock up (when the movement type is knock-up, the speed parameter stands for the air time of the hit unit).

The speed parameter is the horizontal speed of the characters’ movement (when the speed is lower than0, the character flash to the target position).

Collision quality stands for the quality of a rigid body under uniform motion. 0 means ignoring the collision (when the movement type is jump, the parameter stands for the height of jumping)—as we do not use a physical engine now, the collision quality is of no use now. However, we still need to fill in the parameter.

“Bound Special Effect” is the special effect ID attached to the unit when they are moving.

“Skill to cast after movement” is the ID of the skill that will be cast right after the movement.


stop_dartmove Stop dashing
stop_dartmove#1


explode Physical explosion at the target position
explode#initial position (see the instruction on Skill Position Parameter Format)#explosion radius#intensity parameter


add_force Physical explosion at the target position
add_force#力度参数#目标单位(可省略,默认target)


play_sound Knock back the target once
play_sound#sound effect ID#sound effect position (see explanation in Section 1)


unit_sound_dic Play a sound effect from the SFX Dictionary according to the model configuration.
unit_sound_dic#SFX Dictionary KEY#unit target parameter


cast_sound Play a specific sound effect at a caster’s position
cast_sound#sound effect ID


chain_eft_to Play a chain-like special effect
chain_eft_to#caster unit#target unit#pre-made special effect unit#spreading speed(-1: instantly)#duration# damage expression when targets get hit.

For the parameter of caster unit, please refer to the instruction on the Skill Directive Target Parameter.

taunt Taunt and make target attack the caster instantly
taunt#caster#targe


use_skill ast any single-target skill that does not need channeling
use_skill#skill ID,skill level (set default by 1)#caster#target#target position parameter


set_cmd_val Operate the parameter of the current command line
set_cmd_val#operation method#operation value D

Methods: 0: set to be valued D; 1: increase value D; 2: decrease value D

Please note: different from other directives that are executed procedurally after the buffer, this directive will not enter the execution queue but will instantly come into effect. This is a structure designed for the case where you need to use temporary variables within statements to relay information.


set_dimpos Preset position parameter
set_dimpos#operation method#operation parameter[#offset parameter(only works when inquiring on the unit’s position)].

Methods:

  • 0: Ally reinforcement position. Parameters are the offset of X, Y, and Z.
  • 1: Query target unit position query. Parameters are query directives (see Section 4).
  • 2: Query skill parameter position query Parameters are query directives (see Section 2).


play_sk_act Play a defined skill action
play_sk_act#target unit#skill action ID#play speed coefficient (set 1 by default)#stop moving or not(set No by default).


summon_unit Summon a unit
summon_unit#summoning method#object parameter[,hp percentage (optional parameter, set 100 by default)]#initial position parameter#duration#additional status list#additional special effect parameter#unit faction reference target parameter (optional parameter, caster by default)#replace character skill (optional parameter; emptiness means maintenance of the original skill)#default tactic parameter.

Method: 0: a mirror image of the object; 1: summon by character ID; 2:summon by minion ID.


Object parameter: when the summoning method is 0, the parameter stands for the object unit (see Section 4 of this chapter); when the summoning method is 1, the parameter stands for the character template ID, level; when the summoning method is 2, the parameter stands for minion unit ID.


For the initial position parameter, please see Section 2 of this chapter.


If the duration is lower than 0, the battle will last forever; when it is higher than 0, it stands for the actual duration time (count by seconds).


Attached status is the attached attribute list of the unit. E.g. “s_HP,-[&[%s_生命%]*0.5&]|s_Attack,-[&[%s_攻击%]*0.5&]” means that the summoned unit has half of the original unit’s HP and Attack.


Attached special effect parameter: 0: Default; 1: Show half-transparent shadow effect.


Unit Faction Reference Target Parameter: the current faction of the target is the faction of the summoned units (caster’s faction by default).

set_unitpos Change the current position of a target by force
set_unitpos#operation object (same as Section 4)#position info (same as Section 2.)


set_active Set activation status of a target
set_active#operation object parameter (same as Section 4)#activate or not (1: Yes; 0: No), hide or not(1: Yes; 0: No; only works when the target is inactivated).


kill_unit Target is knocked down instantly (ignore invincibility)
kill_unit# operation object parameter (same as Section 4).


down_unit Target falls automatically
down_unit# operation object parameter (same as Section 4).


b_talk Chat bubble above the target’s head
b_talk#operation object#dialogue content#duration (count by second; neglectable).


yell Target shouts out words (mostly skills)
yell#operation object#words.


warning_area Set around battlefield warning area
warning_area#target position info#radius#duration (second).


timeline TimeLine skill object


Play Timeline action and execute the according to skill directive file (.txt)

timeline#specific TimeLine ID.


timeline_anim TimeLine skill action


Play Timeline action but does not execute the according to skill directive file (.txt).

timeline_anim# specific TimeLine ID.


block_act Lock actions of the current caster
block_act#status type (shown below)#status can be interrupted or not(0: No; 1: Yes)#lock time(count by second; when editing in Timeline, you can choose not to select this point of time and refer to the time difference of recalling block_act#0#0#0).

Available action-locking status:

  • 0: do not lock action.
  • 1: lock character’s attack and movement.
  • 2: lock character’s attack only.


camera_shake Camera Shake
camera_shake#duration (second)#intensity.


rotate Control and rotate a character
rotate#target unit parameter#initial rotation degree (compared to the current direction)#total rotation degree (rotate the target in the anti-clockwise way when the degree is below 0)#duration (second).


replace_eft Query and use specific special effect unit to replace the target special effect unit at the current position
replace_eft#specific special effect unit TAG#match number (match all when ≤0; match the earliest generated ones when >0)#ID of the special effect unit used to replace(stop the target special effect when this is left empty)#initial position(set empty by default; or use the hit_pos (same as add_eft)expression here by default)#movement parameter(optional; same as add_eft)# change object of damage check (optional; set empty by default)#addtional damage expression(optional; same as add_eft)#target parameter(same as add_eft)#special effect uint TAG (used for replace_eft directive query)#object parameter of the original special effect unit creator (optional; used to filter when querying; every unit by default).


hitstop Character frame pause
hitstop#operation object#decline speed of the beginning point of the curve (multiplier)# decline speed of the ending point of the curve (multiplier)#time (second)

(Character’s action speed becomes normal after the pause of the frame).

global_hitstop Global frame pause
global_hitstop# decline speed of the beginning point of the curve (multiplier)# decline speed of the ending point of the curve (multiplier)#time (second)

(Running speed of the world becomes normal after the pause of the frame).

set_skill_cd Change the cooldown of a specific skill of a caster
set_skill_cd#skill ID list (can be left empty; fill in All to refer to all skills of the unit; use “|” to separate multiple skill IDs#operation method (0: Decrease; 1: add a new value)#operation value (second).


get_items Gain items or resources in battles instantly (items obtained can be used by the main character only)
get_items#item list (format of item list is the same as the GETITEMS directive in the scenario directives)# target parameter of the object who gains the items.


set_unit_intvar Set a custom int variable for the unit
set_unit_intvar#variable ID#operation method(0:±change; 1: add a new value)#operation value#target parameter of the operation object (optional; caster by default).


call_battle_event Execute a specific battle event
call_battle_event#event ID#target parameter of the executor (optional; the default value of THIS object in the event script).


change_skill Replace the current skill list of the caster


change_skill#skill list info.


revert_skill Revert the current skill list of the caster to the original one
revert_skill#1


change_dungeon_skill Replace the dungeon skill of the caster
change_dungeon_skill#skill ID, level.


revert_dungeon_skill Revert the dungeon skill of the caster to the original one
revert_dungeon_skill#1


replace_tag_skill Replace a specific skill of a unit to another skill temporarily
replace_tag_skill#original skill ID#new skill ID, level (left empty if you want to revert to the original skill)#substitution duration (permanent when ≤0; last for seconds when >0)#target parameter of the object unit.


change_mp Change the current MP value of a unit
change_mp#target parameter of the object unit#new MP value (can be an expression)#show number special effect(0: No; 1: Yes)#ID of the special effect shown when the unit is hit(optional; do not show the effect when this is left empty).



Special Object IDs in Battles

We always query some target units with battle directives through character IDs. However, we can also return specific query objects with the following built-in IDs:

Special Built-in ID Explanation
PLAYER Player.
GM_A Fixed built-in units of A (used to realize some skill directives when there is no specific caster).
GM_B Fixed built-in units of B (used to realize some skill directives when there is no specific caster).
THIS The current executor of the directive (usually in the unit-mounting script).
RND_ENEMY_UNIT Random enemy minions (not on the current player’s side).
RND_FRIEND_UNIT Random ally minions (not on the current player’s side).
EMITTER={EMITER_ID} Emitter unit whose ID is EMITER_ID.


Editing of Trigger Scripts Attached to Unit Object

We can attach several trigger scripts to the unit by defining the trigger command on a dungeon unit object. . Characters in the character list can also have trigger scripts if we assign the attached_script field to be a script event ID in TAG.

[CMD_BEGIN]#trigger type 1#trigger condition (optional)#trigger parameter (optional)
CommanCommand-line 1
Command-line 2
...
Command line N
[CMD_END]
[CMD_BEGIN]# trigger type 1#trigger condition (optional)#trigger parameter (optional)
Command line 1
Command line 2
...
Command line N
[CMD_END]
...

Multiple dungeon object triggers can mount every object. Currently, supported trigger types are:

  • on_spawn: when it respawns.
  • enter_combat: enter battles.
  • get_hurt: unit receives damage.
  • dead: unit dies.
  • on_timer: triggered when the timer (set by battle directive SET_UNIT_TIMER) on the unit ends.
  • on_skill: triggered when this unit starts to cast skills. The trigger parameter is the skill ID.
  • hp_pct: triggered when the HP of the unit goes lower than a certain percentage for the first time. The trigger parameter is the target HP percentage.
  • Interactive: triggered when units with interactive objects in battles are executing interactive actions.


Following is an additional sample script:

[CMD_BEGIN]#enter_combat#
B_TALK*THIS#Close the door and let out the hounds!
[CMD_END]
[CMD_BEGIN]#get_hurt#[%this_hp_pct%][<=]5&[%dg_int_val:测试计数器1%][<=]0
SET_DG_INTVAR*测试计数器1#1#1
SKILL_CMD*THIS#THIS#0#add_buff#中立#caster B_TALK*THIS#Stop beating me! I beg you! I surrender! I’d give your everything I have!
CMD_RETREAT*1
[CMD_END]