Editing Event Reference

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 5: Line 5:
== Condition Reference ==
== Condition Reference ==


Here is a list of currently implemented conditions. New event conditions can be created by creating a new page under the '''tuxemon/event/conditions''':
Here is a list of currently implemented conditions. New event conditions can be created by creating a new method under the '''core.components.event.condition''' module:


=== battle_is ===
=== true ===
Check to see if a character has fought against another one and won, lost or draw.
The <code>true</code> condition will always evaluate to *True* (unless the "not" operator is used)


'''Parameters'''
==== Parameters ====
* <code>fighter</code>: Npc slug name (e.g. "npc_maple").
<code>None</code>
* <code>outcome</code>: One among "won", "lost" or "draw".
* <code>opponent</code>: Npc slug name (e.g. "npc_maple").


'''Examples'''
==== Examples ====
* <code>is battle_is player,won,npc_maple</code> (has player won against npc_maple in the last fight?)
<code>is true</code> 
<code>not true</code>


=== button_pressed ===
=== player_at ===
Check to see if a particular key has been pressed. E.g. <code>K_RETURN</code>.
Check to see if the player is inside the event's area. This event will check the event object's <code>X</code>, <code>Y</code>, <code>Width</code>, and <code>Height</code> properties and checks to see if the player is within those bounds. That includes event areas that are greater than one tile in size. You can optionally include an <code>x,y</code> parameter to specify a single tile location.


'''Parameters'''
==== Parameters ====
* <code>key</code>: A pygame key constant such as <code>K_RETURN</code>. For a list of all possible keys, refer to the [https://www.pygame.org/docs/ref/key.html Pygame Key Page]
<code>x</code>: X tile coordinates that the player is at (optional) 
<code>y</code>: Y tile coordinate that the player is at (optional)


'''Examples'''
==== Examples ====
* <code>is button_pressed K_RETURN</code>   
<code>is player_at</code>   
* <code>is button_pressed K_ESCAPE</code> 
<code>is player_at 4,3</code>
* <code>not button_pressed K_SPACE</code>  


=== char_at ===
=== player_facing
Check to see if the character is at the condition position on the map.
Check to see if the player is facing: <code>up</code>, <code>down</code>, <code>left</code> or <code>right</code>.


'''Parameters'''
==== Parameters ====
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
<code>direction</code>: Direction to check for: (<code>up</code>, <code>down</code>, <code>left</code>, <code>right</code>)


'''Examples'''
==== Examples ====
* <code>is char_at Maple</code>   
<code>is player_facing up</code>   
<code>not player_facing down</code>


=== char_defeated ===
Check to see the character has at least one tuxemon, and all tuxemon in their party are defeated.


'''Parameters'''
=== player_facing_tile ===
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
Check to see if the player is facing a particular tile. This event will check the event object's <code>X</code>, <code>Y</code> coordinates for the tile to check for.


'''Examples'''
==== Parameters ====
* <code>is char_defeated player</code>
<code>None</code>


=== char_exists ===
==== Examples ====  
Check to see if a character object exists in the current list of NPCs.
<code>is player_facing_tile</code> 


'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").


'''Examples'''
=== player_moved ===
* <code>not char_exists npc_maple</code>
Checks to see if the player has just moved. If the player is standing still, this condition will return <code>False</code>.


=== char_facing ===
==== Parameters ====  
Check to see where a character is facing.
<code>None</code>


'''Parameters'''
==== Examples ====
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").  
<code>is player_moved</code>   
* <code>direction</code>: One of "up", "down", "left" or "right".
<code>not player_moved</code>


'''Examples'''
* <code>is char_facing npc_maple,up</code> 
* <code>not char_facing npc_maple,down</code>


=== char_facing_char ===
=== has_monster ===
Check to see the character is next to and facing a particular character.
Checks to see the player is has a monster in his party.


'''Parameters'''
==== Parameters ====
* <code>character1</code>: Either "player" or npc slug name (e.g. "npc_maple").
<code>monster_slug</code>: The slug of the monster to check for.
* <code>character2</code>: Either "player" or npc slug name (e.g. "npc_maple").


'''Examples'''
==== Examples ====
* <code>is char_facing_char npc_maple,player</code>
<code>is has_monster txmn_pigabyte</code>


=== char_facing_tile ===
Check to see if a character is facing a tile position.


'''Parameters'''
=== inventory_contains ===
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
Not yet implemented


'''Examples'''
==== Parameters ====
* <code>is char_facing_tile npc_maple</code>
<code>item</code>: The item name to check for.


=== char_in ===
==== Examples ====  
Check to see if the character is at the condition position on a specific set of tiles.
<code>is inventory_contains Potion</code>


'''Parameters''' 
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
* <code>value</code>: value (eg surfable) inside the tileset.


'''Examples'''
=== combat_started ===
* <code>is char_in npc_maple,surfable</code>
Check to see if combat has currently started.


=== char_moved ===
==== Parameters ====  
Check to see the character has just moved into this tile. Using this condition will prevent a condition like "char_at" from constantly being true every single frame.
<code>None</code>


'''Parameters'''
==== Examples ====
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
<code>is combat_started</code>


'''Examples'''
* <code>is char_moved player</code>


=== char_sprite ===
=== button_pressed ===
Check the character's sprite
Check to see if a particular key has been pressed. E.g. <code>K_RETURN</code>.


'''Parameters'''
==== Parameters ====
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
<code>key</code>: A pygame key constant such as <code>K_RETURN</code>. For a list of all possible keys, refer to the [Pygame Key Page](https://www.pygame.org/docs/ref/key.html)
* <code>sprite</code>: NPC's sprite (eg maniac, florist, etc.)


'''Examples'''
==== Examples ====
* <code>is char_sprite player,adventurer</code>   
<code>is button_pressed K_RETURN</code>   
<code>is button_pressed K_ESCAPE</code> 
<code>not button_pressed K_SPACE</code>


=== check_char_parameter ===
Check the parameter's value of the character against a given value.


'''Parameters'''
=== dialog_open ===
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
Check to see if a dialog window is currently open.
* <code>parameter</code>: Name of the parameter to check (eg. "name", "steps", etc.).
* <code>value</code>: Given value to check.


'''Examples'''
==== Parameters ====
* <code>is check_char_parameter player,name,alpha</code>
<code>None</code>


=== check_evolution ===
==== Examples ====
Check to see the character has at least one tuxemon evolving. If yes, it'll save the monster and the evolution inside a list. The list will be used by the event action <code>evolution</code>.
<code>is dialog_open</code> 
<code>not dialog_open</code>


'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").


'''Examples'''
=== variable_set ===
* <code>is check_evolution player</code>
Check to see if <code>variable_name</code> has been set to <code>value</code>.


=== check_max_tech ===
==== Parameters ====  
Check to see the player has at least one tuxemon with more than the max number of techniques in its party. If yes, then it saves automatically the monster_id and inside the dictionary event_data.
<code>variable_name:value</code>: A key, value pair of the variable to look up and the expected value.


'''Parameters'''
==== Examples ====
* <code>nr</code>: Number of tech, default the constant
<code>is variable_set battle_won:yes</code> 
<code>not variable_set current_badges:4</code>
<code>is variable_set talked_to_prof:false</code>


'''Examples'''
* <code>is check_max_tech</code>
* <code>is check_max_tech 2</code>


=== check_mission ===
=== npc_exists ===
Check to see the player has failed or completed a mission. Check to see if a mission is still pending.
Check to see if an NPC exists on the current map with <code>npc_name</code>.


'''Parameters'''
==== Parameters ====
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
<code>npc_name</code>: The name of the NPC on the current map.
* <code>method</code>: Mission or missions, "all" means all the existing missions.
* <code>staths</code>: pending, completed or failed   


'''Examples'''
==== Examples ====
* <code>is check_mission player,mission1,completed</code>
<code>not npc_exists Apple</code>
* <code>is check_mission player,mission1,pending</code>
* <code>is check_mission player,mission1:mission2,completed</code>
* <code>is check_mission player,all,completed</code>


=== check_party_parameter ===
Check to see the player has failed or completed a mission. Check to see if a mission is still pending.


'''Parameters'''
=== npc_at ===
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
Check to see if the npc is inside the event's area. This event will check the event object's <code>X</code>, <code>Y</code>, <code>Width</code>, and <code>Height</code> properties and checks to see if the npc is within those bounds. That includes event areas that are greater than one tile in size. You can optionally include an <code>x,y</code> parameter to specify a single tile location.
* <code>attribute</code>: Name of the monster attribute to check (e.g. level).
* <code>value</code>: Value to check (related to the attribute) (e.g. 5 - level).
* <code>operator</code>: Numeric comparison operator. Accepted values are "less_than", "less_or_equal", "greater_than", "greater_or_equal", "equals" and "not_equals".
* <code>times</code>: Value to check with operator (how many times in the party?).  


'''Examples'''
==== Parameters ====
* <code>check_party_parameter player,level,5,equals,1</code> (is there 1 monster in the party at level 5? True/False)
<code>name</code>: The name of the NPC.   
<code>x</code>: X tile coordinates that the player is at (optional) 
<code>y</code>: Y tile coordinate that the player is at (optional)


=== check_world ===
==== Examples ====
Check some world's parameter against a given value.
<code>is npc_at Maple</code> 
<code>is npc_at Maple,4,3</code>


'''Parameters'''
* <code>parameter</code>: Name of the parameter to check (eg. "layer", etc.).
* <code>value</code>: Given value to check.


'''Supported parameters'''
=== npc_facing ===
* '''layer''': color value which is used to overlay the world
Check to see if the npc is facing: <code>up</code>, <code>down</code>, <code>left</code> or <code>right</code>.
* '''bubble''': speech bubble of an npc


'''Examples'''
==== Parameters ====
* <code>is check_world</code>
<code>name</code>: The name of the NPC.   
* <code>is check_world layer,255:255:255:0</code>
<code>direction</code>: Direction to check for: (<code>up</code>, <code>down</code>, <code>left</code>, <code>right</code>)


=== current_state ===
==== Examples ====  
Check to see if one or multiple state/states has/have been started or not.
<code>is npc_facing Maple,up</code> 
<code>not npc_facing Maple,down</code>


'''Parameters'''
* <code>state</code>: Either "CombatState", "DialogState", etc


'''Examples'''
=== npc_facing_tile ===
* <code>is current_state DialogState</code>
Check to see if the npc is facing a particular tile. This event will check the event object's <code>X</code>, <code>Y</code> coordinates for the tile to check for.
* <code>is current_state CombatState:DialogState</code>


=== has_bag ===
==== Parameters ====  
Check to see how many items are in the character's bag. It doesn't count invisible items.
<code>name</code>: The name of the NPC.  


'''Parameters'''
==== Examples ====
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
<code>is npc_facing_tile Maple</code>
* <code>operator</code>: Numeric comparison operator. Accepted values are <code>less_than</code>, <code>less_or_equal</code>, <code>greater_than</code>, <code>greater_or_equal</code>, <code>equals</code> and <code>not_equals</code>.
* <code>value</code>: The value to compare the bag with.


'''Examples'''
* <code>is has_bag player,equals,5</code> (player's bag: 5 potions and 2 tuxeball (5 items), in this case is true because 5 = 5)
* <code>is has_bag player,equals,9</code> (player's bag: 5 potions and 2 tuxeball (5 items), in this case is false because 9 != 5)


=== has_box ===
=== facing_npc ===
Check to see how many monsters are in the character's box.
Check to see if the player is facing an NPC with the name <code>npc_name</code>.


'''Parameters'''
==== Parameters ====
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
<code>npc_name</code>: The name of the NPC on the current map.
* <code>operator</code>: Numeric comparison operator. Accepted values are <code>less_than</code>, <code>less_or_equal</code>, <code>greater_than</code>, <code>greater_or_equal</code>, <code>equals</code> and <code>not_equals</code>.
* <code>value</code>: The value to compare the party with.
* <code>box</code>: The box name.


'''Examples'''
==== Examples ====
* <code>is has_box player,Kennel,less_than,1</code>
<code>is facing_npc Apple</code>


=== has_item ===
Check to see if a NPC inventory contains something.


'''Parameters'''
=== party_size ===
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
Perform a check on the player's party size. The <code>check</code> parameter can be: <code>equals</code>, <code>less_than</code>, or <code>greater_than</code>.
* <code>item</code>: The item slug name (e.g. "item_cherry").
* <code>operator</code>: Numeric comparison operator. Accepted values are <code>less_than</code>, <code>less_or_equal</code>, <code>greater_than</code>, <code>greater_or_equal</code>, <code>equals</code> and <code>not_equals</code>.
* <code>quantity</code>: Quantity to compare with. (optional)
 
'''Examples'''
* <code>is has_item player,potion</code>
* <code>is has_item player,potion,greater_than,2</code>
 
=== has_monster ===
Check to see if a character has a monster in its party.
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
* <code>monster_slug</code>: Monster slug name (e.g. "rockitten").
 
'''Examples'''
* <code>is has_monster player,rockitten</code>
 
=== has_party_breeder ===
Check to see if the character has a male and female monsters not basic (first evolution stage) in the party.
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
 
'''Examples'''
* <code>is has_party_breeder player</code>
 
=== has_tech ===
Check to see if the player has a technique in his party (one of the monsters).
 
'''Parameters'''
* <code>technique</code>: Technique slug name (e.g. "bullet").
 
'''Examples'''
* <code>is has_tech bullet</code>
 
=== location_inside ===
Check to see if the player is inside.
 
'''Examples'''
* <code>is location_inside</code>
 
=== location_name ===
Check to see if the player is in a certain location name.
 
'''Parameters'''
* <code>technique</code>: Slug name. It's the name inside the maps. eg. <code><property name="slug" value="routeb"/></code>, so slug = routeb
 
'''Examples'''
* <code>is location_name routeb</code>
* <code>is location_name routea:routeb</code>
 
=== location_type ===
Check to see if the player is in a certain location type.
 
'''Parameters'''
* <code>slug</code>: Slug name. Either all, notype, town, route, clinic, shop, dungeon
 
'''Examples'''
* <code>is location_type town</code>
* <code>is location_type town:shop:clinic</code>
 
=== money_is ===
Check to see if the player has a certain amount of money (pocket).
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
* <code>operator</code>: Numeric comparison operator. Accepted values are "less_than", "less_or_equal", "greater_than", "greater_or_equal", "equals" and "not_equals".
* <code>amount</code>: Amount of money or value stored in variable.
 
'''Examples'''
* <code>is money_is player,>=,500</code>
* <code>is money_is player,equals,name_variable</code> (name_variable:75)
 
=== monster_flair ===
Check to see if the given monster flair matches the expected value.


'''Parameters'''
==== Parameters ====
* <code>slot</code>: Position of the monster in the player monster list.
<code>check</code>: The check to run against the party size. Can be: <code>equals</code>, <code>less_than</code>, or <code>greater_than</code>.
* <code>property</code>: Category of the flair.
<code>party_size</code>: The size of the party to check against.
* <code>name</code>: Name of the flair.


'''Examples'''
==== Examples ====
* <code>to be defined</code>
<code>is party_size less_than,1</code> 
<code>not party_size equals,0</code> 
<code>is party_size greater_than,4</code>


=== music_playing ===
=== music_playing ===
Check to see if the specified music file is currently playing.
Check to see if the specified music file is currently playing.


'''Parameters'''
==== Parameters ====
* <code>music_file</code>: The music file to check.
<code>music_file</code>: The music file to check.


'''Examples'''
==== Examples ====  
* <code>is music_playing 472452_8-Bit-Ambient.ogg</code> 
<code>is music_playing 472452_8-Bit-Ambient.ogg</code>   
 
=== once ===
Checks the date saved in the variables with today's date.
 
'''Parameters'''
* <code>timeframe</code>: nr of days the event stays "blocked" (eg. 1, 7, etc.)
* <code>variable</code>: Variable where the date is stored.
 
'''Examples'''
* <code>set_variable variable_name:today</code> 
* <code>is once 1,variable_name</code> (it blocks the event for 1 day)
or
* <code>is once 7,variable_name</code> (it blocks the event for 7 days - 1 week)
 
=== one_of ===
Check to see if at least 1 among multiple values in a variable is True. If the variable does not exist it will return ``False``.
 
'''Parameters'''
* <code>variable</code>: The variable to check.
* <code>values</code>: Value to check for (multiple values separated by ":").
 
'''Examples'''
* <code>is one_of stage_of_day,afternoon:dusk:morning</code>
 
=== party_infected ===
Check to see how many monster are infected in the character's party.
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
* <code>value</code>: all, some or none.
 
'''Examples'''
* <code>is party_infected some</code>   
 
=== party_size ===
Check the character's party size. The <code>check</code> parameter can be: <code>equals</code>, <code>less_than</code>, or <code>greater_than</code>.
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
* <code>operator</code>: Numeric comparison operator. Accepted values are <code>less_than</code>, <code>less_or_equal</code>, <code>greater_than</code>, <code>greater_or_equal</code>, <code>equals</code> and <code>not_equals</code>.
* <code>party_size</code>: The size of the party to check against.
 
'''Examples'''
* <code>is party_size less_than,1</code> 
* <code>not party_size equals,0</code> 
* <code>is party_size greater_than,4</code>
 
=== to_use_tile ===
Check if we are attempting interact with a map condition tile.
 
'''Parameters'''
* <code>None</code>
 
'''Examples'''
* <code>is to_use_tile</code>
 
=== true ===
The <code>true</code> condition will always evaluate to *True* (unless the "not" operator is used)
 
'''Parameters'''
* <code>None</code>
 
'''Examples'''
* <code>is true</code> 
* <code>not true</code>
 
=== tuxepedia ===
Check Tuxepedia's progress.
 
'''Parameters'''
* <code>operator</code>: Numeric comparison operator. Accepted values are "less_than", "less_or_equal", "greater_than", "greater_or_equal", "equals" and "not_equals".
* <code>percentage</code>: Number between 0.1 and 1.0
* <code>total</code>: Total, by default the total number of tuxemon.
 
'''Examples'''
* <code>is tuxepedia less_than,0.2</code>
* <code>is tuxepedia less_than,0.2,10</code>
 
=== variable_is ===
Check an operation over a variable.
 
'''Parameters'''
* <code>value1</code>: Either a variable or a number.
* <code>operation</code>: Numeric comparison operator. Accepted values are "less_than", "less_or_equal", "greater_than", "greater_or_equal", "equals" and "not_equals".
* <code>value2</code>: Either a variable or a number.
 
'''Examples'''
* <code>is variable_is [value1],operator,[value2]</code>
 
=== variable_set ===
Check to see if <code>variable_name</code> has been set to <code>value</code>.
 
'''Parameters'''
* <code>variable_name:value</code>: A key, value pair of the variable to look up and the expected value.
 
'''Examples'''
* <code>is variable_set battle_won:yes</code> 
* <code>not variable_set current_badges:4</code> 
* <code>is variable_set talked_to_prof:false</code>


== Action Reference ==
== Action Reference ==


Here is a list of currently supported actions. New event actions can be created by creating a new page under the '''tuxemon/event/actions''':
Here is a list of currently supported actions. New event actions can be created by creating a new function under the '''core.components.event.Action''' class:


=== add_collision ===  
=== teleport ===
Adds a collision defined by a specific label. With numbers, it blocks a specific tile.
Teleports the player to a given position on a map. This teleport is immediate and does not have any transition animation.


'''Parameters'''
==== Parameters ====
* <code>label</code>: Name of the obstacle.
<code>map_name</code>: The map file to teleport the player to.
* <code>coord</code>: Coordinates map (single coordinate). (optional)
<code>x</code>: The X-tile coordinate to teleport the player to. 
<code>y</code>: The Y-tile coordinate to teleport the player to.


'''Examples'''
==== Examples ====
* <code>add_collision obstacle,6,8</code>
<code>teleport map1.tmx,3,4</code>
* <code>add_collision wall</code> (in this case must exist a collision zone in the .tmx file)
<code>teleport room1.tmx,8,1</code>


=== add_contacts ===
Add contact to the app (Nu Phone). The slug must have the msgid inside the PO.


'''Parameters'''
=== transition_teleport ===
* <code>slug</code>: slug name (e.g. "npc_maple").
Teleports the player to a given position on a map with a screen transition over <code>x</code> seconds.
* <code>phone_number</code>: 3 digits


'''Examples'''
==== Parameters ====
* <code>add_contacts npc_maple,123</code>
<code>map_name</code>: The map file to teleport the player to. 
<code>x</code>: The X-tile coordinate to teleport the player to. 
<code>y</code>: The Y-tile coordinate to teleport the player to. 
<code>transition_time</code>: The time in seconds the transition will last.


=== add_item ===
==== Examples ====
Add the specified item to the player's inventory.
<code>teleport map2.tmx,1,6,1.5</code> 
<code>teleport room1.tmx,8,1,4</code>


'''Parameters'''
* <code>item_name</code>: Monster slug to look up in the monster database or name variable where it's stored the mon_slug.
* <code>quantity</code>: Quantity of the item to add or to reduce. By default it is 1. (optional)
* <code>trainer_slug</code>: Slug of the trainer that will receive the item. It defaults to the current player. (optional)
'''Examples'''
* <code>add_item hatchet</code>
* <code>add_item hatchet,2</code>
* <code>add_item hatchet,2,npc_maple</code>
=== add_monster ===
Add the specified monster to the player's party.
'''Parameters'''
* <code>monster_slug</code>: Monster slug to look up in the monster database.
* <code>monster_level</code>: Level of the added monster.
* <code>trainer_slug</code>: Slug of the trainer that will receive the monster. It defaults to the current player. (optional)
* <code>exp_mod</code>: Experience modifier. (optional)
* <code>money_mod</code>: Money modifier. (optional)
'''Examples'''
* <code>add_monster fruitera,10</code>
* <code>add_monster fruitera,10,npc_maple,10,27</code>
=== add_tech ===
Adds a tech to a specific monster.
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id.
* <code>technique</code>: Slug of the technique (e.g. "bullet").
* <code>power</code>: Power between 0.0 and 3.0. (optional)
* <code>potency</code>: Potency between 0.0 and 1.0. (optional)
* <code>accuracy</code>: Accuracy between 0.0 and 1.0. (optional)
'''Examples'''
* <code>get_player_monster name_variable</code>
* <code>add_tech name_variable,bullet</code>
=== breeding ===
Select a monster in the player party filtered by gender and store its id in a variables (breeding_father or breeding_mother)
'''Parameters''' 
* <code>gender</code>: Gender (male or female).
'''Examples'''
* <code>breeding male</code>
* <code>breeding female</code>


=== call_event ===
=== call_event ===
Executes the actions from another event, ignoring its conditions. This can be especially useful for scenarios where you might need multiple sets of conditions that could be true, such as executing an action when the player is at a certain position OR has a certain item in their inventory.
Executes the actions from another event, ignoring its conditions. This can be especially useful for scenarios where you might need multiple sets of conditions that could be true, such as executing an action when the player is at a certain position OR has a certain item in their inventory.


'''Parameters'''
==== Parameters ====
* <code>event_name</code>: The name of the event whose actions should be executed.   
<code>event_id</code>: The id of the event whose actions should be executed.   


'''Examples'''  
==== Examples ====  
* <code>call_event name_event</code>     
<code>call_event 11</code>     
<code>call_event 8</code>


=== change_bg ===
Change the background.


'''Parameters''' 
=== set_variable ===
* <code>background</code>:
Sets an arbitrary variable to a particular value. This action is good for seeing if battles with NPCs have been fought or not. These variables are also saved when the player saves the game.
* it can be the name of the file (see below note)
* it can be a RGB color separated by ":" (eg 255:0:0)
* <code>image</code>: monster_slug or template_slug or path
* if path, then "gfx/ui/background/"
* if template (eg. ceo) in "gfx/sprites/player"
* note: the background or image (if not monster or template) must be inside the folder (gfx/ui/background/)
* background size: 240x160


==== Parameters ====
<code>variable_name:value</code>: A key, value pair of the <code>variable_name</code> to set with <code>value</code>. 


'''Examples'''
==== Examples ====
* <code>change_bg gradient_blue,rockitten</code>
<code>set_variable battle_won:yes</code>
* <code>change_bg gradient_blue,ceo</code>
<code>set_variable talked_to_prof:true</code>
* <code>change_bg gradient_blue</code>
* <code>change_bg</code> (stop)


=== change_taste ===
hanges tastes monster.


'''Parameters''' 
=== play_sound ===
* <code>variable</code>: Name of the variable where to store the monster id.
Plays an audio file located under "sounds/".
* <code>taste</code>: Warm or cold.


'''Examples'''
==== Parameters ====
* <code>change_taste name_variable,warm</code>
<code>filename</code>: The name of the sound file to play under "sounds/" 


=== change_state ===
==== Examples ====  
Change to the specified state.
<code>play_sound combat/falling_Macro.ogg</code> 


'''Parameters''' 
* <code>state_name</code>: The state name to switch to (e.g. PCState).
* <code>optional</code>: Variable related to specific states (e.g. variable with monster_id for '''MonsterInfo''', monster slug for '''JournalInfoState''' and character slug for '''CharacterState'''). (Optional)


'''Examples'''
=== play_music ===
* <code>change_state PCState</code>
Plays an audio file located under "music/" on a loop.
* <code>change_state JournalInfoState,rockitten</code>


=== char_face ===
==== Parameters ====  
Make the character face a certain direction.
<code>filename</code>: The name of the music file to play under "music/" 


'''Parameters''' 
==== Examples ====
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
<code>play_music 472452_8-Bit-Ambient.ogg</code>  
* <code>direction</code>: Direction to make the character's face. Can be set to: <code>left</code>, <code>right</code>, <code>up</code>, or <code>down</code>.


'''Examples'''
* <code>char_face player,down</code>
* <code>char_face npc_maple,right</code>


=== char_look ===
=== player_face ===
Make a character look around.
Makes the player face a particular direction. Parameter can be set to: <code>left</code>, <code>right</code>, <code>up</code>, or <code>down</code>.


'''Parameters'''
==== Parameters ====
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
<code>direction</code>: Direction to make the player face. Can be set to: <code>left</code>, <code>right</code>, <code>up</code>, or <code>down</code>.
* <code>frequency</code>: Frequency of movements. 0 to stop looking. If set to a different value it will be clipped to the range [0.5, 5]. If not passed the default value is 1.   
* <code>directions</code>: the direction the npc is going to look, by default all. (optional)


'''Examples'''
==== Examples ====
* <code>char_look character</code>   
<code>player_face left</code>   
* <code>char_look character,,right:left</code>
<code>player_face up</code>


=== char_move ===
Relative tile movement for character.


'''Parameters'''
=== player_stop ===
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
Stops the player from moving until <code>player_resume</code> is called.


'''Examples'''
==== Parameters ====
* <code>char_move spyder_homemakerpapertown, down 1, right 1, up 1, left 1</code>   
<code>None</code>   


=== char_plague ===
==== Examples ====  
Set the character as infected, inoculated or healthy.
<code>player_stop</code> 


'''Parameters'''
* <code>condition</code>: Infected, inoculated or healthy.
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple"). (optional)


'''Examples'''
=== player_resume ===
* <code>char_plague infected,npc_maple</code>
Resumes the player's ability to move. Usually used after the <code>player_stop</code> action.


=== char_run ===
==== Parameters ====  
Set the character movement speed to the global run speed.
<code>None</code> 


'''Parameters'''
==== Examples ====
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
<code>player_resume</code>


'''Examples'''
* <code>char_run npc_mom</code>


=== char_speed ===
=== pause_music ===
Set the character movement speed to a custom value.
Pauses the currently playing music.


'''Parameters'''
==== Parameters ====
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
<code>None</code>
* <code>speed</code>: Speed amount.


'''Examples'''
==== Examples ====
* <code>char_speed npc_mom,0.2</code>
<code>pause_music</code>


=== char_stop ===
Make the character stop moving.


'''Parameters'''
=== fadeout_music ===
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
Fades out music over <code>x</code> seconds.


'''Examples'''
==== Parameters ====
* <code>char_stop npc_mom</code>
<code>time_seconds</code>: Time in seconds to fade out the currently playing music.


=== char_walk ===
==== Examples ====  
Set the character movement speed to the global walk speed.
<code>fadeout_music 2</code>


'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").


'''Examples'''
=== dialog ===
* <code>char_walk npc_mom</code>
Opens the dialog box with provided text. For line breaks, use the <code>\n</code> character. You may also use special variables in dialog events. If you have multiple dialog commands they will display sequentially. Using <code>${{end}}</code> does nothing as it used to denote the end of a dialog chain. Here is a list of available variables:
   
* <code>${{name}}</code> - The current player's name.


=== char_wander ===
==== Parameters ====  
Make a character wander around the map.
<code>text</code>: The text to display in a dialog window.


'''Parameters'''
==== Examples ====
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
<code>dialog Red:\n This is some dialog!</code>
* <code>frequency</code>: Frequency of movements. 0 to stop wandering. If set to a different value it will be clipped to the range [0.5, 5]. If not passed the default value is 1.
<code>dialog ${{name}}:\n Hello there! \nHow are you?</code>
* <code>t_bound</code>: Coordinates top_bound vertex (e.g. 5,7)
* <code>b_bound</code>: Coordinates bottom_bound vertex (e.g. 7,9)


'''Examples'''
* <code>char_wander npc_maple</code>
* <code>char_wander npc_maple,,5,7,7,9</code>


=== choice_item ===
=== translated_dialog ===
Ask the player to make a choice among items.
Opens the dialog box with translated text for a given key found in <code>resources/db/locale/<locale>.json</code>. Optional variable replacement will also be translated if the value is a key in the locale file. For line breaks, use the <code>\n</code> character. If you have multiple translated_dialog commands they will display sequentially. Using <code>${{end}}</code> does nothing as it used to denote the end of a dialog chain. You may also use special variables in dialog events. Here is a list of available variables:
   
* <code>${{name}}</code> - The current player's name.


'''Parameters''' 
==== Parameters ====
* <code>choices</code>: List of possible choices (item slugs eg: potion:tea), separated by a colon ":".
<code>dialog_key</code>: The translated text for a given key found in <code>resources/db/locale/<locale>.json</code> to display in a dialog window.  
* <code>variable</code>: Variable to store the result of the choice.
<code>parameters</code>: Optional comma-separated <code>var=value</code> parameters to replace variables in the translation text. The <code>value</code> can either be text or a key found in <code>resources/db/locale/<locale>.json</code>.


'''Examples'''
==== Examples ====
* <code>choice_monster potion:tea,name_variable</code>
<code>translated_dialog received_x,name=a brand new car!</code>
<code>translated_dialog received_x,name=item_potion</code> 
<code>translated_dialog combat_fainted,name=${{name}}</code> 
<code>translated_dialog combat_opponent_call_tuxemon,user=${{name}},name=some guy</code> 


=== choice_monster ===
Ask the player to make a choice among monsters.


'''Parameters''' 
=== dialog_chain ===
* <code>choices</code>: List of possible choices (monster slugs eg: rockitten:apeoro), separated by a colon ":".
Deprecated. Use [dialog](#dialog)
* <code>variable</code>: Variable to store the result of the choice.


'''Examples'''
* <code>choice_monster apeoro:rockitten,name_variable</code>


=== choice_npc ===
=== translated_dialog_chain ===
Ask the player to make a choice among NPCs.
Deprecated. Use [translated_dialog](#translated_dialog)


'''Parameters''' 
* <code>choices</code>: List of possible choices (npc slugs eg: maple:billie), separated by a colon ":".
* <code>variable</code>: Variable to store the result of the choice.


'''Examples'''
=== dialog_choice ===
* <code>choice_monster billie:maple,name_variable</code>
Asks the player to select a choice.


=== clear_kennel ===
==== Parameters ====  
Clear a kennel. It advisable to save the game and check twice. Remember the main kennel is "Kennel" and without destination (transfer) the monster will be deleted as well as the kennel.
<code>choices</code>: The possible choices separated by colons.
<code>variable</code>: The variable to store the answer.


'''Parameters''' 
==== Examples ====
* <code>kennel</code>: The kennel to clear.
<code>dialog_choice Yes:No:Maybe,myvariable</code>
* <code>transfer</code>: The kennel to transfer the monsters. (optional)


'''Examples'''
* <code>clear_kennel name_kennel, new_kennel</code>


=== clear_tuxepedia ===
=== translated_dialog_choice ===
Clear the key and value in the Tuxepedia dictionary.
Asks the player to select a choice. The translations for the text are looked up based on a given key.


'''Parameters''' 
==== Parameters ====
* <code>monster_slug</code>: Monster slug name (e.g. "rockitten").
<code>choice_keys</code>: Keys to reference translated text choices separated by colons.
<code>variable</code>: The variable to store the answer which will be the key for the translated text.


'''Examples'''
==== Examples ====
* <code>clear_tuxepedia rockitten</code>
<code>dialog_choice yes:no,myvariable</code>


=== clear_variable ===
Clear the value of a variable from the game.


'''Parameters'''  :
=== screen_transition ===
* <code>variable</code>: The variable to clear.
Fades the screen to black and back over <code>x</code> seconds.
 
'''Examples'''
* <code>clear_variable name_variable</code>


=== copy_variable ===
==== Parameters ====  
Copy the value of var2 into var1 (e.g. var1 = var 2).
<code>transition_time</code>: Time in seconds to fade the screen to black.


'''Parameters'''  :
==== Examples ====
* <code>var1</code>: The variable to copy to.
<code>screen_transition 2</code>
* <code>var2</code>: The variable to copy from.


'''Examples'''
* <code>copy_variable new_variable,old_variable</code>


=== create_npc ===
=== create_npc ===
Creates an NPC and places them on the current map.
Creates an NPC and places them on the current map.


'''Parameters'''
==== Parameters ====
* <code>name</code>: The name of the NPC to create. This NPC should exist in <code>resources/db/npc</code> in JSON format.   
<code>name</code>: The name of the NPC to create. This NPC should exist in <code>resources/db/npc</code> in JSON format.   
* <code>tile_pos_x</code>: The X-tile coordinate to place the NPC.   
<code>tile_pos_x</code>: The X-tile coordinate to place the NPC.   
* <code>tile_pos_y</code>: The Y-tile coordinate to place the NPC.   
<code>tile_pos_y</code>: The Y-tile coordinate to place the NPC.   
* <code>behavior</code>: The NPC's movement behavior. Currently not implemented.   
<code>animations</code>: The name of the sprite to use for the animations in <code>resources/sprites</code>. 
<code>behavior</code>: The NPC's movement behavior. Currently not implemented.   


'''Examples'''
==== Examples ====
* <code>create_npc Maple,2,3</code>   
<code>create_npc Maple,2,3,maple,wander</code>   
* <code>create_npc Pine,1,6,stand</code>
<code>create_npc Pine,1,6,maple,stand</code>


=== delayed_teleport ===
Set teleport information. Teleport will be triggered during screen transition. Only use this if followed by a transition.


'''Parameters'''
=== remove_npc ===
* <code>map_name</code>: Name of the map to teleport to.
Removes an NPC from the current map.
* <code>position_x</code>: X position to teleport to.
* <code>position_y</code>: Y position to teleport to.
 
'''Examples'''
* <code>delayed_teleport cotton_town,10,10</code>
 
=== evolution ===
Checks, asks and evolves. It's the action responsible for evolving monster when one or more conditions are met. It's advisable to use it with the condition <code>is/not check_evolution player</code>
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
 
'''Examples'''
* <code>evolution player</code>
 
=== fadeout_music ===
Fades out music over <code>x</code> milliseconds.
 
'''Parameters'''
* <code>time_seconds</code>: Time in milliseconds to fade out the currently playing music.
 
'''Examples'''
* <code>fadeout_music 2</code>
 
=== format_variable ===
Format the value of a variable from the game (eg. float or int).
 
'''Parameters'''
* <code>variable</code>: The variable to format.
* <code>type_format</code>: Kind of format (float or int).
 
'''Examples'''
* <code>format_variable name_variable,int</code>
* <code>format_variable name_variable,float</code>
 
=== get_monster_tech ===
Select a tech among the monster's moves. It allows filtering: slug, element, range.
 
'''Parameters'''
* <code>variable_name</code>: Variable where to store the technique id.
* <code>monster_id</code>: Variable where is stored the monster id.
* <code>filter_name</code>: the name of the first filter (optional)
* <code>value_name</code>: the actual value to filter (optional)
* <code>extra</code>: used to filter more (optional)
 
'''Examples'''
* <code>get_monster_tech name_variable,monster_id</code>
* <code>get_monster_tech name_variable,monster_id,element,water</code>
* <code>get_monster_tech name_variable,monster_id,power,less_than,1.6</code>
 
=== get_party_monster ===
Saves all the iids (party) in variables. Names are saved in game variables: <code>iid_slot_{index}</code>. Where index is the position in the party (the 1st one is 0, 2nd one is 1, etc.)
 
'''Parameters'''
* <code>npc_slug</code>: npc slug name (e.g. "npc_maple") - if absent default "player" (optional)
 
'''Examples'''
* <code>get_party_monster</code>
* <code>get_party_monster npc_maple</code>
 
=== get_player_monster ===
Select a monster in the player party and store its id in a variable.
 
It allows filtering: slug, gender, evolution_stage, element, shape, taste_warm, taste_cold, level, weight, height, max_hp, current_hp, armour, dodge, melee, ranged and speed.
 
For the definition: level, weight, height, max_hp, current_hp, armour, dodge, melee, ranged and speed (all numeric values) is necessary to use a numeric comparison operator. Accepted values are "less_than", "less_or_equal", "greater_than", "greater_or_equal", "equals" and "not_equals".
 
Note:
* let's say a player doesn't has no options, then the variable will result as: name_variable:no_option
* let's say a player has options, but clicks return, then the variable will result as: name_variable:no_choice
 
'''Parameters'''
* <code>variable_name</code>: Name of the variable where to store the monster id.
* <code>filter_name</code>: the name of the first filter (optional)
* <code>value_name</code>: the actual value to filter (optional)
* <code>extra</code>: used to filter more (optional)
 
'''Examples'''
* <code>get_player_monster name_variable</code>
* <code>get_player_monster name_variable,speed,more_than,50</code>
* <code>get_player_monster name_variable,level,less_than,15</code>
* <code>get_player_monster name_variable,shape,serpent</code>
* <code>get_player_monster name_variable,shape,serpent</code>
 
=== give_experience ===
Gives experience points to the monster.
 
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id.
* <code>exp</code>: Name of the variable where to store the experience points or directly the number of points. Negative value will result in 0.
 
'''Examples'''
* <code>give_experience name_variable,steps_variable"</code>
* <code>give_experience name_variable,420</code>
 
=== info ===
Records monster's attribute values inside a game variable. It allows to record the monster's owner attribute values too.
 
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id.
* <code>attribute</code>: The attribute to check (level, speed, etc.).
 
'''Examples'''
* <code>info name_variable,level</code> -> if the monster is lv 4, then it'll create a variable called: "info_level:4"
* <code>info name_variable,owner_steps</code> -> if the owner walked 69 steps, then it'll create a variable called: "info_owner_steps:69"
 
=== input_variable ===
Set a code and checks if it's correct or not. The player's output will be by default lowercase.
 
'''Parameters'''
* <code>question</code>: The question the player needs to reply. (eg. "access_code") then you create the msgid "access_code" inside the English PO file, as follows: msgid "access_code" and msgstr "Here the actual question?"
* <code>variable</code>: Name of the variable where to store the output.
* <code>escape</code>: Whether the input can be closed or not. Default False.
 
'''Examples'''
* <code>input_variable access_code,response_question</code>
* <code>input_variable access_code,response_question,escape</code>
 
=== load_game ===
Loads the game. If the index parameter is absent, then it'll load slot4.save (index = 0 > slot 1, index = 1 > slot 2, index = 2 > slot 3)
 
'''Parameters'''
* <code>index</code>: Selected index. (optional)
 
'''Examples'''
* <code>load_game</code> (it's going to load slot4.save)
* <code>load_game 0</code> (it's going to load slot1.save)
 
=== lock_controls ===
Lock player controls.
 
'''Parameters'''
* <code>None</code>
 
'''Examples'''
* <code>lock_controls</code>
 
=== menu ===
Enable/disable one or more menu.
 
'''Parameters'''
* <code>act</code>: enable or disable
* <code>menu</code>: specific menu (menu_monster, menu_bag, menu_player, exit, menu_options, menu_save, menu_load, menu_missions) without specification, everything disabled
 
'''Examples'''
* <code>menu disable,menu_bag</code>
 
=== modify_char_attribute ===
Modify the given attribute of the character by modifier. By default this is achieved via addition, but prepending a '%' will cause it to be multiplied by the attribute.
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
* <code>attribute</code>: Name of the attribute to modify.
* <code>value</code>: Value of the attribute modifier.
 
'''Examples'''
* <code>modify_char_attribute character,attribute,value</code>
 
=== modify_money ===
Add or remove an amount of money for a wallet (slug).
 
'''Parameters'''
* <code>slug</code>: Slug name (e.g. player or NPC, etc.).
* <code>amount</code>: Amount of money to add/remove (-/+)
* <code>variable</code>: Name of the variable where to store the amount.
 
'''Examples'''
* <code>modify_money npc_maple,100</code>
* <code>modify_money npc_maple,-50</code>
* <code>modify_money player,,name_variable</code>
 
=== modify_monster_bond ===
Add or remove an amount of money for a wallet (slug).
 
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id. If no variable is specified, all monsters are touched.
* <code>amount</code>: An int or float value, if no amount, then default 1 (int).
 
'''Examples'''
* <code>modify_monster_bond</code>
* <code>modify_monster_bond name_variable,25</code>
* <code>modify_monster_bond name_variable,-0.5</code>


=== modify_monster_health ===
==== Parameters ====  
Modify the hp of a monster in the current player's party.
<code>name</code>: The name of the NPC to remove.


'''Parameters'''
==== Examples ====
* <code>variable</code>: Name of the variable where to store the monster id. If no variable is specified, all monsters are healed.
<code>remove_npc Maple</code>
* <code>health</code>: A float value between 0 and 1, which is the percent of max hp to be restored to. A int value, which is the number of HP to be restored to. If no health is specified, the hp is maxed out.
<code>remove_npc Pine</code>


'''Examples'''
* <code>modify_monster_health</code>
* <code>modify_monster_health ,0.25</code>


=== npc_face ===
Makes the npc face a particular direction. Parameter can be set to: <code>left</code>, <code>right</code>, <code>up</code>, or <code>down</code>.


=== modify_monster_stats ===
==== Parameters ====  
Change the stats of a monster in the current player's party.
<code>name</code>: The name of the npc.   
<code>direction</code>: Direction to make the player face. Can be set to: <code>left</code>, <code>right</code>, <code>up</code>, or <code>down</code>.


'''Parameters'''
==== Examples ====
* <code>variable</code>: Name of the variable where to store the monster id. If no variable is specified, all monsters are touched. (Optional)
<code>npc_face Maple,left</code>
* <code>stat</code>: A stat among armour, dodge, hp, melee, speed and ranged. If no stat, then all the stats. (Optional)
<code>npc_face Pine,up</code>
* <code>amount</code>: A/an float/int value, if no amount, then default 1 (+). (Optional)


'''Examples'''
* <code>modify_monster_stats</code>
* <code>modify_monster_stats ,,0.25</code>
* <code>modify_monster_stats name_variable,speed,25</code>
* <code>modify_monster_stats name_variable,dodge,-12</code>
* <code>modify_monster_stats name_variable,dodge,-0.4</code>
=== open_shop ===
Open the shop menu for a NPC.
'''Parameters'''
* <code>npc_slug</code>: Either "player" or npc slug name (e.g. "npc_maple").
* <code>menu</code>: Either "buy", "sell" or "both". Default is "both". (optional)
'''Examples'''
* <code>open_shop npc_maple</code>
=== overwrite_tech ===
Overwrite / replace a technique with another.
'''Parameters'''
* <code>removed</code>: Name of the variable where to store the tech id.
* <code>added</code>: Slug technique.
'''Examples'''
* <code>overwrite_tech name_variable,peck</code>


=== pathfind ===
=== pathfind ===
Moves an NPC to a certain tile on the map.
Moves an NPC to a certain tile on the map.


'''Parameters'''
==== Parameters ====
* <code>name</code>: The name of the NPC to be moved.
<code>name</code>: The name of the NPC to be moved.\n
* <code>tile_pos_x</code>: The X-tile coordinate to have the NPC to walk to.   
<code>tile_pos_x</code>: The X-tile coordinate to have the NPC to walk to.   
* <code>tile_pos_y</code>: The Y-tile coordinate to have the NPC to walk to.     
<code>tile_pos_y</code>: The Y-tile coordinate to have the NPC to walk to.     


'''Examples'''
==== Examples ====
* <code>pathfind Maple,2,3</code>  
<code>pathfind Maple,2,3</code>  
* <code>pathfind Pine,1,6</code>
<code>pathfind Pine,1,6</code>


=== pathfind_to_player ===
=== start_battle  ===
Pathfind NPC close the player.
Start a battle with an NPC defined in </code>resources/db/npc</code>.


'''Parameters'''
Here is an example NPC file:
* <code>npc_slug</code>: Npc slug name (e.g. "npc_maple").
* <code>direction</code>: Approaches the player from up, down, left or right.
* <code>distance</code>: How many tiles (2, 3, 4, etc.)


'''Examples'''  
''resources/db/npc/maple.json''
* <code>pathfind_to_player spyder_route2_roddick</code>
<code>json
* <code>translated_dialog spyder_route2_roddick1</code>
{
* <code>start_battle player,spyder_route2_roddick</code>  
    "monsters": [
        {
            "attack": 50,
            "defense": 7,
            "name": "Snowball",
            "special_attack": 9,
            "level": 5,
            "monster_slug": 1,
            "hp": 50,
            "speed": 7,
            "special_defense": 7,
            "exp_give_mod": 3,
            "exp_req_mod": 27
        }
    ],
    "id": 1,  
    "name": "Maple"
}
</code>


=== pause_music ===
==== Parameters ====  
Pauses the currently playing music.
<code>npc_slug</code>: The NPC's slug as defined in the NPC's JSON file in <code>resources/db/npc</code>.


'''Parameters'''
==== Examples ====
* <code>None</code>
<code>start_battle npc_maple</code>


'''Examples'''
* <code>pause_music</code>


=== play_map_animation ===
=== add_monster ===
Plays an animation on the map. The <code>position</code> parameter can also be <code>player</code> if you want to draw the animation at the player's location. Loop can be either <code>loop</code> or <code>noloop</code>.
Add the specified monster to the player's party.


'''Parameters'''
==== Parameters ====
* <code>animation_name</code>: The name of the animation to play under <code>resources/animations/tileset</code>.   
<code>monster_name</code>: The name of the monster to add as defined in the monster JSON under <code>resources/db/monster</code>.   
* <code>duration</code>: The amount of time in seconds between each frame. 
<code>monster_lvl</code>: The level of the monster to start at.
* <code>loop</code>: Whether or not to loop the animation. Can be either <code>loop</code> or <code>noloop</code> to loop the animation. 
* <code>position</code>: The position to draw the animation. Can either be an <code>x,y</code> coordinate or <code>npc_slug</code> to draw the animation over the character.


'''Examples'''
==== Examples ====
* <code>play_map_animation grass,0.1,noloop,player</code> 
<code>add_monster txmn_fruitera,10</code>
* <code>play_map_animation sign01,0.4,loop,33,10</code>


=== play_music ===
Plays an audio file.


'''Parameters'''
=== remove_monster ===
* <code>filename</code>: Music file to load (slug inside the JSON in db/sound)
Removes the specified monster to the player's party.
* <code>volume</code>: Number between 0.0 and 1.0. (optional)
* <code>loop</code>: How many times loop, default forever. (optional)
 
'''Examples'''
* <code>play_music music_mystic_island</code>
 
=== play_sound ===
Plays a sound file.
 
'''Parameters'''
* <code>filename</code>: Sound file to load (slug inside the JSON in db/sound)
* <code>volume</code>: Number between 0.0 and 1.0. (optional)
 
'''Examples'''
* <code>play_sound sound_confirm</code> 
 
=== print ===
Print the current value of a game variable to the console. If no variable is specified, print out values of all game variables.
 
'''Parameters''' :
* <code>variable</code>: Prints out the value of this variable (optional)
 
'''Examples'''
* <code>print</code> 
* <code>print name_variable</code> 
 
=== quarantine ===
Quarantine infected monsters. Amount works only for "out", it takes out the amount in a random way.
 
'''Parameters'''
* <code>value</code>: in or out
* <code>amount</code>: number of monsters (optional)
 
'''Examples'''
* <code>quarantine out</code> everything out (player's party -> if full, then box)
* <code>quarantine out,5</code> eg. box contains 30 monsters <code>quarantine out,5</code>, it means 5 monsters by random
 
=== quit ===
Completely quit the game.
 
'''Parameters'''
* <code>None</code> 
 
'''Examples'''
* <code>quit</code> 


=== random_battle ===
==== Parameters ====  
Start random battle with a random npc with a determined number of monster in a certain range of levels.
<code>monster_slug</code>: The slug of the monster to add as defined in the monster JSON under <code>resources/db/monster</code>.


'''Parameters'''
==== Examples ====
* <code>nr_txmns</code>: Number of tuxemon (1 to 6).
<code>remove_monster txmn_fruitera</code>
* <code>min_level</code>: Minimum level of the party.
* <code>max_level</code>: Maximum level of the party.


'''Examples'''
* <code>random_battle 6,1,99</code>


=== random_encounter ===
=== random_encounter ===
Randomly start a battle based on the encounter group looked up via the <code>encounter_id</code>. Encounter groups contain a list of monsters that can be encountered as well as their level and encounter rate. In most circumstances you will pair this action with the <code>char_at</code> and <code>char_moved</code> conditions.
Randomly start a battle based on the encounter group looked up via the <code>encounter_id</code>. Encounter groups contain a list of monsters that can be encountered as well as their level and encounter rate. In most circumstances you will pair this action with the <code>player_at</code> and <code>player_moved</code> conditions.


Here is an example encounter file: ''resources/db/encounter/route1.json'' 
Here is an example encounter file:


  "slug": "route1",
''resources/db/encounter/1.json'' 
  "monsters": [
<code>json
    {
{
      "monster": "pairagrin",
    "id": 1,  
      "encounter_rate": 3.5,
    "monsters": [
      "variable": "daytime:true",
        {
      "exp_req_mod": 1,
            "monster_slug": "txmn_bigfin",  
      "level_range": [
            "encounter_rate": 10,  
         2,
            "level_range": [
         4
                1,
      ]
                6
     },
            ]
        },
        {
            "monster_slug": "txmn_dandylion",  
            "encounter_rate": 10,  
            "level_range": [
                1,
                6
            ]
         },
         {
            "monster_slug": "txmn_tux",
            "encounter_rate": 10,
            "level_range": [
                1,
                6
            ]
        }
     ]
}
</code>


'''Parameters'''
==== Parameters ====
* <code>encounter_slug</code>: Slug of the encounter list.
<code>encounter_id</code>: The id of the encounter JSON file to use for random battles under <code>resources/db/encounter</code>.
* <code>total_prob</code>: Total sum of the probabilities. (optional)
* <code>rgb</code>: color (eg red > 255,0,0 > 255:0:0) - default rgb(255,255,255) (optional)


'''Examples'''
==== Examples ====
* <code>random_encounter route1</code>
<code>random_encounter 1</code>
* <code>random_encounter route1,20</code>


=== random_integer ===
Randomly choose an integer between 2 numbers (inclusive), and set the key in the player.game_variables dictionary to be this value. For example, 'random_integer xyz,1,6' will set the value of the game variable 'xyz' to be either 1, 2, 3, 4, 5, or 6.


'''Parameters'''
=== play_map_animation ===
* <code>variable</code>: Name of the variable.
Plays an animation on the map. The <code>position</code> parameter can also be <code>player</code> if you want to draw the animation at the player's location. Loop can be either <code>loop</code> or <code>noloop</code>.
* <code>lower_bound</code>: Lower bound of range to return an integer between (inclusive)
* <code>upper_bound</code>: Upper bound of range to return an integer between (inclusive)
 
'''Examples'''
* <code>random_integer name_variable,1,9</code>
 
=== random_item ===
Pick a random item from a list and add it to the trainer's inventory.
 
'''Parameters'''
* <code>item_slug</code>: Item name to look up in the item database (multiple items separated by ":").
* <code>quantity</code>: Quantity of the item to add or to reduce. By default it is 1. (optional)
* <code>trainer_slug</code>: Slug of the trainer that will receive the item. It defaults to the current player. (optional)
 
'''Examples'''
* <code>random_item potion:tea:revive</code> (adds 1 potion or tea or revive to the trainer's inventory).
* <code>random_item potion:tea:revive,2</code> (adds 2 potions or teas or revives to the trainer's inventory).
* <code>random_item potion:tea:revive,2,npc_maple</code> (adds 2 potions or teas or revives to the maple's inventory).
* <code>random_item potion:tea:revive,,npc_maple</code> (adds 1 potion or tea or revive to the maple's inventory).
 
=== random_monster ===
Add a monster to the specified trainer's party if there is room.
 
'''Parameters'''
* <code>monster_level</code>: Level of the added monster.
* <code>trainer_slug</code>: Slug of the trainer that will receive the monster. It defaults to the current player. (optional)
* <code>exp_mod</code>: Experience modifier. (optional)
* <code>money_mod</code>: Money modifier. (optional)
* <code>shape</code>: Shape (eg. varmint, brute, etc.). (optional)
* <code>evo</code>: Stage (eg. basic, stage1, etc.). (optional)
 
'''Examples'''
* <code>random_monster 10</code>
* <code>random_monster 10,npc_maple</code>
* <code>random_monster 10,npc_maple,10,27</code>
* <code>random_monster 10,npc_maple,10,27,aquatic,basic</code>
* <code>random_monster 10,npc_maple,,,brute,basic</code>
 
=== remove_collision ===
Removes a collision defined by a specific label.
 
'''Parameters''' :
* <code>label</code>: Name of the obstacle.
 
'''Examples'''
* <code>remove_collision obstacle</code> (it can one added with add_collision or an existing zone in the .tmx file).
 
=== remove_contacts ===
Remove contact from the app (Nu Phone).
 
'''Parameters''' :
* <code>slug</code>: slug name (e.g. "npc_maple").
 
'''Examples'''
* <code>remove_contacts npc_maple</code>
 
=== remove_monster ===
Remove a monster from the party if the monster is there.
 
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id.
 
'''Examples'''
* <code>get_player_monster name_variable</code>
* <code>remove_monster name_variable</code>
 
=== remove_npc ===
Removes an NPC from the current map.
 
'''Parameters'''
* <code>name</code>: The name of the NPC to remove. 
 
'''Examples'''
* <code>remove_npc Maple</code>
* <code>remove_npc Pine</code>
 
=== remove_state ===
Change to the specified state.
 
'''Parameters''' 
* <code>state_name</code>: The state name to switch to (e.g. PCState).
* <code>optional</code>: Variable related to specific states (eg slug for JournalInfoState).
 
'''Examples'''
* <code>remove_state</code> (it removes everything, excluding the basic ones)
* <code>remove_state JournalInfoState</code> (it removes everything, excluding the basic ones)
 
=== remove_tech ===
Remove a specific technique from a specific monster.
 
'''Parameters''' 
* <code>tech_id</code>: Name of the variable where to store the tech id.
 
'''Examples'''
* <code>remove_tech name_variable</code>
 
=== rename_monster ===
Open the text input screen to rename the monster.
 
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id.
 
'''Examples'''
* <code>rename_monster name_variable</code> 
 
=== rename_player ===
Open the text input screen to rename the player.
 
'''Parameters'''
* <code>None</code>
 
'''Examples'''
* <code>rename_player</code> 
 
=== rumble ===
Rumble available controllers with rumble support.
 
'''Parameters'''
* <code>duration</code>: Time in seconds to rumble for.
* <code>power</code>: Percentage of power to rumble.
 
'''Examples'''
* <code>rumble duration,power</code> 


=== save_game ===
==== Parameters ====  
Saves the game. If the index parameter is absent, then it'll create slot4.save (index = 0 > slot 1, index = 1 > slot 2, index = 2 > slot 3)
<code>animation_name</code>: The name of the animation to play under <code>resources/animations/tileset</code>.
<code>duration</code>: The amount of time in seconds between each frame. 
<code>loop</code>: Whether or not to loop the animation. Can be either <code>loop</code> or <code>noloop</code> to loop the animation. 
<code>position</code>: The position to draw the animation. Can either be an <code>x,y</code> coordinate or <code>player</code> to draw the animation over the player.


'''Parameters'''
==== Examples ====
* <code>index</code>: Selected index. (optional)
<code>play_map_animation grass,0.1,noloop,player</code>
<code>play_map_animation sign01,0.4,loop,33,10</code>


'''Examples'''
* <code>save_game</code> (it's going to save slot4.save)
* <code>save_game 1</code> (it's going to save slot2.save)


=== screen_transition ===
=== wait_for_input ===
Fades the screen to black and back over <code>x</code> seconds.
Pauses execution of all events until the given input is received.


'''Parameters'''
==== Parameters ====
* <code>trans_time</code>: Time in seconds - default 0.3 (optional).
<code>input</code>: The pygame input to wait for.
* <code>rgb</code>: color (eg red > 255,0,0 > 255:0:0) - default rgb(255,255,255) (optional)


'''Examples'''
==== Examples ====
* <code>screen_transition 2</code>
<code>wait_for_input K_RETURN</code> 
<code>wait_for_input K_Q</code>


=== set_battle ===
Append a new element in player.battles.


'''Parameters'''
=== wait_for_secs ===
* <code>fighter</code>: Npc slug name (e.g. "npc_maple").
* <code>result</code>: One among "won", "lost" or "draw"
* <code>opponent</code>: Npc slug name (e.g. "npc_maple").
 
'''Examples'''
* <code>set_battle player,won,npc_maple</code> (player won against npc_maple)
 
=== set_bubble ===
Put a bubble above player sprite.
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
* <code>bubble</code>: dots, drop, exclamation, heart, note, question, sleep, angry, confused, fireworks
 
'''Examples'''
* <code>set_bubble spyder_shopassistant</code> (remove bubble NPC)
* <code>set_bubble spyder_shopassistant,note</code> (set bubble NPC)
* <code>set_bubble player,note</code> (set bubble player)
* <code>set_bubble player</code> (remove bubble player)
 
=== set_economy ===
Set the economy (prices of items) of the npc or player.
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
* <code>economy_slug</code>: Slug of an economy.
 
'''Examples'''
* <code>set_economy spyder_shopkeeper,spyder_candy_scoop</code>
 
=== set_kennel_visible ===
Set the kennel visible or hidden.
 
From hidden to visible: set_kennel_visible name_kennel,true
From visible to hidden: set_kennel_visible name_kennel,false
 
'''Parameters'''
* <code>kennel</code>: Name of the kennel.
* <code>visible</code>: true/false.
 
'''Examples'''
* <code>set_kennel_visible name_kennel,true</code>
* <code>set_kennel_visible name_kennel,false</code>
 
=== set_kennel ===
Create a new kennel. If the kennel is visible, then it's advisable to create a msgid in the en_US PO file.
 
msgid "kennel_name"
msgstr "Kennel Name"
 
'''Parameters'''
* <code>kennel</code>: Name of the kennel.
* <code>visible</code>: true/false.
 
'''Examples'''
* <code>set_kennel new_kennel,true</code>
 
=== set_layer ===
Allows to change the color of the transparent layer.
 
'''Parameters'''
* <code>rgb</code>: color (eg red > 255,0,0,128 > 255:0:0:128) - default transparent
 
'''Examples'''
* <code>set_layer 255:0:0:128</code>
 
=== set_mission ===
Set mission.
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
* <code>slug</code>: slug mission
* <code>operation</code>: add, remove or change
* <code>status</code>: completed, pending, failed (default pending)
 
'''Examples'''
* <code>set_mission mission1</code>
* <code>set_mission mission1,change,completed</code>
 
=== set_money ===
Set an amount of money for a specific slug.
 
'''Parameters'''
* <code>slug</code>: Slug name (e.g. player or NPC, etc.).
* <code>amount</code>: Amount of money (>= 0) (default 0)
 
'''Examples'''
* <code>set_money player</code>
* <code>set_money player,500</code>
 
=== set_monster_attribute ===
Set the given attribute of the monster to the given value.
 
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id.
* <code>attribute</code>: Name of the attribute.
* <code>value</code>: Value of the attribute.
 
'''Examples'''
* <code>set_monster_attribute name_variable,name,jimmy</code> (the monster will be named jimmy)
 
=== set_monster_flair ===
Set a monster's flair to the given value.
 
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id. If no variable is specified, all monsters are changed.
* <code>category</code>: Category of the monster flair.
* <code>flair</code>: Name of the monster flair.
 
'''Examples'''
* <code>get_player_monster name_variable</code>
* <code>set_monster_flair name_variable,category,flair</code>
 
=== set_monster_health ===
Set the hp of a monster in the current player's party. The action parameters may contain a monster slot and the amount of health.
 
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id. If no variable is specified, all monsters are healed. (optional)
* <code>health</code>: A float value between 0 and 1, which is the percent of max hp to be restored to. A int value, which is the number of HP to be restored to. If no health is specified, the hp is maxed out. (optional)
 
'''Examples'''
* <code>set_monster_health</code> (heals all the monsters in the party)
or
* <code>get_player_monster name_variable</code>
* <code>set_monster_health name_variable,1</code>
 
=== set_monster_level ===
Change the level of a monster in the current player's party.
 
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id. If no variable is specified, all monsters are changed. (optional)
* <code>levels_added</code>: Number of levels to add. Negative numbers are allowed. Default 1. (optional)
 
'''Examples'''
* <code>set_monster_level</code> (all the monsters in the party level up by 1)
or
* <code>get_player_monster name_variable</code>
* <code>set_monster_level name_variable,1</code>
 
=== set_monster_status ===
Change the status of a monster in the current player's party.
 
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id. If no variable is specified, all monsters get/lose status.. (optional)
* <code>status</code>: Inoculated, healthy or infected, default healthy (optional)
 
'''Examples'''
* <code>set_monster_status</code> (all the monsters in the party lose their status)
or
* <code>get_player_monster name_variable</code>
* <code>set_monster_status name_variable,status_blinded</code>
 
=== set_char_attribute ===
Set the given attribute of the character to the given value.
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
* <code>attribute</code>: Name of the attribute.
* <code>value</code>: Value of the attribute.
 
'''Examples'''
* <code>set_char_attribute character,attribute,value</code>
 
=== set_party_attribute ===
Set the given attribute of party's monsters to the given value.
 
'''Parameters'''
* <code>character</code>: Either "player" or character slug name (e.g. "npc_maple").
* <code>attribute</code>: Name of the attribute.
* <code>value</code>: Value of the attribute.
 
'''Examples'''
* <code>set_party_attribute player,name,jimmy</code> (all the monsters in the party will be named jimmy)
 
=== set_party_status ===
Records important information about all monsters in the party (eg average level of the party, etc.)
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
 
'''Examples'''
* <code>set_party_status player</code>
 
=== set_player_name ===
Set player name without opening the input screen.
 
'''Parameters'''
* <code>choice</code>: Single name or multiple names separated by ":" (random choice). NB: the names must be in the en_US PO file.
 
'''Examples'''
* <code>set_player_name jimmy</code>
* <code>set_player_name jimmy:richard:linus</code> (random choice among jimmy, richard and linus)
 
=== set_random_variable ===
Set the key in the player.game_variables dictionary with a random value.
 
'''Parameters'''
* <code>variable</code>: Name of the variable.
* <code>values</code>: Multiple values of the variable separated with ":".
 
'''Examples'''
* <code>set_random_variable alpha,one:two:three</code> (variable "alpha" can be "alpha:one" or "alpha:two" or "alpha:three").
 
=== set_template ===
Switch template (sprite and combat_front).
 
Please remember that if you change the combat_front, automatically will change the combat_back.
Eg if you set the sprite xxx, then it's going to add _back.png -> xxx_back.png
 
if you choose a feminine sprite, then it's advisable: heroine
if you choose a masculine sprite, then it's advisable: adventurer
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
* <code>sprite</code>: must be inside mods/tuxemon/sprites (default = original), eg: adventurer_brown_back.png -> adventurer
* <code>combat_front</code>: must be inside mods/tuxemon/gfx/sprites/player, eg: adventurer.png -> adventurer (optional)
 
'''Examples'''
* <code>set_template player,adventurer,adventurer</code>
 
=== set_tuxepedia ===
Set the key and value in the Tuxepedia dictionary.
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple").
* <code>monster_slug</code>: Monster slug name (e.g. "rockitten").
* <code>label</code>: seen / caught
 
'''Examples'''
* <code>set_tuxepedia player,rockitten,caught</code>
 
=== set_variable ===
Sets an arbitrary variable to a particular value. This action is good for seeing if battles with NPCs have been fought or not. These variables are also saved when the player saves the game.
 
Also used to set the [[:Category:Environment|environment]].
 
'''Parameters'''
* <code>variable_name:value</code>: A key, value pair of the <code>variable_name</code> to set with <code>value</code>. 
 
'''Examples'''
* <code>set_variable battle_won:yes</code> 
* <code>set_variable talked_to_prof:true</code>
* <code>set_variable environment:grass</code>
* <code>set_variable whatever:today</code>: whatever stores today's date (use in combination with condition <code>once</code>)
 
=== spawn_monster ===
Breed a new monster. Add a new monster, created by breeding the two given monsters (identified by instance_id, stored in a variable) and adds it to the given character's party (identified by slug). The parents must be in either the trainer's party, or a storage box owned by the trainer.
 
'''Parameters'''
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple"). The one who is going to receive the new born.
 
'''Examples'''
* <code>spawn_monster</code> 
 
=== start_battle ===
Start a battle between two characters and switch to the combat module.
 
'''Parameters'''
* <code>character1</code>: Either "player" or character slug name (e.g. "npc_maple").
* <code>character2</code>: Either "player" or character slug name (e.g. "npc_maple").
 
'''Examples'''
* <code>start_battle player,npc_maple</code>
* <code>start_battle npc_maple,npc_apple</code>
 
=== start_cinema_mode ===
Start cinema mode by animating black bars to narrow the aspect ratio.
 
'''Parameters'''
* <code>None</code>
 
'''Examples'''
* <code>start_cinema_mode</code>
 
=== stop_cinema_mode ===
Stop cinema mode by animating black bars back to the normal aspect ratio.
 
'''Parameters'''
* <code>None</code>
 
'''Examples'''
* <code>stop_cinema_mode</code>
 
=== store_monster ===
Store a monster in a box. Save the player's monster with the given instance_id to the named storage box, removing it from the player party.
 
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id.
* <code>box</code>: An existing box where the monster will be stored. (optional)
 
'''Examples'''
* <code>get_player_monster name_variable</code>
then:
* <code>store_monster name_variable</code>
or
* <code>store_monster name_variable,name_kennel</code>
 
=== teleport_faint ===
Teleport the player to the point in the teleport_faint variable. Usually used to teleport to the last visited Tuxcenter, as when all monsters in the party faint.
 
'''Parameters'''
* <code>trans_time</code>: Transition time in seconds - default 0.3. 
 
'''Examples'''
* <code>teleport_faint</code>
* <code>teleport_faint 6.9</code>
 
=== teleport ===
Teleports the player to a given position on a map. This teleport is immediate and does not have any transition animation.
 
'''Parameters'''
* <code>map_name</code>: The map file to teleport the player to. 
* <code>x</code>: The X-tile coordinate to teleport the player to. 
* <code>y</code>: The Y-tile coordinate to teleport the player to.
 
'''Examples'''
* <code>teleport map1.tmx,3,4</code> 
* <code>teleport room1.tmx,8,1</code>
 
=== trading ===
Select a monster in the player party and trade. It's advisable to use it with the condition <code>not has_monster monster_slug</code>.
 
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id (removed).
* <code>added</code>: Slug monster or Name of the variable where to store the monster id (added).
 
'''Examples'''
* <code>get_player_monster name_variable</code>
then
* <code>trading name_variable,nut</code>
 
=== transfer_money ===
Transfer money between entities. Both entities needs to have a wallet.
 
'''Parameters'''
* <code>slug1</code>: Slug name (e.g. NPC, etc.)
* <code>amount</code>: Amount of money.
* <code>slug2</code>: Slug name (e.g. NPC, etc.)
 
'''Examples'''
* <code>transfer_money player,100,npc_mom</code> (player transfers 100 to mom)
 
=== transition_teleport ===
Teleports the player to a given position on a map with a screen transition over <code>x</code> seconds.
 
'''Parameters'''
* <code>map_name</code>: The map file to teleport the player to. 
* <code>x</code>: The X-tile coordinate to teleport the player to. 
* <code>y</code>: The Y-tile coordinate to teleport the player to. 
* <code>trans_time</code>: The time in seconds - default 2. (optional)
* <code>rgb</code>: color (eg red > 255,0,0 > 255:0:0) - default rgb(255,255,255) (optional)
 
'''Examples'''
* <code>teleport map2.tmx,1,6,1.5</code> 
* <code>teleport room1.tmx,8,1,4</code>
 
=== translated_dialog_choice ===
Asks the player to select a choice. The translations for the text are looked up based on a given key.
 
'''Parameters'''
* <code>choice_keys</code>: Keys to reference translated text choices separated by colons.
* <code>variable</code>: The variable to store the answer which will be the key for the translated text.
 
'''Examples'''
* <code>translated_dialog_choice yes:no,myvariable</code>
 
=== translated_dialog ===
Open a dialog window with translated text according to the passed translation key. Parameters passed to the translation string will also be checked if a translation key exists.
 
'''Parameters'''
* <code>text</code>: The msgid in the PO file.
* <code>avatar</code>: If it is a number, the monster is the corresponding monster slot in the player's party. If it is a string, we're referring to a monster by name.
* <code>style</code>: a predefined style in db/dialogue/dialogue.json
 
'''Examples'''
* <code>translated_dialog msgid</code> 
 
=== unlock_controls ===
Unlock player controls
 
'''Parameters'''
* <code>None</code>
 
'''Examples'''
* <code>unlock_controls</code> 
 
=== update_tile_properties ===
Update tile properties. Enable movement and/or the moverate. '''moverate 0 = not accessible'''. The surface keys supported are: '''surfable''', '''walkable''' and '''climbable'''.
 
'''Parameters'''
* <code>label</code>: Name of the property
* <code>moverate</code>: Value of the moverate (eg 1 equal moverate, default 1)
 
'''Examples'''
* <code>update_tile_properties surfable,0.5</code> 
 
=== variable_math ===
Performs a mathematical operation on the key in the player.game_variables dictionary.
 
'''Parameters'''
* <code>variable_name</code>
* <code>operation</code>: +, -, * or /
* <code>value</code>
 
'''Examples'''
* <code>variable_math badge_count,+,1</code>
 
=== wait ===
Pauses execution of all events for the given amount of time in seconds.
Pauses execution of all events for the given amount of time in seconds.


'''Parameters'''
==== Parameters ====  
* <code>seconds</code>: The amount of time in seconds to wait for. 
<code>seconds</code>: The amount of time in seconds to wait for.   
 
'''Examples'''
* <code>wait 2.0</code> 
* <code>wait 5.2</code>
 
=== wild_encounter ===
Start an encounter with a single wild monster.
 
'''Parameters'''
* <code>monster_slug</code>: Monster slug.
* <code>monster_level</code>: Level of monster.
* <code>exp_mod</code>: Experience modifier. (optional)
* <code>mon_mod</code>: Money modifier. (optional)
* <code>env</code>: Environment (grass default) -> [[Battle Terrain]] (optional)
* <code>rgb</code>: color (eg red > 255,0,0 > 255:0:0) - default rgb(255,255,255) (optional)
 
'''Examples'''
* <code>wild_encounter rockitten,5</code> 
* <code>wild_encounter rockitten,5,2,2,desert</code>
 
=== withdraw_monster ===
Pull a monster from the given trainer's storage and puts it in their party.
 
'''Parameters'''
* <code>variable</code>: Name of the variable where to store the monster id.
* <code>character</code>: Either "player" or npc slug name (e.g. "npc_maple"). The one who is going to receive the monster.
           
'''Examples'''
* <code>get_player_monster name_variable</code>
then
* <code>withdraw_monster name_variable</code>
or
* <code>withdraw_monster name_variable,npc_maple</code>
 
== Variables ==
 
The following are the "main" variables generated by the game and these can be useful to trigger specific events.
 
These can be used with the condition:
<code>is variable_set name_variable:result_variable</code>
 
=== Battle related ===
* <code>battle_last_monster_name</code> name of the last monster fought.
* <code>battle_last_monster_level</code> level of the last monster fought.
* <code>battle_last_monster_type</code> type of the last monster fought.
* <code>battle_last_monster_category</code> category of the last monster fought.
* <code>battle_last_monster_shape</code> shape of the last monster fought.
 
trainer battles:
* <code>battle_last_trainer</code> slug of the last trainer fought
battles PC vs NPC (eg player vs npc_maple or npc_maple vs player)
* <code>battle_last_result</code>: the result can be <code>won</code> or <code>draw</code>
battles NPC vs NPC (eg npc_maple vs npc_apple) or PC vs NPC (eg player vs npc_maple or npc_maple vs player)
* <code>battle_last_loser</code> slug of the last trainer fought ("player" for the player)
* <code>battle_last_winner</code> slug of the last trainer fought ("player" for the player)
 
=== Time related ===
* <code>weekday</code> tracks the day of the week (Monday, Tuesday, etc.)
* <code>hour</code> tracks the hour
* <code>day_of_year</code> tracks the days in a year (1 to 365/366)
* <code>year</code> tracks the year
* <code>leap_year</code> the result can be <code>true</code> or <code>false</code>
* <code>daytime</code> the result can be <code>true</code> or <code>false</code> (<code>true</code> between from 06:00 to 18:00, <code>false</code> during the rest of the day).
* <code>stage_of_day</code> the result can be <code>dawn</code> (from 4 to 8), <code>morning</code> (from 8 to 12), <code>afternoon</code> (from 12 to 16), <code>dusk</code> (from 16 to 20) or <code>night</code> (from 20 to 04).
* <code>season</code> the result can be <code>winter</code>, <code>spring</code>, <code>summer</code> or <code>autumn</code>
 
=== Campaign related ===
* <code>gender_choice</code> the result can be <code>gender_male</code> or <code>gender_female</code>, depending on the player's choice at the beginning. Useful to create different events for gender.
 
=== Party related (monsters) ===
* <code>party_level_lowest</code> the result shows the lowest level in the player's party (weakest monster).
* <code>party_level_highest</code> the result shows the highest level in the player's party (strongest monster).
* <code>party_level_average</code> the result shows the average level in the player's party.
 
== Examples ==
 
==== Battle ====
Let's say you want to trigger different events based on the output of the fight:
* <code>is variable_set battle_last_result:won</code>
or
* <code>is variable_set battle_last_result:lost</code>
 
==== Date ====
Let's say you want to trigger an event in a specific date (mom's birthday, anniversary, etc.), eg. on the 25th May (day nr 145 or 146 if leap year or not):
* <code>is variable_set day_of_year:146</code>
* <code>is variable_set leap_year:true</code>
or
* <code>is variable_set day_of_year:145</code>
* <code>is variable_set leap_year:false</code>
but if the specific date is before (included) the 28th February (day nr 59):
* <code>is variable_set day_of_year:59</code>
 
==== Season ====
Let's say you want to grant access to a location only in summer:
* <code>is variable_set season:summer</code>
 
==== Stage of the day ====
Let's say you want to block the access during the night:
* <code>not variable_set stage_of_day:night</code>
while if you want to grant the access only during the night:
* <code>is variable_set stage_of_day:night</code>
 
==== Steps Countdown ====
Let's say you want to trigger an event after 1234 steps:
* <code>set_variable steps_whatever:1234</code>
<code>steps_</code> followed by your variable <code>whatever</code>.
* <code>is variable_is steps_whatever,equals,0.0</code>: Checking for the results, separate event.
 
Note: you can replace <code>equals</code> with: <code>less_than</code>, <code>less_or_equal</code>, <code>greater_than</code>, <code>greater_or_equal</code>, and <code>not_equals</code>.
 
==== Trading ====
Let's say you want to set up and event for trading monsters. You need 3 events after creating the NPC in map.
* <code>monster1</code> (monster desired by the NPC)
* <code>monster2</code> (monster the NPC wants to trade in exchange)
 
1st: if the player has the monster
    <property name="act10" value="translated_dialog dialog_npc1"/>
    <property name="act20" value="translated_dialog_choice yes:no,npc_willtrade"/>
    <property name="behav10" value="talk npc_slug"/>
    <property name="cond10" value="is has_monster player,monster1"/>
    <property name="cond20" value="not variable_set npc_hastraded:yes"/>
2nd: if the player hasn't the monster
    <property name="act10" value="translated_dialog dialog_npc1"/>
    <property name="act20" value="translated_dialog dialog_npc_nomonster1"/>
    <property name="behav10" value="talk npc_slug"/>
    <property name="cond10" value="not has_monster player,monster1"/>
    <property name="cond20" value="not variable_set npc_hastraded:yes"/>
3rd: trading part
    <property name="act10" value="translated_dialog dialog_npc_willtrade"/>
    <property name="act20" value="get_player_monster name_variable"/>
    <property name="act30" value="trading name_variable,traded_monster"/>
    <property name="act40" value="set_variable npc_hastraded:yes"/>
    <property name="cond10" value="is has_monster player,monster1"/>
    <property name="cond20" value="is variable_set npc_willtrade"/>
    <property name="cond30" value="not variable_set npc_hastraded"/>
 
==== Get Party Monster ====
Let's say you want to add a tech to a monster (NPC). Eg. the NPC [[Rockitten]] needs to know [[Canine]], but [[Rockitten]] is the 4th monster (equal to 3rd slot).
 
    <property name="act10" value="add_monster rockitten,20,npc_slug,27,10"/>
    <property name="act20" value="add_monster vivipere,20,npc_slug,27,10"/>
    <property name="act30" value="add_monster budaye,20,npc_slug,27,10"/>
    <property name="act40" value="add_monster rockitten,20,npc_slug,27,10"/>
    <property name="act50" value="add_monster nut,20,npc_slug,27,10"/>
    <property name="act60" value="get_party_monster npc_slug"/>
    <property name="act70" value="add_tech iid_slot_3,canine"/> ---> iid_slot_3 followed by [[Canine]]
    <property name="act80" value="start_battle player,npc_slug"/>
 
==== Battle Among NPCs (the player watches without interacting) ====
(eg npc_maple vs npc_apple)


    <property name="act10" value="create_npc npc_maple,0,7,stand"/>
==== Examples ====  
    <property name="act20" value="create_npc npc_apple,0,8,stand"/>
<code>wait_for_secs 2.0</code>
    <property name="act30" value="add_monster chloragon,3,npc_maple"/>
<code>wait_for_secs 5.2</code>
    <property name="act40" value="add_monster rockitten,3,npc_apple"/>
    <property name="act50" value="start_battle npc_maple,npc_apple"/>
separate event, multiple endings, if npc_maple wins
    <property name="cond1" value="is variable_set battle_last_winner:npc_maple"/>
separate event, multiple endings, if npc_apple wins
    <property name="cond1" value="not variable_set battle_last_winner:npc_maple"/>
separate event, multiple endings, if no-one wins
    <property name="cond1" value="is variable_set battle_last_result:draw"/>

Please note that all contributions to Tuxepedia are considered to be released under the Creative Commons Attribution-ShareAlike (see Tuxepedia:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)