Common Scenario Directives

来自部落与弯刀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.

Scenario Event

A scenario event is a basic element used to realize scenario scripts in the game. All scenario events in the game are called by emitters or executors and put into the directive queue. These scenario events will be run by the GameWorldManager one by one according to the in-game time. An integrate scenario event consists of the following parts:

1. Scenario Event ID: a unique label of a scenario event;

2. Directive Content: directives that will be executed after a scenario event is triggered;

3. Result: return a result according to the last directive, check conditions and jump to another possible line.

Scenario Event Trigger

Currently, all stories and events are established according to the mechanics of the scenario event trigger. The mechanics of a trigger is: event ports are set at different positions in advanced, and when the program accesses a position, it will call the port and import the current environment variables. The program will then traverse all defined triggers in the port event and return the trigger with the highest priority or all triggers that meet the conditions (to return one or all triggers is decided by the type of a port). Finally, a scenario event is executed. Triggers’ calling events is not executed immediately. Relevant events are put into the execution queue and get carried out procedurally until all events in the queue are executed.

Following is the list of scenario events defined in the game (port types in bold indicate that they execute all trigger events that meet the conditions instead of executing the one of the highest priority):

Port Type Explanation Object Type Object ID
passive Triggered passively;

usually used on triggers in the map editor or triggers that use the TRIGGER directive to execute directly.

talk Triggered when interacting with NPC.
first_in Triggered when the player enters the game for the first time.
encounter Triggered when interacting with units on the sandbox map. Control ID of the target Unit.
before_enter_map Triggered when entering the target map (if any mission trigger responds, the action of entering the map will be interrupted). Target map ID.
enter_map Triggered when entering a map. Target map ID.
before_leave_map Triggered when leaving the target map (if any mission trigger responds, the action of entering will be interrupted). Target map ID.
leave_map Triggered when leaving a map. Current map ID.
enter_place Triggered when entering the target location. Target location ID.
reach_place Triggered before entering a location on the world map (if any trigger responds, the action of entering the locaction will be interrupted) Target location ID.
leave_place Triggered when leaving the current location. Current location ID.
before_leave_place Triggered before leaving the current location (if any trigger responds, the action of leaving the location will be interrupted). Current location ID.
enter_building Triggered when entering the target building Target building ID.
reach_building Triggered before entering the target building (if any trigger responds, the action of entering the building will be interrupted). Target building ID.
leave_building Triggered when leaving the target building. Target building ID.
before_leave_building Triggered when leaving the target building (if any trigger responds, the action of leaving the building will be interrupted). Target building ID.
battle_start Triggered at the start of a battle.
battle_over Triggered at the end of a battle.
set_lord Triggered when AI appoints player as the ruler of a city.
job_cmd Triggered when the player is given a working order.
see_warband Triggered when encountering another squad and battle.
curplace_inwar Triggered when the location where the player is currently settling in is attacked.
quest_done Triggered when all conditions of a mission are met (mission incomplete). Mission ID.
on_end_work Triggered when completing a mission of a location.
occupy_place Triggered when the player occupied a location. Target location ID.
new_day Triggered when starting a new day. The target number of days.
reward_follower Triggered when the player rewards their followers.
reward_player Triggered when the player is rewarded.
dip_event Triggered when the player’s faction meets diplomatic affairs. Affair types:

1: Ransom Hostage 2: Friendly 3: Declare War 4: Alliance 5: Alliance Dismissed 6: Armistice.

Target Faction ID.
dip_ret_success Triggered when the player’s diplomatic request is met. Same as above. Same as above.
dip_ret_fail The diplomatic request is not met. Same as above. Same as above.
player_failed Triggered when the player failed in a skirmish. 
reinforce_request Triggered when reinforcement related to player happens.
is_fall Triggered when a faction collapsed. Faction ID.
is_to_fall Triggered when a faction loses all bases and is about to collapse. Same as above.
before_cash_present Triggered before being rewarded (action of rewarding is interrupted).
before_present Triggered before sending a gift (action of sending the gift is interrupted).
on_present Triggered when sending a gift.
encounter_role Triggered before the common dialogue that happens when the player encounters a character. Target Character ID.
helped_camp Triggered when the player encounters a conflict between two sides and helped one side. The faction of the leadrole of target’s squad.
on_place_rep_up Triggered when area tribute increased; the latest tribute value is stored in arg_int_val1.
on_place_rep_down Triggered when area tribute decreased; the latest tribute value is stored in arg_int_val1.
team_dismiss Triggered when a squad is dismissed. Squad Type:

0: character squad 1: squad created by scripts 2: caravan 3: dummy 4: peasant.

team_into_place Triggered when a squad enters a location. Squad Type: same as above. Target location ID.

Script Directive List

Script directives in the game usually follow the format of directive type*parameter 1#parameter2#...#parameter N, and uses line break to separate multiple lines of directives.

Currently, supported script directives are:

Directive Instruction
(null) Character Text Box

Function: show a dialogue with the typewriter effect and character painting.

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

Annotation:

When certain paragraph needs to be bound with audios, add <voice:audio ID> in the front of the paragraph to show the according to the audio file for the words. The audio will be turned off when you skip the paragraph.
You can separate multiple paragraphs by “|” so that one of these paragraphs will be returned randomly.
When the paragraph begins with “inner:...”, a special piece of information is used;
The built-in special information IDs and meanings are as follow:  
inner:set_player_job: object’s words when they give orders to player
inner:set_player_lord: text when the player is appointed as a ruler
inner:self_introduce: self-introduction of a character 
inner:cur_doing: the content of what the current character has been doing
inner:cur_team_intent: intension of the current squad
*position of character painting: can be both L or R; set to be L by default—L stands for the left side of the text box, R for the right side. 
EVENT Jump-to Event

Function: Jump to and execute another specific scenario event ID.

Format: EVENT*scenario event ID#jump to the index value of the target event's subcommand line (starts from 0).

SUB_EVENT Jump-to Subevent

Function: jump to and execute another specific subevent and is able to jump back via the SUB_EVENT_RETURN directive.

Format: SUB_EVENT*scenario event ID.

SUB_EVENT_RETURN Return to Subevent

Function: jump back to the last subevent from the current subevent.

Format: SUB_EVENT_RETURN*

SELECT Dialogue Selection List Box

Function: Based on the text box, after the dialogue content is printed, a selection list box pops up, lets the player choose an option, and returns the result (the according [%result_code%] of the result command 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).

Annotation:

when the KEY of an option begins with "+", the text box will not disappear after the player selects an option. 
SELECT_TALK Plugin Dialogue Option

Function: a selection list box that can present new options via a trigger list.

Format: SELECT_TALK*character ID#dialogue content#[ADDON_SELECT];[fixed option(e.g., 0: cancel)]#filter tag (separated by "|"; set to be "any" by default)

Annotation:

the first two parameters are the same as SELECT; the fourth parameter is the trigger type (set to be "any" by default if nothing is filled in), but certain options (whose trigger type is SELECT and meet conditions) will be selected from the trigger and be added as new options; the text shown is bound in the trigger, and the content of the triggered event is decided by the trigger event ID.
Please note: when using this directive, you need to add "[%result_code%][>]99:EVENTPOJO_EVENT* " to the result
In the trigger list, you can add a prefix "SUB_EVENT." to a trigger event ID to mark it as a subevent.
CMD_SELECT System Selection List Box

Function: a text box with a "confirm" button pops up.

Format: CMD_SELECT*select text info#option group (same as SELECT directive).

CONFIRM Text Confirmation Box

Function: a text box with a "confirm" button pops up.

Format: CONFIRM*text to confirm

TOAST Message on Screen

Function: a message pops up on the screen, which disappears after a short while.

Format: TOAST*message content

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 existing time of the dialogue, which is measured by the length of text).

GAME_MSG In-game News

Function: show a text in the UI message box, which can be reviewed in the News Log.

Format: GAME_MSG*news content#new type (0: Normal; 1: Warning; 2: System).

INPUT Input Text Box

Function: a text box pops up, and you can restore what you input in the queriable variable ([%input_str%]).

Format: INPUT*notice text#Len number limit of digit#default text.

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

SCREEN Fullscreen Subtitle

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

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

BLACK_SCREEN Screen Curtain

Function: cover the UI layer of the screen with a black curtain. Only UI objects like fullscreen subtitles can be shown on the curtain.

Format: BLACK_SCREEN*turn on or not(0: Disabled; 1:Enabled).

SHAKE_SCREEN Screen Shake

Function: execute a screen shake effect.

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

SET_WEATHER Set Weather

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

Format: SET_WEATHER*weather effect directive.

Annotation:

Format of weather effect directives: weather effect ID1, intensity|weather effect ID2, intensity|…weather effect IDN, intensity.
E.g., 雪,60|雾,20
Intensity Range:0~100; when the intensity is 0, the weather effect is disabled
For weather effect ID, please refer to Format of Weather Effect Info
BATTLE Start Battle

Function: start a skirmish or a battle defined in a specific battle table.

Format: BATTLE*battle ID (if you do not fill in a specific battle ID or fill in “ENCOUNTER”, you start a skirmish)#BGM (optional; if there is a BGM in a particular battle).

BATTLE_WITH Fight with Specific Unit

Function: start a custom fight with a specific target.

Format: BATTLE_WITH*target character info (optional)#minion info of the target (optional)#battle map info (optional)#battle location info (optional)#battlefield weather (optional)#BGM (optional).

BATTLE_WITH_TAGROLE Fight with Target Character

Function: start a specific fight with the target character immediately.

Format: BATTLE_WITH_TAGROLE*battle ID (battle ID is used to trigger scenario event only)#specific BGM (optional; if there is a BGM for a specific battle).

CHANGE_BGM Change Current BGM of the Game

Function: change the current BGM of the game based on the need of stories.

Format: CHANGE_BGM*parameter 1#paramter 2

Parameter 1: AudioID of the target BGM (switch back to the default BGM of the current map if this is empty; when the remaining field of this ID is “MUTE”, which means no BGM is played currently).
Parameter 2: validation type (0: invalidated when switching scenes; 1: always validated even when you save the game and come back unless you recall the CHANGE_BGM directive and define an empty AudioID).
PLAY_SOUND Sound Effect

Function: play a sound effect in the game.

Format: PLAY_SOUND*sound effect ID#delay time(set 0 by default).

PLAY_ROLE_VOICE Play Character Voice-over

Function: play an audio file that is defined in “Voice” of the character’s tags.

Format: PLAY_ROLE_VOICE*character ID, the setting of “Voice” of the relevant character’s tags.

DUNGEON [Unavailable]
NUMSEL Input Value Text Box

Function: a text box pops up, and you can restore what you input in the queriable variable ([%result_code%]).

Format: NUMSEL*text of input box#min value#max value#default value#item price#price message(when the item price is 0, system does not show the price message. Otherwise, the message needs to follow the format of “{0} Utar(s) for each unit, {1} Utar(s) in total”).

CHANGE_MONEY Change Player’s Money in Hand

Function: change the amount of money the player is holding according to the change value (the value can go lower than 0).

Format: CHANGE_MONEY*change value.

ROLE_CHANGE_MONEY Change a Specific Hero’s Money in Hand

Function: change the amount of money the player is holding according to the change value (the value can go lower than 0).

Format: ROLE_CHANGE_MONEY*Hero ID#change value.

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 (e.g., GETITEMS*Tea of Merchant’s Guild, 3| Bread,1).

AI_CAMP_GETITEMS All Factions Get Items or Resources

Function: Same as the GETITEMS Directive. All factions get items or resources after calling the current directive.

Format: AI_CAMP_GETITEMS*item list info.

TRANSFER_ITEMS Convert Item

Function: convert a specific item in the current item list into a new item proportionally.

Format: TRANSFER_ITEMS*original item ID#new item ID#number of original item# number of new item#conversion time.

E.g., “TRANSFER_ITEMS*小麦#小麦粉#1#1#10” means converting wheat(小麦) into wheat powder(小麦粉) at a 1:1 proportion. If during the conversion, the original item becomes insufficient, the conversion stops.

GET_RND_ITEM Select a Type of Item Randomly

Function: select a type of item randomly among several items.

Format: GET_RND_ITEM*object item list (e.g., GET_RND_ITEMS*茶叶(Tea), 3|面包(Bread), 1|牛奶(Milk), 2. This means that you will get one type of the three.)

REMOVE_ITEMS Remove Specific Item or Resource

Function: remove a certain number of items from the item list of the player.

Format: REMOVE_ITEMS*item list.

REMOVE_SELECT_ITEMS Remove the Selected Item

Function: remove a certain number of items after creating the UI Selection Item List according to the ITEMS_SELECTOR directive.

Format: REMOVE_SELECT_ITEMS*maximum number of selected groups (choose object groups in the front from the selected targets)#number of removal(optional; set -1 by default. When the number is lower than 0 or higher than the number of the object’s stacks, remove the whole group. Otherwise, draw a specific number of all selected targets).

REMOVE_PRESENT Remove Specific Gift Item That Meet Requirement

Function: remove a gift item from the item list based on a specific gift tag.

Format: REMOVE_PRESENT*gift description. For the format of gift description, please refer to the format of the tag of "Like" in the mission list.

ITEMS_SELECTOR Open Item Selection Text Box

Function: an item selection text box pops up. You can restore your choice in a queriable variable ([%last_seled_items%],[%last_seled_item_id%], etc).

Format: ITEMS_SELECTOR*title of text box#number limit (no limit when below 0)#conditional expression filter.

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

TEAM_GAINEXP Player’s Squad Gains EXP

Function: members in the player’s squad gain average EXP.

Format: TEAM_GAINEXP*exp gained (every unit gains the same amount of EXP).

TEST_ADD_ROLE_EXP Specific Hero Gains EXP

Function: a specific hero gains EXP.

Format: TEST_ADD_ROLE_EXP*hero ID#exp.

CHANGE_ROLE_LV Change Character Level

Function: change the level of a specific character.

Format: CHANGE_ROLE_LV*hero ID#expected level.

PLAYER_GUARDS_LEVELUP All Defending Heroes Level Up

Function: all heroes in a specific location increase their level by 1.

Format: PLAYER_GUARDS_LEVELUP*location ID.

PLAYER_TEAM_LEVELUP All Heroes in Player’s Squad Level UP

Function: all heroes in the player’s squad level up directly.

Format: PLAYER_TEAM_LEVELUP*.

SETTRIGG Set Trigger Switch

Function: turn on or turn off a trigger directly.

Format: SETTRIGG*trigger ID#status value (0: On; 1: Off)

TRIGGER Execute Trigger

Function: execute a specific trigger directly.

Format: TRIGGER*trigger ID

SET_ES Manually Set Scenario Event Status

Function: set the execution status of a scenario event manually (after the logics have been executed, the result will be marked with ResultCode of the current event).

Format: SET_ES*scenario event ID*status value (-1: Unexecuted; other values are the ResultCode of this event).

SETINTVAR Set Custom Int Variable

Function: set a custom int variable (recorded by saves). Some variable fields will be connected the in-game logic parameter (for custom int variable that are defined inside the program, please see the“Built-in Custom Variable Field”) and can be queried via built-in query parameter ([%int_val:ID%]).

Format: SETINTVAR*parameter ID#current int value

CHANGEINTVAR Change Custom Int Variable

Function: change the value of the current custom int variable.

Format: CHANGEINTVAR*parameter ID#value change (can be a negative number)#[optional: forceZero] After filling in forceZero, the value will not go below zero.

SET_TEMP_ID Set Temporary ID Variable

Function: set a temporary ID, which will not be recorded in saves and needs to be accessed in a unique way.

Format: SET_TEMP_ID*ID.

SETSTRVAR Set Custom String Variable

Function: set a string variable that can be recorded in saves. You can query this via built-in query parameter ([%str_val%]).

Format: SETSTRVAR*Variable ID#string value.

SETGAMETIMETAG Tag a Custom Crucial Time Point

Function: tag and record the current in-game time point with an ID. You can use [%tag_gametime_elapse%] to load the time span since the time point you record.

Please note: this directive is only used to transfer temporary variables in a series of stories, and the tag will not be stored in saves. Do not use this for scenes that need permanent data.

Format: SETGAMETIMETAG*time point ID.

SETGAMETIME Tag a Custom In-game Time Point

Function: tag and record the current in-game time point with an ID. You can query the relevant info of this time point via query parameter (see[%gametime_elapse%] and [%gametime_elapse_by_day%], etc.).

Format: SETGAMETIME*time point ID.

SET_CUSTOM_CD Set a Custom Cooldown Time

Function: set a custom cooldown timer and see whether the current cooldown is in use by checking if [%is_custom_cd:ID%] is 1 or not.

Format: SET_CUSTOM_CD*custom ID#Cooldown time(≤0: the cooldown is disabled;>0: set a specific time (count by day)).

GET_QUEST Claim a Mission

Function: claim a specific mission.

Format: GET_QUEST*mission ID.

ADD_QS Add Mission Subitem Counter

Function: add a subitem counter of missions manually.

Format: ADD_QS*mission ID#subitem index (starts from 0)#number of counter.

SETQUESTIEM Set Value of Mission Subitem

Function: set the value of the subitem of missions.

Format: SETQUESTIEM*mission ID#subitem index#value

DONE_QUEST Complete a Mission

Function: mark and complete a specific mission.

Format: DONE_QUEST*mission ID#reward or not(1: Yes).

SHOW_IMG Show a Character Painting Frame

Function: [not suggested; recommend using the SHOW_CG direcitve].

Format: SHOW_IMG*name of image*preset special effect 0*duration (second).

Format: SHOW_IMG*image resource name*preset special effect 0 *existing time (second).

CLOSE_IMG Disable Character Painting Frame

Function: disable the current character painting frame.

Format: CLOSE_IMG*preset special effect 0.

JOIN_ROLE Force Character to Join

Function: force a character to join your squad. If your team is full, this character will be placed in the Manage panel.

Format: JOIN_ROLE*character ID.

QUIT_ROLE Force Character to Leave

Function: force a character to leave your squad.

Format: QUIT_ROLE*character ID.

SET_PLACE Change Location Status

Function: set the current status of a location.

Format: SET_PLACE*location ID#status value (0: Normal; 1: Destroyed; -1: Hidden).

SET_ROLEPOS Set Character Position

Function: set a character’s position compulsorily (for character position info format, see the Character Position Directive).

Format: SET_ROLEPOS*character ID#position info

LEAVE_PLACE [Unavailable]
TELEPORT Teleport Player to Specific Position

Function: teleport player’s squad to a specific position in the world.

Format: TELEPORT*world position info.

TELEPORT_TO_PLACE Teleport Player to Specific Location

Function: teleport player’s squad to a specific location.

Format: TELEPORT_TO_PLACE*location ID.

TELEPORT_TO_ROLE Teleport Player to Target Character

Function: teleport player’s squad to where the target character is currently staying (this only works when the target is in a squad or a location).

Format: TELEPORT_TO_ROLE*character ID.

MAP_CMD Exclusive Directive Group for Unit Control on Sandbox Map

Function: control various units to execute specific directives on a sandbox map.

Format: MAP_CMD*directive content

Move to the target coordinate: MOVETO#target ID# X, Y of target coordinate X, Y#waiting for callback (1: No; 0: Yes).
Chase a specific target: CHASE#object ID#target ID#waiting for callback (1: No; 0: Yes).
Player enters a specific location: ENTER_PLACE#target location ID#method (0: Normal; 1: Stealth)#block enter_place events (0: No; 1: Yes).
Show a battle mark: SHOW_BATTLE_MARK#X, Y of the target coordinate.
Hide current battle mark: HIDE_BATTLE_MARK#1.
RESTORE Player’s Squad Get Recovered

Function: all units in the player’s squad are recovered.

Format: RESTORE*parameter (<=0: squad fully recovered; >0: squad recovered by a specific point).

TIME_ELAPSE Time Acceleration

Function: use this directive to accelerate in-game time. During the acceleration, a time bar will show up.

Format: TIME_ELAPSE*in-game time#time multiplier#frame message#can be canceled (0: Yes(default); 1: No)#show time bar (0: No(default); 1: Yes)#operation icon(icon name under Assets\BuildSource\Icons)#UI follows player’s squad (0: No; 1: Yes).

WAIT_EXEC Wait and Execute a Script Event

Function: show a timer and wait for some time (in-game). A scripted event will be executed when the timer ends.

Format: WAIT_EXEC* in-game time#time multiplier#frame message#can be canceled (0: Yes(default); 1: No)#script event ID #operation icon(icon name under Assets\BuildSource\Icons)#UI follows player’s squad (0: No; 1: Yes).

OPENSEIGE Open Siege Management Panel

Function: show a siege management panel and operate reinforcement squads based on the preset (this should work with a proper directive triggering environment. E.g., city-entering trigger). Format: OPENSEIGE*panel mode(0: attack city; 1: defend city)#target location ID (optional; set to be the target location of the current environment variable by default).

OCCUPY Execute City Occupation

Function: execute city occupation check based on the current environment (this should work with a proper directive triggering environment. E.g., city-entering trigger).

Format: OCCUPY*0.

JOIN_WARBAND Join Warband

Function: joined an existed warband(a group of fighting squads from two different sides) (use [$tagwb:id$] to obtain the Warband info of the current skirmish).

Format: JOIN_WARBAND*warband ID.

CHANGE_CAMP Change Character Faction

Function: change the faction of a target character directly.

Format: CHANGE_CAMP*faction ID#target character ID#recruiter ID(if this field is player then the character will join the player’s squad directly).

CREATE_OWN_CAMP Player Creates Their Faction

Function: player creates and activates their own faction. Player’s faction has a fixed default ID: Self-built Faction. This faction exists since the beginning of the game, but it is inactivated. Calling this directive will activate the player’s faction, making player and their followers join this faction.

Format: CREATE_OWN_CAMP*name of self-built faction.

SET_CAMP_ACTIVE Change Faction Project Status

Function: change the project status of a faction. When a faction is inactive, it will not execute any strategy or faction behaviour.

Format: SET_CAMP_ACTIVE*faction ID#status value (0: Inactive; 1: Active).

SET_CAMP_RL Change Faction Relationship

Function: change diplomatic relationship or friendliness between factions.

Format: SET_CAMP_RL*faction A#faction B#relationship (-1: Remain the same; 0: Neutral; 1: Hostile; 2: Friendly)#friendliness value change#expected friendliness value (if this field exists).

CHG_CAMP_REP Change Player’s Prestige (Tribute) towards Faction

Function: change player’s prestige (Tribute) towards a faction.

Format: CHG_CAMP_REP*target faction ID#value change#expected value (this works when the value is not empty). The faction refers to the player’s current faction if the faction ID is empty.

CHG_PLACE_REP Change Player’s Prestige (Friendliness) towards Faction

Faction: change the player’s prestige (Friendliness) towards a faction.

Format: CHG_PLACE_REP*locationID#value change# expected value (this works when the value is not empty).

FAME Change Player’s Global Prestige

Function: change the player’s current global prestige.

Format: FAME*value change.

CHANGE_FAME Change Character’s Global Prestige

Function: change a specific character’s current global prestige.

Format: CHANGE_FAME*target character ID#value change.

CHG_PERSON_FV Change Favor between the Player and a Character

Function: change favor between the player and another character.

Format: CHG_PERSON_FV*target character ID#value change#expected value (this works when the value is not empty).

SET_ROLE_ACTIVE Change Character Project Status

Function: change the project status of a character (not controlled by the player). When this character is inactive, they will not be refreshed in Taverns or execute AI actions like moving.

Format: SET_ROLE_ACTIVE*character ID#status value (-1: Inactive; 0: Active).

CHG_PROSP_BY_CAMP Change Prosperity of All Bases of Faction

Function: change the prosperity of all bases of a specific faction proportionally.

Format: CHG_PROSP_BY_CAMP*faction ID#percentage(>=100).

CHG_PLACE_PROSPERITY Change Location Prosperity

Function: change the Prosperity of a specific location by a fixed value.

Format: CHG_PLACE_PROSPERITY*location ID#value change#expected value (this works when the value is not empty; cannot exceed the maximum Prosperity of the location).

CHG_PLACE_PROSPERITY_BY_PCT Change Location Prosperity by Percentage

Function: change the Prosperity of a specific location by percentage.

Format: CHG_PLACE_PROSPERITY_BY_PCT*location ID#percentage change (>=100).

CHG_PLACE_DEF Change Location Defense

Function: change the Defense of a location by a fixed value.

Format: CHG_PLACE_DEF*location ID#value change#expected value(this works when the value is not empty; cannot exceed the maximum Defense of the location).

CHG_PLACE_DEF_BY_PCT Change Location Defense by Percentage

Function: change the defense of a location by percentage.

Format: CHG_PLACE_DEF_BY_PCT*location ID#percentage change.

CHG_PLACE_SECURITY Change Location Security

Function: change the security of a location by a fixed value.

Format: CHG_PLACE_SECURITY*location ID#value change#expected value (0-100).

PLACE_CUSTOM_INT Custom Field Value of Location

Function: a custom int field value of a specific location.

Format: PLACE_CUSTOM_INT*location ID#mark ID#int mark value.

CHG_PLACE_CUSTOM_INT Change Custom Field Value of Location

Function: change the custom int value of a specific location.

Format: CHG_PLACE_CUSTOM_INT*location ID#field KEY#value change#target value.

PLACE_ADD_BUILDING Add Custom Facility

Function: add a custom facility to a location.

Format: PLACE_ADD_BUILDING*location ID#facility ID (invalidated when the target location already has this facility).

PLACE_REMOVE_BUILDING Remove Custom Facility from Location

Function: remove a specific custom facility from a location.

Format: PLACE_REMOVE_BUILDING*location ID#facility ID.

CREATE_CARAVAN Create Caravan

Function: create a caravan in a specific location.

Format: CREATE_CARAVAN*set-off city ID#destination city ID#TAG (TAG used to mark squad).

CREATE_TEAM Create Squad

Function: create a squad, which takes actions according to specific directives.

Format: CREATE_TEAM*position on the map#faction#character list (characters included will leave their current squads or locations compulsorily)#minion card list (card ID#level, number |card ID2#level 2, number 2|.......)#directive method (see below)#directive parameter#squad TAG(used to search for specific squads).

Currently, supported directive methods are:

· 0: custom directive: the parameter of the custom directive is the directive for the squad (format: directive type 1, parameter 1; directive type 2, parameter 2;……; directive type N, parameter N) For detailed directive format, please see the Squad Preset Directive.

· 1: premade directive of invading city: the parameter is the ID of the target city, invasion method (set 0 by default).

· 2: premade directive of invading faction: the parameter is the ID of the target faction, priority of target (0: Distance first; 1: Defense first), invasion method (set 0 by default).

DISMISS_TEAM Dismiss Squad

Function: dismiss a specific squad.

Format: DISMISS_TEAM*map unit identification ID

TEAM_ORDER Change Squad Directive

Function: change the current directive list of the squad.

Format: TEAM_ORDER*map unit identification ID#new directive (for the detailed directive format, please see the Squad Preset Directive).

INVASION_PLACE Attack Location

Function: assign one location to attack another location. These two locations must belong to two opposite factions and have battle units inside.

Format: INVASION_PLACE*attacker (location) ID#target location ID#attack method (set 0 by default).

INVASION_CAMP Attack Faction

Function: assign one faction to attack another faction immediately. Please note: these two factions must be hostile towards each other or both stand neutral. If the attacker does not have sufficient military power, the attack might not happen.

Format: IVASION_CAMP*attacker (faction) ID#target faction ID#priority of target(0: Distance first; 1: Defense first)#invasion type (0: Occupation; 1:Raid)#number of bases involved (0: All; >0: bases that are close)#invasion intensity (0: Maintain strength; 1: All out (use all resources)).

OPENSTORE Open Trade Panel

Function: open the trade panel with a specific merchant.

Format: OPENSTORE*merchant ID (execute an auto query based on the location and the current NPC if this ID is empty).

RESET_STORE Refresh Merchant’s Items

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

Format: RESET_STORE*merchant ID

ADD_LOCAL_PRODUCT Add Map Specialty

Function: add specialities to a specific map. Nearby merchants will refresh their speciality offerings after adding.

Format: ADD_LOCAL_PRODUCT*specialty ID#map ID#central coordinate X#central coordinate Y.

TRADE_PERMISSION Set Trade Permission

Function: set trade permission for a location.

Format: TRADE_PERMISSION*location ID*can trade or not (0: No; 1: Yes).

TROOPS_ALLOC Garrison Panel

Function: open the garrison panel of a location.

Format: TROOPS_ALLOC*location ID (refer to the current location if the ID is empty).

GETSKILL Learn Skill

Function: add a new skill to a character.

Format: GETSKILL*character ID#skill list (format of single skill: skillID, level(optional); use “|” to separate multiple skills).

LEARN_SKILL Consume Skill Point to Learn Skill

Function: select a character in a squad and make them learn a new skill. If they do not have enough skill point, they cannot learn the skill.

Format: LEARN_SKILL*skill ID#skill point needed (can be empty; set 1 by default).

REMOVESKILL Forget Skill

Function: remove a skill from a specific target.

Format: REMOVESKILL*character ID#skill list (use “|” to separate multiple skills)

RESET_SP Reset Skill Point

Function: reset the skill points of a character.

Format: RESET_SP*character ID

ADD_UNUSEDSP Change Available Skill Point

Function: add a new skill point to a player and allocate the skill point.

Format: ADD_UNUSEDSP*number of skill point.

SET_SKILLPAGE Activate or Remove Player’s Skill Page

Function: activate or remove a skill page of the player.

Format: SET_SKILLPAGE*skill page ID table (separate with “,”)#status (1: Activate; 0: Remove)#target character ID (optional; set to be player by default).

SHOW_TEAMINFO Show Info of Current Squad

Function: show the information on the current squad that you encounter.

Format: SHOW_TEAMINFO*1.

SET_FLAG Set Complete Mark

Function: set a mark to indicate accomplishment, which is usually used at the critical turning point of the story.

Format: SET_FLAG*name of the mark#mark value.

UPDATE_MARKS Mark Update

Function: update marks on the map.

Format: UPDATE_MARKS*1.

SET_DUMMY Set Dummy or Creep Status

Function: set the status of dummies or creeps on the map. When taking control of creeps, the dummy ID is the creep ID.

Format: SET_DUMMY*dummy ID#status (0: Displayed; -1: Hidden).

SET_CAMERA Set Camera Mode on Sandbox Map

Function: control the camera mode on the sandbox map.

Format: SET_CAMERA*camera mode#parameter

and meanings of the parameters:

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

1: follows a specific target. The parameter is the particular map unit identification ID.

2: focuses on a position. The parameter is the coordinate (map ID: X, Y)#camera movement speed.

SET_PLACE_CAMP Set Faction-exclusive Location

Function: change the faction of a location.

Format: SET_PLACE_CAMP*target location ID#target faction ID#occupy by invasion (1: Yes; 0: No).

SET_MAP_CAMP Set Faction-exclusive Map

Function: change the faction of all cities on a map.

Format: SET_MAP_CAMP*target map ID#from faction ID#to faction ID#occupy by invasion or not (1: Yes; 0: No).

TRY_RECRUIT_FREE_ROLE Try Neutral Hero Recruitment

Function: try to execute a neutral hero recruitment check (Return 1: successful; return 0: Internal error; return 2: squad full).

Format: TRY_RECRUIT_FREE_ROLE*character ID.

CHK_RECRUIT_CAPTIVE [Unavailable]
RELEASE_CAP [Unavailable]
SEND_ENVOY Send Diplomatic Envoy

Function: send a diplomatic envoy for specific diplomatic missions.

Format: SEND_ENVOY*faction ID (refer to player’s faction when empty)#diplomatic behaviour (1: Ransom; 2:Friendly; 3: War; 4: Alliance; 5: Alliance broke; 6: Armistice)#target ID (when you ransomed a character, it is the character ID; otherwise it is the target faction ID)#additional parameter(usually it is the required amount of money)#envoy arrival (1: No waiting time; 0: Need to wait).

DIP_DECIDE Execute Diplomatic Event Check

Function: have a check on the current diplomatic event (used only in a specific trigger environment of the diplomatic event).

Format: DIP_DECIDE*result code (1: Agreement; 0: Decline).

EXPEL_ROLE Expel Character

Function: expel a character out of a faction.

Format: EXPEL_ROLE*faction ID#character ID.

TRY_REWARD_ROLE Try to Reward a Follower

Function: try to reward a follower.

Format: TRY_REWARD_ROLE*character ID (refer to the current object if the ID is empty).

ADD_GLOBAL_BUFF BUFF Add Global Buff to Squad

Function: add a global buff to the current squad.

Format: ADD_GLOBAL_BUFF*buffID#duration (in-game days)#number of stacks (set 1 by default)#upper limit of stacks (set -1 by default, no limit).

RM_GLOBAL_BUFF BUFF Remove Global Buff of Squad

Function: remove a global buff of the current squad.

Format: RM_GLOBAL_BUFF*buffID

RM_GLOBAL_BUFF_BYCLASS BUFF Remove Global Buff of Squad by Buff Type

Function: remove a global buff of the current squad by buff type.

Format: RM_GLOBAL_BUFF_BYCLASS*Global BUFF type.

RM_ALL_GLOBAL_BUFF BUFF Remove All Global Buffs of Squad

Function: remove all global buffs of the current squad.

Format: RM_ALL_GLOBAL_BUFF*1.

PLAYER_FAILED Game Failed

Function: a common result of the player failing their game.

Format: PLAYER_FAILED*1.

LOSE_INVENTORY Player Loses Common Items

Function: the player loses their items once (only goods and money).

Format: LOSE_INVENTORY*proportion(the proportion is an int, which stands for percentage).

SET_TAGROLE Change Object Character of Current Script

Function: set a default object character of the environment variable of the current script.

Format: SET_TAGROLE*character ID.

SET_TAGPLACE Change Object Location of Current Script

Function: set a default object location of the environment variable of the current script.

Format: SET_TAGPLACE*location ID.

SURRENDER Faction Surrenders

Function: assign one faction to surrender to another faction (all bases are occupied; the degree of royalty will randomly decide whether followers will surrender).

Format: SURRENDER*ID of the faction who surrender#ID of the surrender accepter

GEN_RND_PLACE Select Random Location to Query

Function: generate a random location, which can be queried via the [%last_rnd_place_XX%] directives.

Format: GEN_RND_PLACE*faction ID (if this ID is empty, then the location will belong to player’s faction)

HERO_UPGRADE Hero Enhancement

Function: enhance an attribute permanently of a specific character.

Format: HERO_UPGRADE*hero ID#attribute ID#value increase#limit of increase (must fill in a number; -1 means that there is no limit).

HERO_SET_STATU Set Character Attribute Field

Function: set a value of an attribute field for a specific character.

Format: HERO_SET_STATU*character ID#attribute ID#new value(refer to player when character ID is emptyID).

ADD_CAMP_BUFF BUFF Add Faction Buff

Function: add a faction buff to a specific faction.

Format: ADD_CAMP_BUFF*faction ID#buff ID#duration (in-game days; when this value is lower than 0, the buff becomes permanent unless it is removed compulsorily).

RM_CAMP_BUFF Remove Faction Buff

Function: remove a faction buff from a specific faction.

Format: RM_CAMP_BUFF*faction ID#buff ID.

RM_CAMP_BUFF_BYCLASS Remove Faction Buff by Buff Type

Function: remove a faction buff from a specific faction by buff type.

Format: RM_CAMP_BUFF_BYCLASS*factionID#faction BUFF type.

RM_ALL_GLOBAL_BUFF Remove All Faction Buffs

Function: remove all faction buffs from a specific faction.

Format: RM_ALL_GLOBAL_BUFF*faction ID.

ADD_CAMP_EXTRA_STATU Add Faction Attribute Field Value

Function: add a dynamic attribute field to a faction.

Format: ADD_CAMP_EXTRA_STATU*faction ID# dynamic attribute field list (see the format of initial faction attribute in the “阵营表”(excel file)).

RESET_CAMP_EXTRA_STATU Reset Faction Attribute Field Value

Function: reset all values in the dynamic attribute field in a faction.

Format: RESET_CAMP_EXTRA_STATU*faction ID.

WEAPON_DURABILITY_DOWN Weapon Durability Decrease

Function: reduce the durability of the current weapon. When the durability is below 0, the weapon is destroyed. If the weapon’s durability is -1 (does not have durability), nothing happens with this directive.

Format: WEAPON_DURABILITY_DOWN*value.

ITEM_DURABILITY_DOWN Specific Item Durability Decrease

Function: reduce the durability of an item (with the right tag and meets the level condition(>= the required level) ) in the player’s bag by [value] points. If the item does not have sufficient durability, then it will be destroyed.

Format: ITEM_DURABILITY_DOWN*weapon tag#weapon level filter#value.

SET_SYNTH_STATE Set Status of Recipe

Function: set the status of a specific recipe.

Format: SET_SYNTH_STATE*recipe ID#new status (0: Not learned; 1: Learned)

OPEN_SYNTH_DLG Open Item Crafting Dialog

Function: open the dialogue UI of item crafting.

Format: OPEN_SYNTH_DLG*if locked (0: Do not lock the main category; 1: Lock display category)#catagory page shown by default (can be set empty by default; use “,” to separate pages; show the first page by default; this field can show hidden categories when the main category is locked)#story key to execute after closing the crafting dialogue (can be empty).

OPEN_CARD_SYNTH_DLG Open Card Crafting Dialog

Function: open the dialogue UI of card crafting.

Format: OPEN_CARD_SYNTH_DLG*1.

PLAY_EFT Play Special Effect

Function: play a special effect on the current map.

Format: PLAY_EFT*special effect path (relative to Asset directory. E.g., Assets\BuildSource\battle_effects\SkillEffects\psLightingHit1.prefab)#map coordinate#initial rotation degree (can be the rotation vector of the three directions or a spinning degree of the Y-axis)#scale proportion (can use the percentage vector of the X, Y, and Z-axis, or the overall scale proportion)#duration (count by second; the effect will be removed after exceeding this duration)#delay (set 0 by default).

PLAY_MU_EFT Unit Following Special Effect on Map

Function: play a special effect that follows a unit on a specific map.

Format: PLAY_MU_EFT*special effect path (relative to Asset directory. E.g., Assets\BuildSource\battle_effects\HitEffects\psHealEft1.prefab)#map unit ID#object range (0: hero only; 1: all units)#initial rotation degree (can be the rotation vector of the three directions, or a spinning degree of the Y-axis))# scale proportion (can use the percentage vector of the X, Y, and Z-axis, or the overall scale proportion)#duration (count by second; the effect will be removed after exceeding this duration)#delay (set 0 by default).

OPEN_MAPAREA_SELECTOR Open Map Area Selector Panel

Function: open a UI panel of area selector on the current sandbox map. You can select a location for the current object in the predefined area on this panel, and then a result is returned. If the result_code returns 1, the location setting succeeded; if 0, the setting failed. The location info is recorded in [$last_selpos$].

Format: OPEN_MAPAREA_SELECTOR*area identification ID# shown model#exclusion mode (0: Non-exclusive; 1: Custom chest excluded)#notice info.

OPEN_FREEAREA_SELECTOR Open Free Map Area Selector Panel

Function: same as OPEN_MAPAREA_SELECTOR, but is no longer limited regarding provided map areas.

Format: OPEN_FREEAREA_SELECTOR*width (int)#height(integet)#shown model#exclusion mode (0: Non-exclusive; 1: Custom chest excluded)#notice info.

PLACE_SELECTOR Open Location Selector Panel

Function: open a suggested location selector panel. Selected result will be stored in [$tagplace$], its number stored in [%result_code%].If [%result_code%] is 9999, player cancels the selection.

Format: PLACE_SELECTOR*notice info#selection condition (transmitted to [%tagplace%] as a judgmental parameter).

SET_LORD Set City Ruler

Function: set a city ruler for a specific location.

Format: SET_LORD*character ID#location ID.

ADD_CUSTOM_CHEST Add a Custom Chest

Function: add a custom chest on the world map according to the setting info (this “chest” can be any interactive object on the world map, such as materials, ruins, and soldier recruitment point).

Format: ADD_CUSTOM_CHEST*chest ID#ID in the according 宝箱表(Chest Table)#position info#initial status (>0: How many times you can open the chest; -1: Chest Opened)#default direction (0-360).

SET_CHEST Set Chest Status

Function: set the status of a controllable chest on a map.

Format: SET_CHEST*map ID#chest ID#status (>0: How many times you can open the chest; <=0: Chest Opened).

SET_CURCHEST Set Current Chest Status

Function: set the status of the target chest in the current script.

Format: SET_CURCHEST*statu (same as SET_CHEST).

CLOSE_SYSTEM_UI Turn Off System UI

Function: turn of the current system UI.

Format: CLOSE_SYSTEM_UI*.

CLOSE_ITEM_PANEL Close Bag UI

Function: close the current UI panel of the player’s bag (if it exists).

Format: CLOSE_ITEM_PANEL*.

ROLES_SELECTOR Turn Off Character Selector UI

Function: turn off the current system UI of the character selector.

Format: ROLES_SELECTOR*title of selection list box#number limit of options (<0: No limit)#option range (0: Global non-template character; 1: Player squad character; 2: Character in the Character Table)#conditional expression#parameter (the parameter is the character list when the selection range is the specific Character Table).

E.g.,

ROLES_SELECTOR*select character in the target faction #1#0#[$tagrole:campid$][=][$player:campid$]&[$tagrole:campid$][<>][$null$]#
ROLES_SELECTOR*one of the several target objects #1#2##character 1|character 2|character 3|character 4.

The result of selection is stored in [%last_seled_roles%]. If there is only one result, it will also be stored in [%tagrole%].

ASK_ABOUT_SOMEBODY_SELECTOR Ask-about Character Selector

Function: the character who you ask whereabout of is currently not involved in the logic calculation. The character selection list box pops up, and the result is stored in [%arg_str_val1%]. When the result [%result_code%] is 9999, player cancels the selection.

Format: ASK_ABOUT_SOMEBODY_SELECTOR#character you ask about.

CARD_SELECTOR Card Selector

Function: show the panel of current card list for the player to select.

Format: CARD_SELECTOR*title of selection list box#number limit of selection (<0: No limit)#selection range (0: Card in the player squad; 2: Specific unit list) #parameter (optional; the parameter is the unit list when the selection range is the specific Unit Table).

ASSEMBLE_ARMY Gather Troops

Function: gather all troops and followers of a faction.

Format: ASSEMBLE_ARMY#Gatherer ID#follower ID (can be empty; use “|” to separate; can use [%last_seled_roles%], the result of ROLES_SELECTOR). If the follower ID is empty, all characters under the faction are selected by default.

RELEASE_ALL_ASSEMBLE_ARMY Dismiss All Gathered Troops

Function: dismiss all troops that have been gathered or gathering.

Format: RELEASE_ALL_ASSEMBLE_ARMY#gatherer ID.

SET_ROLE_IN_PROJECT Character Starts to Execute Project

Function: a character starts to execute a specific project.

Format: SET_ROLE_IN_PROJECT*character ID#project ID.

SET_ROLE_FINISH_PROJECT Character Ends Current Project

Function: a specific character ends their current project compulsorily.

Format: SET_ROLE_FINISH_PROJECT*character ID1, character ID2,...

ROLE_PROJECT_ADMIN Open Personal Project Panel

Function: open the personal project execution panel.

Format: ROLE_PROJECT_ADMIN*project ID#location to bind (optional; set to be the current location by default).

GROUP_PROJECT_ADMIN Open Group Project Panel

Function: open the group project execution panel.

Format: GROUP_PROJECT_ADMIN*project label#title#project binding type#project-bound object parameter (optional; set to be the current object by default).

Currently, supported project binding types are:
Place: location building construction; object parameter is the location ID; refer to the current location if the ID empty
world: custom building construction; object parameter format: custom area control ID; belong to which base (when this field is empty, the building does not belong to any city).
SET_REVIVE_POS Set Respawn Position

Function: set a new respawn position.

Format: SET_REVIVE_POS*world map position (map ID:x,y).

SET_SILENCE_MODE Set Silence Mode

Function: enable or disable message silence mode.

Format: SET_SILENCE_MODE*silence mode (0: Disabled; 1: Do not show TOAST box and deliver messages only; TOAST info of obtaining items is shown in the message; 2: Do not show TOAST and messages).

START_RAID_PLACE [Abolished]
ADD_CUSTOM_PLACE Add Custom Location

Function: add a custom location on a specific spot on the world map.

Format: ADD_CUSTOM_PLACE*custom location ID (globally unique)#belong to the city (can be empty; the location does not belong to any city when this field is empty#location info template ID#location info#default faction of the location.

SET_PLACE_NAME Change Location Name

Function: change the name of a specific location.

Format: SET_PLACE_NAME*location ID#custom name.

OPEN_PLACE_BUILD_UI Open Location Building Construction Panel

Function: open the location building construction panel.

Format: OPEN_PLACE_BUILD_UI*location ID#script executed after successful construction (optional)# script executed after construction is cancelled (optional).

ADD_CARD Add New Card

Function: add a premade card.

Format: ADD_CARD*card ID#recruit for free (1: Free; 0: With a cost; set 0 by default).

ADD_CARD_PIECE Add Card with Specific Durability

Function: add a premade card, whose durability is a specific number (lower than the durability limit).

Format: ADD_CARD_PIECE*card ID#maximum durability#recruit for free (1: Free; 0: With a cost; set 0 by default).

SET_OBS_AREA Set Obstacle Area Status

Function: set the status of an obstacle area on a map.

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

EXPLORE_AREA Explore Area

Function: explore an area of the current map (dispel the war fog).

Format: EXPLORE_AREA*X coordinare,Y coordinate#exploration radius

EXPLORE_MAP Explore the Whole Map

Function: explore the whole map (dispel the war fog of the entire map).

Format: EXPLORE_MAP*map ID.

ADD_INTVAL_WATCHER Add Custom Variable Monitor Field

Function: add a custom variable monitor field to supervise the current value of the variable field on a specific area.

Format: ADD_INTVAL_WATCHER*variable monitor info.

(Format: field Key1,displayed name1,enumerated value 1a=enumerated name1a|enumerated value 1b=enumerated name1b|...|enumerated value 1N=enumerated name 1N, visibility status in battles([optional,set 0 by default] 0: No; 1: Yes);...; monitor field info N).

REMOVE_INTVAL_WATCHER Remove Custom Variable Monitor Field

Function: remove a specific custom variable monitor filed.

Format: REMOVE_INTVAL_WATCHER*field KEY.

CLEAR_ALL_INTVAL_WATCHERS All Variable Monitor Field

Function: exact all variable monitor fields.

Format: CLEAR_ALL_INTVAL_WATCHERS*.

SET_TIMER Set Event Timer

Function: set an event timer, and a specific event will be executed when the timer ends.

Format: SET_TIMER*timerID (when the ID has been taken, the other timer info will be covered)#time parameter (<0: the timer is closed; when the timer type is Preset, this parameter is the number of days since the beginning of the game; when the timer type is Countdown, the parameter is the number of days)#timer type (0: Preset (triggered when time is reached); 1: Countdown)#Event ID when time reached#compulsory update (1: Compulsory update; 0: Non-compulsory update(will not change the current data of existing timer); set 1 if this field is empty).

REMOVE_TIMER Remove Event Timer

Function: remove an event timer.

Format: REMOVE_TIMER*timer ID.

CHANGE_TIMER_TIME Change Event Timer

Function: increase/decrease the time of a timer.

Format: CHANGE_TIMER_TIME*timer ID#time (count by day; can be a negative or decimal number.

ADD_TIMER_WATCHER Add Monitor Field of Custom Event Timer

Function: add a monitor filed of a custom event timer (same as custom variable monitor UI).

Format: ADD_TIMER_WATCHER*timer monitor info (format: timer ID1,displayed time format1,scale parameter1([optional;set 1 by default]

coefficient of the scaling of time parameter), visibility in battles ([optional; set 0 by default]; 0: No; 1: Yes)|...|timer ID N, displayed time format N, scale parameter N.

REMOVE_TIMER_WATCHER Remove Monitor Field of Custom Event Timer

Function: remove the monitor field of a custom event timer.

Format: REMOVE_TIMER_WATCHER*field KEY.

CLEAR_ALL_TIMER_WATCHERS Clear All Monitor Fields of Custom Event Timer

Function: clear all monitor fields of custom event timer.

Format: CLEAR_ALL_TIMER_WATCHERS*.

PLAYER_RECRUIT_CARD_IN_PLACE Open City Recruitment Panel

Function: open the player’s recruitment panel in a city.

Format: PLAYER_RECRUIT_CARD_IN_PLACE*city ID#ID of the event executed after recruitment (optional)#ID of the event executed after player cancels the recruitment (optional).

STORY_CARD_START

STORY_CARD_LINE

STORY_CARD_END

Open Story Card (2D Image) Panel

Function: open the story card panel. There must be a STORY_CARD_START and a STORY_CARD_END to avoid errors. STORY_CARD_LINE stands for the story paragraphs that need to be put between the start and the end (no number limit).

Format:

STORY_CARD_START*file name of the card.

STORY_CARD_LINE*story paragraph 1.

STORY_CARD_LINE*story paragraph 2.

STORY_CARD_LINE*story paragraph 3.

...

STORY_CARD_END*.

AUTOSAVE AutoSave

Function: execute autosave immediately.

Format: AUTOSAVE*1.

OPEN_SAVE_DLG Open Game Saving Dialog

Function: open the game-saving dialogue.

Format: OPEN_SAVE_DLG*1.

OPEN_SAVE_DLG Open Game Loading Dialog

Function: open the game loading dialogue.

Format: OPEN_LOAD_DLG*1.

EXCHANGE_CARD Open Card Exchange Panel

Function: open the card exchange panel.

Format: EXCHANGE_CARD*object type (0: Location; 1: Squad)#object ID([optional; set to be the current location by default]; when the object is a location, the ID is the location ID, squad ID for squad object).

LEVEL_FINISH Complete Level

Function: used in scenarios to indicate the accomplishment of a level.

Format: LEVEL_FINISH*.

SET_CAMERA_FILTER Set Camera Filter

Function: set a filter for the camera.

Format: SET_CAMERA_FILTER*filter parameter (no filter is used if the field is empty; for parameter details, please see Section 6.10).

Test code: SET_CAMERA_FILTER*black-and-white,0|classic,100|vignetting,100.

TLACTION Timeline Action

Function: specific units on the world map do TIMELINE actions.

Format: TLACTION*map character ID#file name of Timeline action#lasting time of action.

SELECTION_VIEW Fullscreen Special Story Selection

Function: open a fullscreen selection panel of a special story.

Format: SELECTION_VIEW*file name of the scenario image#story content (can use “\n” to break a line)# selection option (please refer to SELECT*).

DIALOG_BUBBLE Map Unit Chat Bubble

Function: a chat bubble pops up above a unit on the world map. Format: DIALOG_BUBBLE*map character ID#dialogue content#time of displaying.

TEXT_EXPLORE_START

TEXT_EXPLORE_OVER

TEXT_EXPLORE_FORCE_OVER_AND_CD

Text Adventure Relevant

Function: a specific text adventure mode.

Format:

TEXT_EXPLORE_START*map ID for text exploration. Start a text adventure.

TEXT_EXPLORE_OVER*. Ends the current instance.

TEXT_EXPLORE_FORCE_OVER_AND_CD*. Ends the current instance by force and the instance starts cooling down.

SHOW_CG Show CG Image

Function: create an interface for showing CG images (please note: after enabling this function, you need to use HIDE_CG* manually to hide the CG. Otherwise the CG will get to player).

Format: SHOW_CG*image name (no suffix; if this field is empty, the background will become black. The relevant directory is: Assets\BuildSource\Backgrounds\. Only .png file accepted).

HIDE_CG Hide CG Image

Function: hide the CG interface.

Format: HIDE_CG*.

GENERATE_RANDOM_CARD Select a Card Randomly

Function: select a card randomly, which will be stored in the tag card of the current variable.

Format: GENERATE_RANDOM_CARD#1.

VOICE_OVER Voice Over

Function: show a voice-over interface.

Format: VOICE_OVER*voice over the content.

CREATE_STORYARMY Create a Story Squad

Function: create a squad only for stories.

Format: CREATE_STORYARMY*tagkey#map position#faction#character list (all selected characters will leave their current squads or locations compulsorily)#card unit list (card ID1,number1,level1|card ID2,number 2,level 2|.......)#movement info (e.g., WANDER,2500).

REMOVE_STORYARMY Remove Story Squad

Function: remove a story squad.

Format: REMOVE_STORYARMY*tagkey.

BAZZAR_BUY_ITEM Bazaar Merchant Buy-in

Function: bazaar merchants buy items.

Format: BAZZAR_BUY_ITEM*bazaar ID#merchant ID#”交换用物品”(ID) of the bazaar (optional)# “交换用物品”(ID) of the merchant (optional).

BAZZAR_SELL_ITEM Bazaar Merchant Sell-out

Function: bazaar merchants sell items.

Format: BAZZAR_SELL_ITEM*bazaar ID#merchant ID.

SHOWROLE Show Character Painting

Function: show character paintings in dialogues.

Format: SHOWROLE*character 1 ID@position of character 1 painting (#character 2 ID@position of character 2 painting) (optional)

*position of character painting: can be both L or R; set to be L by default—L stands for the left side of the text box, R for the right side.

*painting position

HIDEROLE Hide Character Painting

Function: hide character paintings in dialogues.

Format: HIDEROLE*position of character 1 painting (#position of character 2 painting) (optional).

*position of character painting: can be both L or R; L stands hiding the painting on the left side, R for hiding the painting on the right side.
SELECT_QUEST_ASK Mission Query

Function: add a mission query that meets conditions based on the standard SELECT directive.

Format: SELECT_QUEST_ASK*.

SELECT_TEAMROLE Select Squad Character

Function: select a character from a squad.

Format: SELECT_TEAMROLE*.

ROLE_PLAYER_ACTIVE Activate Character Indo Status

Function: make a character visible on the “Report” interface and import the character ID (this is usually used in scenarios. E.g., the tavern ladies).

Format: ROLE_PLAYER_ACTIVE*character ID.

ROLE_ORDER Built-in Character Directive

Function: give some built-in directives to a character and execute these directives immediately.

Format: ROLE_ORDER*character ID [refer to the current target character when this field is empty]#directive code: refer to Directive Parameter Table.

The current directive code supports:

  • RETURN_JOBCITY: the character goes back to the location they belong to. No parameter. If the character is the squad leader, the squad directive is changed directly; if the character is not a squad leader, they leave the current squad and go back to the original squad; if they are in another location, they create a squad and return.
  • GOTO_PLACE: the character goes to the target location. The parameter is the target location ID.
  • JOIN_PLAYER_TEAM: the character joins the player’s squad directly. No parameter.
  • FOLLOW_ME: the character comes to rally and follows the player’s squad. No parameter.
  • EXPEL_FROM_CAMP: expel the character from their faction. No parameter.
ADD_INTERACTIVE_MSG Add Interactive Message

Function: add a custom interactive message and show it in the corresponding UI.

Format: ADD_INTERACTIVE_MSG*info type#title#info text #parameter text#duration(<=0: Permanent; >0: number of days)#message sender info #TAG parameter.

Currently supported message types are:

msg (message); request; finance.

When the message type is not financed, the format of the parameter text is:

Parameter Key1: parameter value 1;parameter Key2:parameter value 2;...;parameter Key N:parameter N

Currently, the built-in KEY types of system are:

  • ask: assign this message to be a request with at most 2 directive options according to the parameter. Format: ask: option 1 text=event ID of option 1 [: option 2 text=event ID of option 2].

E.g., ask: “Yes”=Event1: “No”=Event2.

  • items: assign this message to be a message of obtaining the item table. The parameter is the corresponding item list info. E.g., items: money,10000|紫金之刃,1,mf=0-3|黄金之枪,1,mf=0-3|幻刃月光,1,mf=0-3.
  • You can define other fields, and use [$tagmsg:arg=parameter KEY$] (in the triggered directive of interactive messages) to query the value of the corresponding parameter field.


When the message type is finance, the format of the parameter text is:

Receipt field 1=receipt detail list (format: resource 1, number 1| resource 2, number 2|…|resource N, number N); receipt field 1= receipt detail list; […]; receipt field N=receipt detail list.

Message sender format: sender type: sender ID.

Currently, supported sender types are:

  • 0: system; empty ID.
  • 1: character; ID= character ID.
  • 2: location; ID= location ID.


TAG parameter is a random string field TAG used to mark.

REMOVE_INTERACTIVE_MSG Remove Interactive Message

Function: remove an interactive message that meets specific conditions.

Format: REMOVE_INTERACTIVE_MSG*message type#sender info#TAG parameter.


Message type and TAG parameter can be empty (no type or TAG limit).

Format of sender info: ADD_INTERACTIVE_MSG.

REMOVE_THIS_INTERACTIVE_MSG Remove Current Interactive Message

Function: remove the current interactive message of the existing environment variable.

Format: REMOVE_THIS_INTERACTIVE_MSG*1.

The following directives are suitable for 0.7.1.3 or above version.
FORCE_CHANGE_HEADAVATA Change Player Painting Compulsorily

Function: change the painting of the player.

Format: FORCE_CHANGE_HEADAVATA*character painting ID.

FORCE_CHANGE_MODEL Change Player Model Compulsorily

Function: change the model of the player.

Format: FORCE_CHANGE_MODEL*model ID.

The following directives are suitable for 0.7.2.1 or above version.
SHOW_INTVAR_CONFIG Show Option Panel of Configurable Custom Int Field

Function: open a custom field configuration panel in the game.

Format: SHOW_INTVAR_CONFIG*mode(0: Create game mode; 1: In-game mode).

SET_MAP_MARKER Add or Set Custom Mark on Map

Function: add or set a custom mark on the world map. When the mark ID already exists, the older mark info will be covered.

Format: SET_MAP_MARKER*mark ID#title#annotation info #map position info#file name of mark image (this field can be empty; set to be "map_flag" by default; this mark image is a PNG image resource under directory“\BuildSource\map_res\MinimapMakers\”).

REMOVE_MAP_MARKER Remove a Custom Map Mark

Function: remove a custom mark on the map with a specific ID.

Format: REMOVE_MAP_MARKER*mark ID

The following directives are suitable for 0.7.3.1 or above version.
RUN_SCRIPT_FUNC Execute Function of Specific Lua Script

Function: execute the standard function of a specific Lua script.

Format: RUN_SCRIPT_FUNC*file name of the relative directory of script (same as RUN_SCRIPT)#standard function name (the function name in the script; the parameter is the imported environment variable).

OPEN_GUI Open Custom GUI Form

Function: open a custom GUI form.

Format: OPEN_GUI*GUI pack name#form component name#script file path of the form (relative script root directory “Asset\BuildSource\LuaScripts\”. No file expansions)#form parameter(format: json format. E.g., {"arg1":"val1","arg2":"val2"})#block directive queue (default 0: Yes; 1: No).

OPEN_CONTAINER_GUI Open Container GUI

Function: open a defined container GUI.

Format: OPEN_CONTAINER_GUI*container ID (instance ID used to identify)#template info ID (info ID defined in Container Definition Table).

When the parameter list is empty or is “This”, the specific container in the current environment variable (if existed) will be opened. E.g., OPEN_CONTAINER_GUI*THIS.

CONTAINER_CMD Container Directive

Function: execute a specific directive for a particular container in the current environment variable.

Format: CONTAINER_CMD*container directive type#parameter 1#parameter 2#...#parameter N

Currently supported collective built-in directive types are:

add_exp: add EXP to all cards in the container. The parameter is the EXP value.

add_items: add a specific element into the container (E.g., the format of the item container is: CONTAINER_CMD*add_items#item 1,10|item 2,5 ;format of the card container is: ID list of cards, separated by “|”).

PLACE_CONTAINER_CMD Location Container Directive

Function: see a location as a container object and execute the same container directives.

Format: PLACE_CONTAINER_CMD*location ID (when this field is empty or “THIS”, refer to the location assigned by the current environment parameter)#container directive list (same as CONTAINER_CMD parameters).

SET_MAP Set Map Status

Function: set the visibility of a specific map.

Format: SET_MAP*map ID#status value (0: Normal; 1: Disabled).

RESET_LUAENV Reset Current LUA Environment

Function: reset the current environment of LUA script and clear cache; this directive can be used when you need to debug the LUA script but do not want to restart the game.

Format: RESET_LUAENV*1.

The following directives are suitable for 0.7.4.1 or above version
SET_ARG_INT Set Parameter Value in Current Environment Variable

Function: set the int parameter value stored in the environment variable of the current script (correspond to [%arg_int_val1%] [%arg_int_val2%] [%arg_int_val3%]).

Format: SET_ARG_INT*new value#target parameter index (optional;set to be 0 by default; 0~2 correspond to [%arg_int_val1%] ~ [%arg_int_val3%] respectively).

Global Save Directive

Global save is a type of saving used to record some data shared by all saves. Data recorded in the global save can be accessed in all saves after being changed.

Directive Instruction
SET_GLOBAL_INTVAR Set Custom Int Variable of Global Save

Function: set a custom int variable in the global save. The variable, recorded in the global save, can be accessed via the [%global_int:ID%] directive.

Format: SET_GLOBAL_INTVAR*variable ID#current int value.

CHANGE_GLOBAL_INTVAR Change Custom Int Variable of Global Save

Function: change a custom int variable in the global.

Format: CHANGE_GLOBAL_INTVAR*variable ID#value change (can be a negative number)#minimum value (optional; no limit if this field is empty)#maximum value (optional; no limit if this field is empty).

SET_GLOBAL_STRVAR Set Custom String Variable of Global Save

Function: set a custom string variable. The variable, recorded in the global save, can be accessed via the [$global_str:ID$] directive.

Format: SET_GLOBAL_STRVAR*variable ID#string value.

PUSH_GLOBAL_ROLES Globally Save Character Status

Function: save specific character list to the global character status list.

Format: PUSH_GLOBAL_ROLES*custom global save Key#character ID (this character can only be a non-template character).

PULL_GLOBAL_ROLES Load Character Status from Global Save

Function: load the status of specific character list from the global character status list, and apply it to the current game mode.

Format: PULL_GLOBAL_ROLES*custom global save KEY (the character of this KEY must be a character from the character template of the current game mode.

LOCK_CMD_QUEUE Lock Current Directive Queue

Function: lock the current directive queue. The directive queue will not be cleared after switching from different game saves or resetting the game modes.

Format: LOCK_CMD_QUEUE*lock queue (0: No;1: Yes).

SWITCH_GAME_MODE Switch Game Modes

Function: switch to the target game mode and load it.

Format: SWITCH_GAME_MODE*target game mode ID.

Built-in Directive List

Built-in directives are directives used to realize certain functions inside the program, usually for some specific scripts.

Directive Instruction
ENCOUNTER Creep Encountering UI

Function: open the info panel of the creep encountered.

Format: ENCOUNTER*1.

CHEST_INFO_DLG Chest Guardian Info Dialog

Function: open the info dialogue of the chest guardian.

Format: CHEST_INFO_DLG*chest ID.

CHEST_COST_DLG Price of Chest Opening Dialog

Function: open a dialogue to show the price of opening a chest.

Format: CHEST_COST_DLG*chest ID.

CHEST_CALLBACK Logic Callback of Chest Opening

Function: command a logic callback of chest opening.

Format: CHEST_CALLBACK*callback value (1: Defeat the guardian; 2: Opening completed)#target chest ID.

Preset Fields of Scripts and Their Meanings

Sometimes we use certain directives to refer to specific objects in script editing. For example, we can use CUR_ROLE to replace the ID of the current character player encountered. We can realize some common application scenarios via script editing.

Currently, supported preset fields are:

  • CUR_ROLE: ID of current character template encounter, used primarily for dialogue and selection list box
  • CUR_BATTLE: ID of the battle between player and refreshed unit encountered on the current map


Format of Script Directive of Results in Scenario Event

The format of script directives of results in a scenario event is (separated by a line break):

conditional expression group 1: executed command 1
conditional expression group 2: executed command 2
...
conditional expression group N: executed command N

Execute the command: judge conditional expression group 1 first, if the conditions are met, execute command 1. Otherwise, judge conditional expression group 2……judge all listed groups until one group of conditions is met, or all conditions are not met.


Format of Conditional Expression Group

A conditional expression group consists of multiple conditional expression like “[%CONDITION%][=]1”, and the expressions are connected by “|” (Or) or “&” (And). The priority of “&” (And) is higher than “|” (Or). When both sides of the expression are integer characters, return the comparison result of the two values. Otherwise, compare the strings, and only [=] and [<>] judgements are supported.

For example:

[%result_code%][=]1|[%player_money%][>=]100 means “execute when the result is 1 or when the player has 100 utars”.
[%player:level%][>=]3&[%player_money%][>]100 means “execute when player’s level is 3 or above, and they have more than 100 utars”.

The followings are the comparison symbols in conditional expressions:

  • [=]: equal
  • [>]: larger than
  • [>=]: greater than or equal to
  • [<]: less than
  • [<=]: less than or equal to
  • [<>]: not equal to


Game Data Calculation Expression System

We can embed some value expressions like “[&expression&]” in many places in the game (e.g., the status value of the BUFF list)

In value expression, the basic mathematic calculation is supported. Currently, supported calculation symbols are:

  • +: addition
  • -: subtraction
  • *: multiplication
  • /: division
  • %: modulo (take the remainder)
  • ^: exponentiation
  • ( ) : change the priority of calculation


When the expression takes the @func(expression1, expression2...) format, call the relevant built-in function to return the calculation result. Currently supported built-in functions are (note: these built-in functions are can only be used in the calculation of the most external layer):

  • @min(a,b): return the smaller value between a and b
  • @max(a,b): return the greater value between a and b

E.g., in a specific piece of data, [&1+2*3&] will be replaced by 7, [&@max(1+2*3, 8)&] will be replaced by 8, [&@min(1+2*3, 8)&] will be replaced by 7……

Please note: for scripts and skill directives in battles, you can use the “[@expression@]” format to embed some expressions to return a decimal result.


Embedded Query Directive in Scenario Event

There are many places in the game that support embedded query directives, through which we can insert values or query result of the string type in texts or conditional expressions. All embedded query directives follow the format of [%QUERY:arg1:arg2...%] or [$QUERY:arg1:arg2...$] (these two formats are the same) to insert to the target position.

Note: currently you cannot re-embed a query directive in a query.

Currently, supported query directives are:

Query Directive Instruction
[%result_code%] Return the last directive result that can cause “return” in the current event (E.g., an option that stands for “return” of the selection list box, input value and battle result, in the script of scenario events).

Following are the different meanings of result_code in various directive types.

  • It means the option ID when returning from the selection list box.
  • When returning after battles:  0: Battle won; 1: Battle failed.
  • It means the input number when returning for an integer input box.
[%rnd_num%] Return an integer. (0~100).
[%rnd_range:A:B%] Return a random number that is greater than A but smaller than B.
[%last_rnd%] Return the random number that was generated last time.
[%player_money%] The amount of the player’s money.
[%player_wood%] The amount of the player’s wood.
[%player_iron%] The amount of player’s ironstone.
[%player_jade%] The amount of player’s jade.
[%player_food%] Player’s current Hunger.
[%game_time%] Number of in-game days currently.
[%is_gametime_night%] Judge whether it is nighttime now (in-game). If yes, return 1; if no, return 0.
[%is_gametime_daytime%] Judge whether it is daytime now (in-game). If yes, return 1; if no, return 0.
[%mod_day:MOD%] Number of the in-game day divided by MOD, take the remainder
[%generate_rob_money%] Generate the amount of money when the player is robbed under the current level.
[%rob_money%] Generate the amount of money when the player was robbed last time.
[%get_ts:ID%] Return the current status of a trigger (0: Normal; 1: Disabled).
[%get_es:ID%] Return the current status of a scenario event (-1: Not executed; otherwise, return Result Code).
[%get_es_first_time:ID%] Return the first completion time of a scenario event.
[%get_es_time_score:ID:minTime:maxTime:maxScore%] Return the first completion time score of a scenario event. minTime is the shortest completion time (time before the shortest time brings a full score); maxTime is the longest completion time (time before the longest time brings a zero score); maxScore is the highest score.
[%int_val:ID%] Return the custom int value whose numbering is its ID.
[%int_val_for_calc:ID%] Return the custom int value, whose numbering is its ID, to calculate. There must a result. If the ID does not exist, the result is 0.
[%str_val:ID%] Return the custom string value whose numbering is its ID.
[%team_num%] The current number of the current squad.
[%team_max%] Maximum number of the current squad.
[%unit_name:兵种key%] Return the name of a certain minion.
[%item_number:物品key%] Return the number of a certain item in the player’s bag.
[%item_with_tag:tag%] Return the number of an item with a specific tag in the player’s bag.
[%item_with_tag_and_level:tag:level%] Return the number of an item, whose item level >= level, with a specific tag in the player’s bag.
[%item_qualify_as_present:present_desc%] Return the number of a certain item whose gift description string meets requirements in the player’s bag. For the format of gift description string, please see the “Like” format in the Tag column of “人物列表”(Character Table) (Excel).
[%item_name:物品ID%] Return the displayed name of an item.
[%admin_level%] Return the administration status of the player in the current location (0: None; 1: Appointed; 2: City ruler; 3: Faction leader).
[%gametime_elapse:ID%] Return the amount of period since the setting of last custom time point ID (integer number of the day; take a rounding integer number after (current time-ID time)).
[%gametime_elapse_by_day:ID%] Return the amount of period since the setting of last custom time point ID (integer number of the day; (current day- the day when the ID is located); this directive is usually used for the event that can only happen once a day.
[%tag_gametime_elapse%] Return the gametime_elapse of the preset dynamic tag; if there is no such a tag or such an ID, return -1; to gain this result: (current time-ID time) and take the rounding integer number.
[%tag_gametime_elapse_by_day%] Return the gametime_elapse of the preset dynamic tag; if there is no such a tag or such an ID, return -1; to gain this result: (current day-the day when the ID is located); this directive is usually used for the event that can only happen once a day.
[%is_custom_cd:ID%] Return the result of whether a custom cooldown (whose numbering is its ID) is ready (1: Yes; 0: No).
[%has_gametime_elapse_tag:ID%] Query whether the custom game time ID mentioned above exists (1: Yes; 0: No).
[%realtime_elapse:ID%] Return the realistic period since the setting of last custom time point ID (count by second).
[%qs:ID%] Return the status of specific mission ID (0: Unclaimed; 1: Ongoing; 2: Unfinished; 3: Ended).
[%qs:ID:index%] Return the subevent value of specific mission ID (index is the subevent’s sequence number starting from 0).
[%get_flag:ID%] Return the current value of a completion mark; return -1 if there is no such a value.
[%camp_rep:ID%] Return player’s Prestige value of the target faction ID.
[%is_player_triggered_encounter%] Check if an encounter chat is started by player manually (0: No; 1: Yes) (if the player is caught up by other units, the value is 0).
[%place_rep:ID%] Return player’s Prestige value of the target location.
[%arg_int_val1%]

[%arg_int_val2%]

[%arg_int_val3%]

Value parameter 1, 2, and 3 of the current event.
[%g_buffs%] Return the number of global BUFFs of the current squad.
[%last_battle_res%] Return the battle result of last battle (0: Victory; 1: Loss; 2: Retreatment).
[%last_dungeon_res%] Last dungeon result (0: Exited; 1: Passed; 2: Loss).
[%g_buff:ID%] Query whether the current squad has a global BUFF of the target ID. Return 1 if such a BUFF exists.
[%g_buff_c:CLASS%] Query the number of global BUFFs whose type are CLASS of the current squad.
[%g_stat:STAT_FILED%] Return the current value (whose field is STAT_FILED) of the current squad status.
[%has_KeyValues:ID%] Query KV stored directly. If there is a corresponding KV, return 1; otherwise, return 0.
[%get_KeyValues:ID%] Query KV stored directly. If there is a corresponding KV, return the relevant value; otherwise, return null.
[%rnd_place_id:CAMP_ID%]: Return the ID of a random location that is controlled by a faction. IF there is no camp_id, return an ID of a location controlled by the player’s faction.
[%last_rnd_place_id%] Return the ID of the last randomly generated location.
[%last_rnd_place_name%] Return the name of the last randomly generated location.
[%last_rnd_place_map_name%] Return the map name of the last randomly generated location.
[%last_rnd_place_products%] Return the Production list of the current location (follow the format of GETITEMS).
[%last_rnd_place_products_name%] Return the Production description of the current location.
[%last_rnd_place_has_products%] Check if the current location has production (1: Yes; 0: No).
[%last_seled_items%] Return the item list of the last item selection directive (ITEMS_SELECTOR).
[%last_seled_roles%] Return the character list of the last character selection directive (ROLES_SELECTOR) (Note: this method cannot be used in conditional expression groups since the result returned contains “|” when multiple characters are selected; you can use [%last_seled_roles_count%] instead to judge).
[%last_seled_roles_count%] Return the number of selected characters of the last character selection directive (ROLES_SELECTOR).
[%weather:ID%] Query the current value of the specific weather effect (with specific ID) on the current map.
[%monster_news:X:Y%] Query the info of creeps near coordinate (X, Y) on the current map. X and Y will be the default position of the player if left empty.
[%attack_intend_code%] Query the attack intension of units encountered on the current map.

Please see: MuUnitBase.IntendToAttack

[%place_randmom_pos%] Query a random position near a location. Output specific strings. E.g., Sandbox Redstone Keep: 123, 123.
[%tag_role_with_role_relation%] Relationship between the input parameter and tag character/location.
[%tag_role_with_city_relation%] Relationship between Tag character and input character
[%result_val%] Query the curResultVal value of the current environment variable.
[$player:INFO$]

[$tagrole:INFO:ID$]

Query a specific info field of player/ specific character (tag character) When it is tag character, and ID field does not exist, return the query result of the interactive object.

INFO can be:

  • id: character ID.
  • name: character name.
  • level: character level.
  • job_type: job types (0: Citizen; 1: Faction member; 2: city ruler; 3: Faction leader).
  • campid: faction ID.
  • campname: faction name.
  • campleaderid: faction leader ID.
  • campleadername: faction leader name.
  • campleader: nickname of faction leader.
  • fame_val: personal prestige.
  • maxhp: max hp.
  • maxmp: max mana.
  • job_cityid: job assignment location ID.
  • job_cityname: job assignment location name.
  • state: current status (0: Normal; 1: Captured; -1: Dead).
  • is_recruitable: recruitable (0: No; 1: Yes).
  • is_leave_team_enable: able to leave squad (0: No; 1: Yes).
  • recruit_val: current recruitable mark (0: No; 1: Yes).
  • inteam: if the character is in the player’s squad (0: No; 1: Yes).
  • camp_rl: the relationship between target faction and player’s faction (0: Neutral; 1: At war; 2: Alliance; 3: Ally).
  • player_camp_rep: player’s prestige in the target faction.
  • player_camp_rep_desc: player’s prestige description in the target faction.
  • fv: friendliness with the player.
  • player_relation_score: assessment on overall favour on the player.
  • weapon_tag= (custom tag field): query the specific tag on equipment and weapons. If there is no such a tag or the weapon does not exist, return [$null$].
  • skill_level= (skill ID): query the current level of the target skill of a character.
  • skill_maxlevel= (skill ID): query the maximum level of the target skill of a character.
  • skill_exp= (skill ID): query the current EXP of the target skill of a character.
  • skill_upexp= (skill ID): query the amount of EXP needed for a character’s target skill to level up.
  • statu= (custom ID): query the value of the corresponding ID in the Character Attribute Table. If there is no value, return [$null$].
  • statu_int= (custom ID): 0 query the int value of the corresponding ID in the Character Attribute Table. If there is no value, return 0.
  • has_girl_friend: [player only] check if the player has a girlfriend (1: Yes; 2: No).
  • current_girl_friend_name: [player only] girlfriend’s name.
  • girl_friend=character ID: [player only] check if someone is a player’s girlfriend.
  • is_female: check if someone is a female character (1: Yes; 0: No).
  • available_quest: available missions.
[$called:call1:call2$] How NPC addresses player (the player’s character is male: call1; female: call2).
[$null$] Replaced by an empty string.
[$trig_tagtype$] Trigger object type of the current event.
[$trig_tagid$] Trigger object ID of the current event.
[$input_str$] The input result of the last input box.
[$argvs:INDEX$] Query currently additional parameter info, starting from 0 (used to fill in the parameter of a random event).
[$tagplace:INFO:ID$] Query info of a location; query the current location if the ID field does not exist.

INFO can be:

· id: location ID.

· name: location name.

· campid: faction ID.

· mapid: map ID.

· campname: faction name.

· prosperity: location prosperity.

· defence: location defence

· rep: location friendliness.

· security: location security.

· size: location size.

· lord_id: city ruler ID.

· lord_name: city ruler name.

· tag= (KEY of custom expansion field): return the value of a specific custom field.

· is_stronghold: if this location is a base (a location for troops to the garrison).

· is_weekhold: a resource point that does not allow the garrison.

· is_couldoccupy: if this location can be occupied.

· is_couldraid: if this location can be raided.

· is_inwar: if this location is being attacked.

· is_raided: if this location has been raided (recovering).

· is_subplace: if this place has been occupied.

· stat= (status field ID): obtain a specific status value of the current location.

· building= (specific facility ID): query the number of facilities of a building with specific ID in a location (facilities under construction included).

· building_t= (specific facility type): query the number of facilities of a specific type in a location (facilities under construction included).

· r_building= (specific facility ID): query the number of facilities of a building with a specific ID (facilities under construction not included).

· r_building_t= (specific facility type): query the number of facilities of a specific type in a location (facilities under construction not included).

· custom_int= (custom field ID): obtain the int value of the custom field of the current location.

· camp_rl: the relationship between the target faction and player’s faction (0: Neutral; 1: At war; 2: Alliance; 3: Ally)

· func_map= (specific field KEY): query a field of the corresponding directive event mapping table. E.g., func_map= hire list.

· player_rep: player’s prestige in where they are currently staying.

· hire_states: query the recruitment status of the current location.

· player_dist: the distance between the player’s current position and the target position. If the target is unreachable, return -1.

· project_count: the number of projects under construction.

· project_max: the maximum number of projects under construction currently.

[$tagmap:INFO:ID$] Query tile info on a map:

· id: tile id.

· name: tile name.

· dominant_camp: if there is an overall dominating faction, return the name of the faction; otherwise, return null.

· dominant_camps= (custom field ID): if there are only several factions with specific IDs existing, return 1; otherwise, return 0; format of custom field: faction 1#faction 2#faction 3.

· camp_place_count= faction ID: return the number of bases owned by a specific faction on this tile.

· ExploreInfo= Info ID: query the value of an exploration map info.

[$tagbuilding:INFO$] Query info of the current target building

· id: building ID.

· name: name.

· inner_id: built-in location ID of the target building.

· type: building type.

· level: building level.

· tag= (KEY of custom expansion field): return value of a specific custom filed.

· container_id: scenario ID of the container bound to this building.

· container_info: info ID of the container bound to this building.

[$tagwb:INFO$] Query the info of current skirmish.

INFO can be:

· id: battle ID.

· camp_a: faction ID of squad A.

· camp_b: faction ID of squad B.

· leader_a: leader ID of squad A.

· leader_b: leader ID of squad B.

· camp_a_rl: the relationship between squad A and the player’s faction

· camp_b_rl: the relationship between squad B and the player’s faction.

· teamname_a: faction name and hero names of squad A.

· teamname_b: faction name and hero names of squad B.

· seige_time: current siege preparation time (if it is a siege battle) (count by day).

[$tagteam:INFO(:QUERY_INFO)$]

[$playerteam:INFO$]

Query info of the current encountered team (tagteam)/player’s team (playerteam).

When querying tag team, you can choose a specific query parameter. If this parameter is set, only info of the query target will be returned.

INFO can be:

· id: squad ID.

· is_active: check if the current squad status is normal; return 1 if it is normal.

· campid: faction ID.

· campname: faction name.

· state_num: StateNum value of the current squad.

· from_id: ID of the location where the squad is from.

· from_name: name of the location where the squad is from.

· lifetime: period since the squad is established (day).

· camp_rl: the relationship between the target faction and character faction (0: Neutral; 1: At war; 2: Alliance; 3: Ally).

· max_attr_lv=attribute field ID: the highest value of a certain attribute of all characters in the squad.

· exist_role= character ID: check if there is a specific character ID in the squad (1: Yes; 0: No).

· role_vacancy: available hero slots in squad.

· soldier_vacancy: available minion slot in the squad.

· map_info: current map info.

· tag: return the TAG of the squad.

· is_defeated: check if the squad is dismissed because they are defeated (0: No; 1: Yes).

· defeated_by: ID of the faction which defeated the squad.

QUERY_INFOformat: [query type]=[query target] E.g.,: leader=ROLE_ID.

Currently, supported query types are:

· bind_id: bound info ID. When the squad type is creep or dummy, the ID is the creep/dummy ID; otherwise, it is the leader ID.

· leader: squad leader ID.

· tag: TAG mark of the squad (used for squad created by the CREATE_TEAM directive).

[$tagcamp:INFO:ID$] Query info of the target faction. When the ID does not exist, query info of the current faction. INFO can be:

· id: faction ID.

· campname: faction name.

· leaderid: ruler ID.

· leadercalled: nickname of faction ruler.

· lands_count: number of bases of the current faction.

· camp_rl: the relationship between target faction and player’s faction (0: Neutral; 1: At war; 2: Alliance; 3: Ally).

· camp_rl_value: the actual number of favour between the target faction and player’s faction.

· stat= (status field ID): obtain the specific status value of the current faction.

· buff= (Target BUFF ID): query if a specific BUFF of the current faction exists (1: Yes).

· buff_c= (BUFF type): query the number of BUFFs of specific types of the current faction.

· active_state: project status of target faction (0: Inactive; 1: Active).

· is_story_camp: if this is a scenario faction (0: No; 1: Yes).

· player_rep: player’s prestige in this faction.

· attitude: faction’s attitude towards the player (0: Normal; -1: Wanted; -2: At war).

· is_fall: if a faction is eliminated (0: No; 1: Yes).

[$tagbazzar:INFO$] Query current bazaar info imported by the system.

· start_day: number of days of the beginning of the bazaar.

[$tagbazzarItem:INFO:bazzarID:merchantID$] Query info of items bought/sold by a merchant in a bazaar.

· item_desc: item description (detailed).

· item_desc_short: item description (simple).

· item_buy_price: buy-in price of the item.

· item_sell_price: sell-out price of the item.

[$tagproduct:INFO:ID$] Query info of a speciality. Query info of the current speciality if the ID is left empty.

· item_name: item name.

· item_id: item id.

· item_level: item level.

· item_price: single fair value of the item.

· player_dist: the distance between the central position of the speciality and the current position of the player (-1: the central position is unreachable).

· place_include=location ID: when the item is not sold in the specific location, return 0; if it is being sold, return 1.

· place_include_tagQuestPlace: automatically use the currently imported info of mission location.

[$tagquest:INFO:ID$] Query Mission Info

status: 0: Unclaimed; 1: Ongoing; 2: Completed; 3:Time limit exceeded (receive punishment); 4: Time limit exceeded (wait to claim rewards automatically) 5: 已Ended.

[$arg_str_val1$]

[$arg_str_val2$]

[$arg_str_val3$]

String parameters 1, 2 and 3 of the current event.
[$rnd_enum:PROB_A,RES_A:PROB_B,RES_B:PROB_C,RES_C[:...]$] Enumerate numbers randomly and return a RES value according to the probability distribution. E.g., [%rnd_enum:25,A:40,B:35,C%] means there is a 25% chance to return “A”, 40% to return “B” and 35% to return “C”.
[$tagitem:INFO$] Query info of the current item. INFO can be:

· id: item ID.

· name: item name.

· count: item number.

· group_n: maximum number of stacks.

· quality: item quality.

· level: item level.

· main_type:  main item type.

· sub_type: item sub-type.

· equip_type: equipment type.

· gendays:  period (day) since the production date.

· tag= (KEY of custom expansion field): return the value of a specific custom filed.

[$tagproject:INFO:ID$] Query project info. Read from the specific ID of SET_TEMP_ID if the ID field is left empty.

· id: project id.

· state: project status (works only in group events) (0: Not started; 1: Ongoing; 2: Completed).

· showPlaceName: project location description.

· showProjectName: project name.

· roles: all characters involved in the current project.

[$tagunit:INFO$] Query info of the current target minion.

· id: unit id.

· name: unit name.

· level: unit level.

· statu= (custom ID): query the value of the corresponding ID in the Unit Attribute table.

[$tagcard:INFO$] Query info of a specific card.

· id: bound id of the card.

· name: displayed name of the card.

· lv: card level.

· recruit_name: displayed name with recruitment info of the card.

· tag= (KEY of custom expansion field): return the value of a specific Tag field of the card.

· has_tag= (KEY of custom expansion field): query if there is a particular Tag field of card (1: Yes; 0: No).

[$save_version$] Return the version number of when the current game save is created.
[$version_compare:TAG_VERSION$] Compare the version number of when the current game save is created with TAG_VERSION; if the former version is higher than TAG_VERSION, return 1; when equal, return 0; when lower, return -1.
[$tagmsg:INFO$] Query info of the current interactive messages.

· title: title

· content: message content

· arg=(field KEY): query the parameter of the KEY in the custom parameter table

以下查询需要游戏版本高于0.7.4.1
[$lua_str:KEY$] Return the string value defined in the GetLuaStringVal port in the core logic script (KEY is the query parameter).
[$lua_int:KEY$] Return the int value defined in the GetLuaStringVal port in the core logic script (KEY is the query parameter).
[%envoy_enable%] Return the status of whether the envoy of the player’s faction is available.

Directive Field of Global Save Query

These are used to query some directives in the global save.

Query Directive Explanation
[%global_int:ID%] Return the value of global int field ID             
[$global_str:ID$] Return the value of global string field ID


Built-in Global Variable Field

Following are key fields of a built-in global variable:

Filed KEY Explanation
save_max_hard_level The greatest difficulty has been unlocked. Set to be 0 by default.


Built-in Custom Variable Field

You can use directives like SETINTVAR and CHANGEINTVAR to change and save the built-in custom variable of the system. Different variables have a different function.

KEY Field Explanation
system_探索地图点数 Morale.                                        
system_星星 The number of stars.
system_敌方角色血量百分比 When the player is fighting an enemy the extra hp multiplier of the enemy.
system_敌方角色攻击百分比 When the player is fighting an enemy, the extra physical/magic attack multiplier of the enemy.
config_ai_level The intensity level of AI (0: Easy; 1: Normal; 2: Difficult).
config_roll_limit Enable Roll Limit in battles 0: Disabled; 1: Enabled (By enabling the Roll Limit, there will be a CD and limit of rolling times).
config_hunger_penalty Enable Hunger Debuff 0: Disabled 1: Enabled (By enabling the Hunger Debuff, the movement of the player’s squad will be influenced when in hunger).
config_upgrade_cost_reduce EXP and materials needed to upgrade the current unit after discount (0~100 percentage; set to be 0 by default).
config_soldier_dead_scale A multiplier of death probability of the current minion (percentage; set to be 100 by default, final death probability = basic death probability *(config_soldier_dead_scale/100)).
The following directives are suitable for 0.7.3.1 or above version.
config_project_concurrent Maximum cardinal number of concurrent construction of projects in the current location.


Built-in Field in Initial Setting Table

In the initial setting table, we can configure some initial fields that have actual functions.

KEY Field Explanation Default Value
init_pos Default info of respawning location.
init_statu Default attribute status info when the player respawns.
init_money Default initial property. 0
home_place Default initial location ID.
init_skillpages Initially enabled skill page (format: see SET_SKILLPAGE directive).
init_skills Initial skill page of the player (format: see GETSKILL directive).
init_equip Initial equipment list info of the player.
init_camp_rl Initial faction relationship list. Format:

Faction A, faction B, relationship, friendliness (-100~100)| faction A, faction C, relationship, friendliness(-100~100)|...|faction N, faction N, relationship, friendliness(-100~100).

unchanged_diplomatic_relationship Unable to change the relationships between factions dynamically? (0: Yes; 1: No). 0
gametime_scale When the player is on the world map, the scale coefficient of in-game time (in-game day/second). 0.01
battletime_scale When the player is on the world map, the scale coefficient of in-game time (in-game day/second), when this coefficient is 0, the time in skirmish or siege battles will stop. 0.005
no_card_auto_supply Card durability cannot restore automatically. 0
drop_card_when_no_durability When card durability becomes 0 in this mode, the card will disappear. 0
enable_card_upgrade Enable card upgrading. 0
equipment_loss_durability The equipment has durability. 0
levelup_exp_scale Level up EXP multiplier. 1.0
seige_time Basic preparation time for siege battle (day). Preparation time = basic time + Weapons degree* coefficient of extra time per Weapons degree (the siege_time_per_armvalue feild). 0
siege_time_per_armvalue The coefficient of extra time per weapon degree when preparing for a siege battle. 0
project_time_scale The proportion of project time. <1: shorten time; >1: extend time. 0.99
dailyIncomeScale The multiplier of daily city resource income. 1.0
recruit_cost_scale The multiplier of the cost of recruitment/supply/upgrade/chest opening. 1.0
building_cost_scale The multiplier of the cost of building construction/other projects. 1.0
custom_intval_watcher Default custom variable field of the monitor (same as the ADD_INTVAL_WATCHER directive).
show_star_info Show prestige (star). 0
ai_soldier_add_exp_per_period Cardinal number of daily AI soldier (units from other factions) EXP increase. 0
team_role_count_base The basic number of character slot each squad. 3
team_role_max Maximum number of character slot each squad. 5
team_card_count_base The basic number of minion slot each squad. 6
team_card_max Maximum number of minion slot each squad. 40
ai_recruit_resource_scale Resource multiplier of AI recruitment. 1.0
ai_build_resource_scale Resource multiplier of AI construction. 1.0
ai_upgrade_resource_scale Resource multiplier of AI minion upgrading. 1.0
ai_highlevel_upgrade_average_days AI simulation of upgrading minions when the player’s level is high (expected number of days).

The higher this value is, the slower AI upgrades a type of minion.

20
ai_auto_balance_resource If AI will balance each kind of resources automatically. 0
ai_invade_prob Coefficient of AI invasion probability (0~1) The closer to 1, the more likely AI will invade. 0.8
invasion_destroy_factor Destruction rate after invasion or occupation. Format:

Number of destroyed facility 1: probability 1.

Number of destroyed facility 2: probability 2.


...

Number of destroyed facility N: probability N.

E.g.,

1:50

2:30

3:10

4:5

monster_move_speed_random Correction range of random creep movement speed of creep emitter (0.75 at most). 0
soldier_battle_killed_prob The basic casualty of the soldiers. The probability of soldiers being poorly wounded after losing a battle. 0.2
ai_soldier_battle_killed_prob Death probability of AI troops after losing a battle. 1
ai_recruit_hero_free AI recruits heroes for free 0
army_base_move_speed Basic movement speed of squads. 240
monster_min_movespeed Minimum movement speed of creeps. 150
caravan_move_speed_range Range of movement speed of Caravans. Format: min speed, max speed. 100,100
farmers_move_speed_range Range of movement speed of farmers. Format: min speed, max speed. 100,100
army_base_move_speed_range Range of movement speed of troops. Format: min speed, max speed. 100,100
global_move_speed_range Range of global movement speed. Format: min speed, max speed.

This value influences all movable units on all maps.

20,400
battle_gain_money_scale Scale coefficient of obtaining money in battles. 1
npc_drop_equipment If NPC will drop weapons (0: No; 1: Yes). 0
npc_drop_equipment_prob Probability of NPC dropping weapon. 0.15
loot_food_each_soldier Probability of each group of soldiers dropping food. 0.1
loot_food_each_hero Probability of each hero dropping food. 1
hungry_fail_days Failed after being hungry for a certain number of days. 3
The following directives are suitable for version higher than 0.7.2.1.
ai_dailyfight_period The period between each AI compulsory invasion checks <=0: Disable the check (this logic is different from default AI invasion check;the default parameter (in-game day) is 5 before version 0.7.2.1) In addition, this check will be influenced by AI intensity from this version. 0
ai_active_level_default Default AI intensity level, which influences the default value of the custom filed of config_ai_level.
def_config_roll_limit Whether to enable Roll Limit by default. This influences the default value of the custom field of config_roll_limit.
def_config_hunger_penalty Whether to enable Hunger Debuff. This influences the default value of the custom field of config_hunger_penalty.
def_seige_battlemap Default map ID of siege battle.
The following directives are suitable for version higher than 0.7.3.1.
init_inventory_capicity Default cardinal number of initial bag capacity. 60
def_project_concurrent Default cardinal number of concurrent construction of projects in the current location. 1
The following directives are suitable for version higher than 0.7.4.1.
camp_rep_wanted_val Player’s prestige reaches the threshold of “Wanted” of a faction (when player’s prestige is lower than “Wanted” but has not reached the “At War” status, the player will not be attacked by squads of this faction in the wild, but they will not be allowed to enter certain cities). 0
camp_rep_war_val Player’s prestige reaches the threshold of “At War” of a faction (when player’s prestige is lower than the point, the player will be attacked in the wild by squads of this faction). -10
The following directives are suitable for version higher than 0.8.0.1
dg_levelup_skill Skill ID of level-up special effect in battles. 升级特效
init_items Initial item list.
def_dropitem_model Model and special effect info of items dropped in battles (Format: world map unit model#special effect info). chest1#psChestFlash1,0,0

Besides specific initial fields above, there are some UI-resetting fields, starting with “gui”, in the initial set list, which are used to do a custom reset on certain built-in UI in the game. For more details, please see instruction on game interface reset.

Codes of Text Color in Common UI

In dialogues, text boxes or other common UI, we can follow certain formats to change the colours of texts.

E.g., This is a imp:red font text, red:red font text, &ff6699ff:custom color text font.

Currently, we support preset colours for the following types (to use custom colours, replace “#” with “&” ).

  • place: unified colour for the location name.
  • role: unified colour for the character name.
  • camp: unified colour for faction name.
  • item: unified colour for item name.
  • imp: unified colour for an important message.


Format of Character Position Directive

Format: position code:position parameter.

Supported position codes are: 0: Unallocated; 1: In position; 2: In squad; 3: In a project.

  • when the code is 1: Format:  1: location ID, facility ID (if the facility ID is empty, it means the character is outside the facility).
  • when the code is 2: Format:  2: squad ID.


Format of In-game Global Position Directive

When assigning the position for a squad or object on the world map, we can follow a format of globally position assignment (e.g., the TELEPORT directive).

Format of global position:

Map ID:coordinate X,coordinate Y


Format of Unit-Limitation Directive in Specific Battles

In a specific battle table, you can fill in a directive of the following types in the “Limit” column, to execute unit or special restrictions.

Format:

Directive 1:parameter 1;directive 2:parameter 2;...directive N:parameter N;

Currently supported types of limitation directives are:

  • player: reset squad hero list. Format: character ID1,reset level (-1 or left empty: Do not reset)|. character ID2,reset level| character ID3, reset level|...| character ID N,reset level.
  • units: reset squad minion list. Format: same as the common minion list.
  • add_stat: additional character attribute status. Format: target character ID#status list.


Directive List of Unit Control on the World Map

World map unit (squad) control directives are methods used to manage the action order of world map units. When a unit has specific control directive list, it will execute every directive in sequence until the execution is finished. After the game is saved halfway of the execution of the directives and the player exits the game, the execution will continue when the save is loaded.

Please note: after the execution of all directives of a squad, the squad will be dismissed. Dummies (creeps and dummies needed for stories included) are an exception.

Control directive consists of int-number directives and directive content, separated by “;”. Directive of each line starts with a directive-type code and “+”, followed by a directive parameter.

For example:

1,test map:100,100;1,test map:100,200;99,0

The code above means that the squad will move to coordinate 1 (100,100) first, and then to coordinate 2 (100,200). Finally, the squad will be dismissed.

Currently, supported directive-type codes are:

Control Directive Code Explanation
1 Move towards a coordinate on the world map. The parameter is the target coordinate (coordinate format: map ID: coordinate X, coordinate Y).
2 Stay where you are. The parameter is the time of staying (count by in-game day).
3 Enter a location. The parameter is the target location ID.
4 Attack the target location. The parameter is the target location ID. (invasion type: 0: Occupy; 1: Raid).
5 Stay in the target location. The parameter is the target location ID, time of staying.
7 Execute an event. The parameter is the event ID.
8 Change the current StateNum value. The parameter is the new StateNum value.

Note: StateNum can be used to mark the current status of some controlled squad. E.g., you can command a unit to a specific location on the map and execute an action. Before the unit reaches the destination, StateNum is 0; after its arrival, StateNum becomes 1. By doing so, we get to know the current status of a squad.

9 Execute custom movement directives permanently. (For directive format, see Format of Default Movement Directive of Unit Squad).
10 Join a Warband. The parameter is the Warband ID (built-in method of the system. We do not suggest calling this).
11 Execute an action. Parameter format: action ID, loop times (-1: Endless; >=1: Limited times; set 1 when the action itself is a looping animation), single-action time (count by second; execute the next directive when the action finishes looping, if it does not loop permanently), object(0: All units by default; 1: Leader only; 2: All followers), initial frame range (0~1; 1: the last frame of the animation; -1: a random number between 0 and 1), whether to execute the next directive after playing the animation (0: No by default; 1: Yes).

Supported default action list of models:

· Loop action: standby, move, walk slowly, charge, recharging.

· Single action: being hit, evade, block, attack, shoot, horizontal. slash, vertical slash, release, roar, knock up, jump, celebrate, die.

13 Open a chest. The parameter ID is the chest ID.
14 Execute a TimeLine action. Format: TimeLineID, duration (set -1 by default, permanent; >0: Action ends after the time set).
15 Change the attitude of the current squad towards the player (0: Neutral; 1: Hostile).
16 Change the current movement speed of the current squad. The parameter is the target movement speed.
17 Trade succeeded. The parameter is the location ID of the trade.
18 Trade with a merchant. The parameter is the location ID of the trade.
19 Follow a squad target. The parameter is the control ID of the target being followed.
99 Dismiss the current squad.


Format of Default Movement Directive of Unit Squad

Dummies, creeps and squads on the world map will change their movement modes based on the default way of moving or the changes of scripts. After choosing a movement mode, units will perform default actions according to the directive.

Format of unit movement directive:

Movement mode,parameter 1[,parameter 2,...,parameter N]

Currently supported movement modes and the formats of the parameter are:

  • Wander within range: WANDER, movement radius,[central coordinate X, central coordinate Y](the current position is the centre if the central coordinate is not assigned).
  • Patrol: PATROL, coordinate 1X, coordinate 1Y, coordinate 2X, coordinate 2Y,..., coordinate NX, coordinate NY(when the first coordinate is the same as the final coordinate, the patrol movement loops in a circle; otherwise, the patrolling movement goes back and forth).
  • Others: Stay still.


Format of Item List Info

The item list info is one of the most common info formats. We use this format in the directives of obtaining various items (GETITEMS, etc.) and configuration tables.

Format:

Item code 1,number 1[,detailed info list]|item code 2,number 2[,detailed info list]|....|item code N,number N[,detailed info list].

The format of the detailed info list is the dictionary list of "key1=val1,key2=val2,...". Following fields are supported:

  • [mf] auto-match the created affixes: mf=lowest quality; N-highest quality; N[-additional cardinal number of variable value]. E.g., Longsword,1,mf=0-3  Explanation: the “mf” field helps the current weapon to automatically match a quality (0~3) affix (0 means no affix).
  • [cw] create custom affix: cw= affix ID+ additional cardinal number of variable value (0-100). E.g., Longsword,1,cw=Lifesteal Sword+50 Explanation: the variable value of items with the affix of Lifesteal Sword, is between 50 and 100.
  • [w] assign the affix details of items: w=affix ID$ [variable code array]
  • [qv] assign the variable array of item attribute: qv= variable code array
  • [p] assign the buy-in price of items: p= buy-in price


The variable code array consists of two columns of 2-dimensional arrays. Column 1 is enumerated numbers, and column 2 is quality numbers (0~100). The two columns are connected by “/”. If a affix has 3 parts, then its variable array might be: 0/50/0/100/0/100

Format of Weather Effect Info

When using directives to control weathers, we mainly use directives to control a list weathers, which is separated by “|”.

Format of weather effects description:

Weather effect ID1, intensity|weather effect ID2,intensity|...weather effect IDN,intensity

Currently, supported weather effect IDs are:

  • 雨(Rain): Disabled when the intensity is 0; 1~50: Normal; 50~100: Heavy.
  • 雪(Snow): Disabled when the intensity is 0; 1~50: Normal; 50~100: Heavy.
  • 风沙(Sandy): Disabled when the intensity is 0 (1~100).
  • 雷电(Thunder): Disabled when the intensity is 0 (1~100).
  • 雾(Fog): Disabled when the intensity is 0 (1~100).
  • 黑暗(Darkness): Disabled when the intensity is 0 (1~100).
  • 炎热(Hot): Disabled when the intensity is 0 (1~100) (Heat Distortion Effect).
  • 云(Cloudy): Disabled when the intensity is 0 (1~100) (shadows of cloud in clear days).


Format of weather effect field in map editor or config tables:

Probability 1,duration 1:[weather effect description 1]; Probability 2,duration 2:[weather effect description 2]; Probability 3,duration 3:[weather effect description 3];[...]; Probability N,duration N:[weather effect description N]

E.g., 30,1:;50,3:雨,20|雾,10;20,5:风沙,30

The above code means there is a 30% chance of not having any weather effect for a whole day, 50% chance of raining for 3 consecutive days, and 20% chance of having 5 consecutive sandy days.


Format of Camera Filter Effect Info

We can use directives like SET_CAMERA_FILTER to set the camera filter of the current game.

Format:

Filter effect ID1,intensity|filter effect ID2,intensity|...filter effect IDN,intensity

Currently, supported filter effect IDs are:

  • 暗角 (Vignetting): Disabled when the intensity is 0 (0~100). The degree of darkness of camera’s corners.
  • 黑白 (Black&white): Disabled when the intensity is 0 (0~100). The black-and-white version of the camera.
  • 老旧 (Classic): Disabled when the intensity is 0 (0~100). The yellowing classic style of camera.


TAGs with Special Meanings in Faction List

The following are the character TAGs used in the program.

Field Explanation
LIKE Mark the type of items a specific character likes, which affects the increased speed of favour.

Format: LIKE:type 1|type 2|...

DEF_WEAPON_SPEED Default weapon speed. Characters with this tag will take this speed as the default weapon speed even if they do not have a weapon.
FVChangeUnit Change the coefficient of character’s favour via sending gifts. Set to be the default value without this field.
dg_skill Replace the dungeon skill of this character.
attached_script ID of script event mounted on characters in battles.
loot_list The dropping list of this character in dungeon battles (can use the“EXP” item IDs as a specific source of EXP).
IsNoExpel This character is not allowed to be expelled (enabled when this field is not empty)
IsNoBetray This character will not betray or leave their faction automatically (enabled when this field is not empty)

TAGs with Special Meanings in Location List

The following is a TAG list of locations with actual functions in the program.

Field Explanation
Show minimap City maps are shown by default. If there are other places that need to be shown by default, this tag must be 1.
Do not show minimap It is what the field means.
Disable AI invasion Bases with this tag will not invade, patrol or occupy resources automatically.
SharedPermission The ID of the location that shares the trade permission. When this field exists, the trade permission of the current location is shared with the target location with this specific ID.


TAGs with Special Meanings in Faction Table

The following is a TAG list of factions with actual functions in the program.

Field Explanation
NO_CHANGE_DIP Will not be affected by dynamic diplomatic relations in the game, unless you use script directives to change directly.
UNFAILED This faction cannot be eliminated in a usual way.
EMBARGO Cities occupied by this faction will not send out caravans or trade with other cities.
NO_FARMER There will not be farmer migration in cities occupied by this faction.
CAMP_COLOR Set a specific colour for a faction. Sample format: CAMP_COLOR=FFFFFF
HIDE_BY_ACTIVESTATE Hide relevant info according to the current ActiveState. If the “是否隐藏” field is set to be 1 in the configuration table, then this TAG is invalidated.


TAGs with Special Meanings in Item Table

The following is a TAG list of items with actual functions in the program.

Field Explanation
IgnoreBagSpace This item will not occupy a slot of player’s bag. Function enabled when the field is 1.
NoSellOrDrop This item cannot be discarded or sold. Function enabled when the field is 1.
BatchUse Weather player can use the item in the batch. Function enabled when the field is 1. When an item with this TAG is used, the [%arg_int_val1%] in its script will be the selected number of the item.
DoNotCostWhenUse This item will not be consumed when used. Function enabled when the field is 1.
Present The tag field of gift type, separated by “|”.
AiNotLoot This item cannot be accessed by AI in a normal way. Function enabled when the field is 1.
Mendable If this item is mendable, unmendable item will self-destroy after the durability becomes 0. (1: Yes ).
DropModel The model info of the item when it is on the ground in battles. (format: world map unit model ID#special effect info (replaced by the def_dropitem_model field in the initial set list if the info is left empty)).


Special Ones of Map Exploration Info Fields in Map List

The following is a list of info fields with actual functions in the program:

字段 说明
BattleLoseStay Stay still after losing a battle. Only available in adventure mode (0: No; 1: Yes)
The following fields are suitable for version above or higher than 0.7.2.1
RolePlay When the player is on this map, their character model and name will be replaced by the info of character whose ID is filled into this field. The models of the following minions will be hidden too. The bag and squad panels become inaccessible.
FixedGameTime When this field is not empty, the in-game time will be frozen at a certain point of a day (0~1.0, 0.5 means 12 pm). When the time is frozen, the world will not run on. Only units on the current map can take actions.
CameraFilter When on this map, use this field compulsorily as a camera filter. The effect is the same as the SET_CAMERA_FILTER directives.
NoFoodConsume When this field is 1, the player will not consume food on this map and will not die because of hunger.


Special Fields of TAG in Instance Info List

The following is a list of info fields with actual functions in the program:

Field Explanation
PlayerInitType The initial mode of player’s character (0: Default (use the default character template and initial position in the instance to initialize the character) 1: Manual (initialize the character via the LUA port)).
ExpMode EXP allocation mode. Format: allocation mode[,radius parameter].

The allocation modes are:

  • 0: Killer mode (default; the enemy killer has all EXP).
  • 1: Average Mode (the parameter is the allocation radius; when the parameter <=0, all allies share EXP).
  • 2: Share Mode (if the radius parameter >0, share EXP with allies with the radius).

Format of Item Entry Info

Entries of items follow the format of “entry type:{enumerated info 1, value 1; enumerated info 2, value 2;… }”, and they are set in the item list. Entries can be sorted as:

  • a: increase the character’s attribute passively. Enumerated info is the KEY to the increased attribute.
  • skill: add new available skills to a character. Enumerated info is the skill ID.
  • dg_skill: replace the current dungeon skill of the character. Enumerated info is the dungeon skill ID.


Format of Item Dropping Info

Format:

Probability 1,item ID1,min number,max number [,additional parameter list(see Format of Item List Info)]|probability 2,item ID2,min number, max number [,parameter list]|...|probability N,item N,min number,max number[,parameter list]. 

(E.g., “LOOT*100.0, 金钱,100,200|50.0, 经验,100,200” means that there is a 100% chance of obtaining 100~200 utars and a 50% chance to obtain 100~200 EXP).

In Item ID, you can execute a special ID Query, which is to query and return a result of item dropping from the global dropping list (see the format in Q全局掉落表.xlsx).

The format of the parameter list of QUERY is: “parameter 1=val1, parameter 2=val2,....” Following query parameters are supported:

  • [id] obtain the result of the target ID from the global dropping list (ignore all the other query conditions when this exists and is not empty).
  • [lv] specific conational query level(-1:return all query results; 0: query based on the current level of player).
  • [t1] query TAG 1 (a condition).
  • [t2] query TAG 2.
  • [t3] query TAG 3.


Format of Script Directive in Special Effect Object Event

You can attach the eftEffectEventHelper script to a special effect object to add a new play-effect event. Format of every event: event time point (number of seconds after the start), parameter 1, parameter 2,…, parameter N.

Currently, supported directive types are:

shake_cam: screen shake. Parameter 1 is the duration of screen shake, and parameter 2 is the intensity.

play_sound: play audio. Parameter 1 is the audio ID.