Event Reference

From Tuxepedia
Revision as of 09:54, 14 March 2023 by Jaskrendix (talk | contribs)
Jump to navigation Jump to search

Introduction

This page is a reference for all the available actions and conditions available in Tuxemon. You can use this reference to create new map events for your own maps. All action and condition parameters are separated with a comma (,).

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:

battle_is

Check to see if the player has fought against NPC and won, lost or draw.

Parameters

  • character: Npc slug name (e.g. "npc_maple").
  • result: One among "won", "lost" or "draw".

Examples

  • is battle_is npc_maple,won

button_pressed

Check to see if a particular key has been pressed. E.g. K_RETURN.

Parameters

  • key: A pygame key constant such as K_RETURN. For a list of all possible keys, refer to the Pygame Key Page

Examples

  • is button_pressed K_RETURN
  • is button_pressed K_ESCAPE
  • not button_pressed K_SPACE

combat_started

Check to see if combat has currently started.

Parameters

  • None

Examples

  • is combat_started

dialog_open

Check to see if a dialog window is currently open.

Parameters

  • None

Examples

  • is dialog_open
  • not dialog_open

has_item

Check to see if a NPC inventory contains something.

Parameters

  • character: Either "player" or npc slug name (e.g. "npc_maple").
  • item: The item slug name (e.g. "item_cherry").
  • operator: Numeric comparison operator. Accepted values are "less_than", "greater_than", "equals", "less_or_equal" and "greater_or_equal". (optional)
  • quantity: Quantity to compare with. (optional)

Examples

  • is has_item player,potion
  • is has_item player,potion,greater_than,2

has_monster

Checks to see the player has a monster in his party.

Parameters

  • monster_slug: The slug of the monster to check for.

Examples

  • is has_monster txmn_pigabyte

has_party_breeder

Check to see if the player has a male and female monster in the party (monster not basic, basic is the first step in the evolution stage).

Examples

  • is has_party_breeder

has_tech

Check to see if the player has a technique in his party (one of the monsters).

Parameters

  • technique: Technique slug name (e.g. "bullet").

Examples

  • is has_tech bullet

money_is

Check to see if the player has a certain amount of money (pocket).

Parameters

  • slug: Slug name (player).
  • operator: One of "==", "!=", ">", ">=", "<" or "<=".
  • amount: Amount of money.

Examples

  • is money_is player,>=,500

monster_flair

Check to see if the given monster flair matches the expected value.

Parameters

  • slot: Position of the monster in the player monster list.
  • property: Category of the flair.
  • name: Name of the flair.

Examples

  • to be defined

monster_property

Check to see if a monster property or condition is as asked.

Parameters

  • slot: Position of the monster in the player monster list.
  • property: Property of the monster to check (e.g. "level"). Valid values are: name, level, level_reached, type, category and shape.
  • value: Value to compare the property with.

Examples

  • is monster_property 1,level,15

music_playing

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

Parameters

  • music_file: The music file to check.

Examples

  • is music_playing 472452_8-Bit-Ambient.ogg

npc_at

Check to see if the npc is inside the event's area. This event will check the event object's X, Y, Width, and Height 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 x,y parameter to specify a single tile location.

Parameters

  • name: The name of the NPC.
  • x: X tile coordinates that the player is at (optional)
  • y: Y tile coordinate that the player is at (optional)

Examples

  • is npc_at Maple
  • is npc_at Maple,4,3

npc_exists

Check to see if an NPC exists on the current map with npc_name.

Parameters

  • npc_name: The name of the NPC on the current map.

Examples

  • not npc_exists Apple

npc_facing_tile

Check to see if the npc is facing a particular tile. This event will check the event object's X, Y coordinates for the tile to check for.

Parameters

  • name: The name of the NPC.

Examples

  • is npc_facing_tile Maple

npc_facing

Check to see if the npc is facing: up, down, left or right.

Parameters

  • name: The name of the NPC.
  • direction: Direction to check for: (up, down, left, right)

Examples

  • is npc_facing Maple,up
  • not npc_facing Maple,down

party_size

Perform a check on the player's party size. The check parameter can be: equals, less_than, or greater_than.

Parameters

  • check: The check to run against the party size. Can be: equals, less_than, or greater_than.
  • party_size: The size of the party to check against.

Examples

  • is party_size less_than,1
  • not party_size equals,0
  • is party_size greater_than,4

player_at

Check to see if the player is inside the event's area. This event will check the event object's X, Y, Width, and Height 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 x,y parameter to specify a single tile location.

Parameters

  • x: X tile coordinates that the player is at (optional)
  • y: Y tile coordinate that the player is at (optional)

Examples

  • is player_at
  • is player_at 4,3

player_defeated

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

Parameters

  • None

Examples

  • is player_defeated

player_facing_npc

Check to see if the player is facing an NPC with the name npc_name.

Parameters

  • npc_name: The name of the NPC on the current map.

Examples

  • is player_facing_npc Apple

player_facing_tile

Check to see if the player is facing a particular tile. This event will check the event object's X, Y coordinates for the tile to check for.

Parameters

  • None

Examples

  • is player_facing_tile

player_facing

Check to see where an NPC is facing.

Parameters

  • direction: One of "up", "down", "left" or "right".

Examples

  • is player_facing right

player_moved

Check to see the player has just moved into this tile. Using this condition will prevent a condition like "player_at" from constantly being true every single frame. Check if player destination collides with event, if it collides, wait until destination changes. It become True after collides and destination has changed. These rules ensure that the event is true once player in in the tile and is only true once.

Parameters

  • None

Examples

  • is player_moved

to_talk

Check if we are attempting interact with a map condition tile.

Parameters

  • character: Npc slug name (e.g. "npc_maple").

Examples

  • is to_talk npc_maple

to_use_tile

Check if we are attempting interact with a map condition tile.

Parameters

  • None

Examples

  • is to_use_tile

true

The true condition will always evaluate to *True* (unless the "not" operator is used)

Parameters

  • None

Examples

  • is true
  • not true

tuxepedia_is

Check to see if the player has seen or caught a monster.

Parameters

  • monster_slug: Monster slug name (e.g. "rockitten").
  • string: seen / caught

Examples

  • is tuxepedia_is rockitten,seen

variable_is

Check an operation over a variable.

Parameters

  • value1: Either a variable or a number.
  • operation: One of "==", "!=", ">", ">=", "<" or "<=".
  • value2: Either a variable or a number.

Examples

  • is variable_is [value1],>=,[value2]

variable_set

Check to see if variable_name has been set to value.

Parameters

  • variable_name:value: A key, value pair of the variable to look up and the expected value.

Examples

  • is variable_set battle_won:yes
  • not variable_set current_badges:4
  • is variable_set talked_to_prof:false

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:

add_contacts

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

Parameters

  • slug: slug name (e.g. "npc_maple").
  • phone_number: 3 digits

Examples

  • add_contacts npc_maple,123

add_item

Add the specified item to the player's inventory.

Parameters

  • item_name: The name of the item to add as defined in the monster JSON under resources/db/item.

Examples

  • add_item hatchet

add_monster

Add the specified monster to the player's party.

Parameters

  • monster_slug: Monster slug to look up in the monster database.
  • monster_level: Level of the added monster.
  • trainer_slug: Slug of the trainer that will receive the monster. It defaults to the current player. (optional)
  • exp_mod: Experience modifier. (optional)
  • money_mod: Money modifier. (optional)

Examples

  • add_monster fruitera,10
  • add_monster fruitera,10,npc_maple,10,27

add_tech

Adds a tech to a specific monster.

Parameters

  • monster_id: Id of the monster (name of the variable).
  • technique: Slug of the technique (e.g. "bullet").

Examples

  • add_tech name_variable,bullet

battles_print

Print the current value of battle history to the console. If no variable is specified, print out values of all battles.

Parameters

  • character: Npc slug name (e.g. "npc_maple"). (optional)
  • result: One among "won", "lost" or "draw". (optional)

Examples

  • battles_print
  • battles_print [character,result]

breeding

Select a monster in the player party filtered by gender and store its id in a variables (breeding_father or breeding_mother)

Parameters

  • gender: Gender (male or female).

Examples

  • breeding male
  • breeding female

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.

Parameters

  • event_id: The id of the event whose actions should be executed.

Examples

  • call_event 11
  • call_event 8

change_bg

Change the background. It's advisable end the bg sequence with "end" Eg: act1 change_bg filename act2 change_bg end

Parameters

  • background: the name of the file without ".PNG". The files must be inside the folder (gfx/ui/background/). Ideal size: 240x160

Examples

  • change_bg background

change_state

Change to the specified state.

Parameters

  • state_name: The state name to switch to (e.g. PCState).

Examples

  • change_state PCState

clear_kennel

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.

Parameters

  • kennel: The kennel to clear.
  • transfer: The kennel to transfer the monsters. (optional)

Examples

  • clear_kennel name_kennel, new_kennel

clear_tuxepedia

Clear the key and value in the Tuxepedia dictionary.

Parameters

  • monster_slug: Monster slug name (e.g. "rockitten").

Examples

  • clear_tuxepedia rockitten

clear_variable

Clear the value of a variable from the game.

Parameters  :

  • variable: The variable to clear.

Examples

  • clear_variable name_variable

copy_variable

Copy the value of var2 into var1 (e.g. var1 = var 2).

Parameters  :

  • var1: The variable to copy to.
  • var2: The variable to copy from.

Examples

  • copy_variable new_variable,old_variable

create_npc

Creates an NPC and places them on the current map.

Parameters

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

Examples

  • create_npc Maple,2,3,maple,wander
  • create_npc Pine,1,6,maple,stand

delayed_teleport

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

Parameters

  • map_name: Name of the map to teleport to.
  • position_x: X position to teleport to.
  • position_y: Y position to teleport to.

Examples

  • delayed_teleport cotton_town,10,10

dialog_chain

Deprecated. Use [#dialog dialog]

dialog

Opens the dialog box with provided text. For line breaks, use the \n character. You may also use special variables in dialog events. If you have multiple dialog commands they will display sequentially. Using ${{end}} does nothing as it used to denote the end of a dialog chain. Here is a list of available variables:

  • ${{name}} - The current player's name.

Parameters

  • text: The text to display in a dialog window.

Examples

  • dialog Red:\n This is some dialog!
  • dialog ${{name}}:\n Hello there! \nHow are you?

fadeout_music

Fades out music over x milliseconds.

Parameters

  • time_seconds: Time in milliseconds to fade out the currently playing music.

Examples

  • fadeout_music 2

get_player_monster

Select a monster in the player party and store its id in a variable.

Parameters

  • variable_name: Name of the variable where to store the monster id.

Examples

  • get_player_monster name_variable

kennel_print

Print all the kennels or one. It returns <name, qty, visible/hidden>, where *qty = number of monsters inside.

Parameters

  • kennel: Name of the kennel. (optional)

Examples

  • kennel_print
  • kennel_print name_kennel

lock_controls

Lock player controls.

Parameters

  • None

Examples

  • lock_controls

modify_npc_attribute

Modify the given attribute of the npc by modifier. By default this is achieved via addition, but prepending a '%' will cause it to be multiplied by the attribute.

Parameters

  • npc_slug: Either "player" or npc slug name (e.g. "npc_maple").
  • attribute: Name of the attribute to modify.
  • value: Value of the attribute modifier.

Examples

  • modify_npc_attribute npc_slug,attribute,value

modify_player_attribute

Modify the given attribute of the player character by modifier. By default this is achieved via addition, but prepending a '%' will cause it to be multiplied by the attribute.

Parameters

  • attribute: Name of the attribute to modify.
  • value: Value of the attribute modifier.

Examples

  • modify_player_attribute attribute,value

money_print

Print the current value of money dictionary to the console. If no entity is specified, print out values of all money dictionary.

Parameters

  • slug: Slug name (e.g. player or NPC, etc.). (optional)

Examples

  • money_print
  • money_print player

npc_face

Makes the npc face a particular direction. Parameter can be set to: left, right, up, or down.

Parameters

  • name: The name of the npc.
  • direction: Direction to make the player face. Can be set to: left, right, up, or down.

Examples

  • npc_face Maple,left
  • npc_face Pine,up

npc_move

Determines the NPC's movement behaviour.

Parameters

  • name: The name of the npc.

Examples

  • npc_move spyder_homemakerpapertown, down 1, right 1, up 1, left 1

npc_run

Sets the NPC's speed to the universal run speed.

Parameters

  • name: The name of the npc.

Examples

  • npc_run npc_mom

npc_speed

Sets the NPC's walk speed.

Parameters

  • name: The name of the npc.

Examples

  • npc_speed npc_mom, 0.2

npc_walk

Sets the NPC's speed to the universal walk speed.

Parameters

  • name: The name of the npc.

Examples

  • npc_walk npc_mom

npc_wander

Sets the NPC's behaviour to wander about instead of stand in place.

Parameters

  • name: The name of the npc.

Examples

  • npc_wander npc_mom

open_shop

Open the shop menu for a NPC.

Parameters

  • npc_slug: Either "player" or npc slug name (e.g. "npc_maple").
  • menu: Either "buy", "sell" or "both". Default is "both". (optional)

Examples

  • open_shop npc_maple

pathfind

Moves an NPC to a certain tile on the map.

Parameters

  • name: The name of the NPC to be moved.
  • tile_pos_x: The X-tile coordinate to have the NPC to walk to.
  • tile_pos_y: The Y-tile coordinate to have the NPC to walk to.

Examples

  • pathfind Maple,2,3
  • pathfind Pine,1,6

pause_music

Pauses the currently playing music.

Parameters

  • None

Examples

  • pause_music

play_map_animation

Plays an animation on the map. The position parameter can also be player if you want to draw the animation at the player's location. Loop can be either loop or noloop.

Parameters

  • animation_name: The name of the animation to play under resources/animations/tileset.
  • duration: The amount of time in seconds between each frame.
  • loop: Whether or not to loop the animation. Can be either loop or noloop to loop the animation.
  • position: The position to draw the animation. Can either be an x,y coordinate or player to draw the animation over the player.

Examples

  • play_map_animation grass,0.1,noloop,player
  • play_map_animation sign01,0.4,loop,33,10

play_music

Plays an audio file located under "music/" on a loop.

Parameters

  • filename: The name of the music file to play under "music/"

Examples

  • play_music 472452_8-Bit-Ambient.ogg

play_sound

Plays an audio file located under "sounds/".

Parameters

  • filename: The name of the sound file to play under "sounds/"

Examples

  • play_sound combat/falling_Macro.ogg

player_face

Makes the player face a particular direction. Parameter can be set to: left, right, up, or down.

Parameters

  • direction: Direction to make the player face. Can be set to: left, right, up, or down.

Examples

  • player_face left
  • player_face up

player_sprite

Check the player's sprite

Parameters

  • sprite: slug of the sprite

Examples

  • is player_sprite adventurer

player_stop

Stops the player's current movement. There is currently no way to stop a player from inputting another movement after being stopped (issue #790)

Parameters

  • None

Examples

  • player_stop

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 :

  • variable: Prints out the value of this variable (optional)

Examples

  • print
  • print name_variable

quit

Completely quit the game.

Parameters

  • None

Examples

  • quit

random_battle

Start random battle with a random npc with a determined number of monster in a certain range of levels.

Parameters

  • nr_txmns: Number of tuxemon (1 to 6).
  • min_level: Minimum level of the party.
  • max_level: Maximum level of the party.

Examples

  • random_battle 6,1,99

random_encounter

Randomly start a battle based on the encounter group looked up via the encounter_id. 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 player_at and player_moved conditions.

Here is an example encounter file:

resources/db/encounter/1.json

   json
   {
   "id": 1, 
   "monsters": [
       {
           "monster_slug": "bigfin", 
           "encounter_rate": 10, 
           "level_range": [
               1, 
               6
           ]
       },
       {
           "monster_slug": "dandylion", 
           "encounter_rate": 10, 
           "level_range": [
               1, 
               6
           ]
       },
       {
           "monster_slug": "tux", 
           "encounter_rate": 10, 
           "level_range": [
               1, 
               6
           ]
       }
   ]
   }

Parameters

  • encounter_id: The id of the encounter JSON file to use for random battles under resources/db/encounter.
  • total_prob: The probability of an encounter, with 100 = 100% probability of an encounter. If not set, then the probability of an encounter is the sum of all encounter_rates in the encounter JSON file (as a percentage).

Examples

  • random_encounter route1
  • random_encounter route1,20

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

  • variable: Name of the variable.
  • lower_bound: Lower bound of range to return an integer between (inclusive)
  • upper_bound: Upper bound of range to return an integer between (inclusive)

Examples

  • random_integer name_variable,1,9

random_monster

Add a random monster to the specified trainer's party.

Parameters

  • monster_level: Level of the added monster.
  • trainer_slug: Slug of the trainer that will receive the monster. It defaults to the current player. (optional)
  • exp_mod: Experience modifier. (optional)
  • money_mod: Money modifier. (optional)

Examples

  • random_monster 10
  • random_monster 10,npc_maple
  • random_monster 10,npc_maple,10,27

remove_contacts

Remove contact from the app (Nu Phone).

Parameters :

  • slug: slug name (e.g. "npc_maple").

Examples

  • remove_contacts npc_maple

remove_monster

Removes the specified monster from the player's party.

Parameters

  • monster_slug: The slug of the monster to remove as defined in the monster JSON under resources/db/monster.

Examples

  • remove_monster fruitera

remove_npc

Removes an NPC from the current map.

Parameters

  • name: The name of the NPC to remove.

Examples

  • remove_npc Maple
  • remove_npc Pine

rename_monster

Open the monster menu and text input screens to rename a selected monster.

Parameters

  • None

Examples

  • rename_monster

rename_player

Open the text input screen to rename the player.

Parameters

  • None

Examples

  • rename_player

rumble

Rumble available controllers with rumble support.

Parameters

  • duration: Time in seconds to rumble for.
  • power: Percentage of power to rumble.

Examples

  • rumble duration,power

screen_transition

Fades the screen to black and back over x seconds.

Parameters

  • transition_time: Time in seconds to fade the screen to black.

Examples

  • screen_transition 2

set_battle

Set the key in the player.battle_history dictionary.

Parameters

  • character: Npc slug name (e.g. "npc_maple").
  • result: One among "won", "lost" or "draw"

Examples

  • set_battle npc_maple,won

set_code

Set a code and checks if it's correct or not. Case Sensitive: ATTENTION and AtTenTION are two different words.

Parameters

  • question: 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?"
  • answer: The right answer to the question.
  • variable: Where the result (right/wrong) is saved.

Examples

  • set_code access_code,joke,name_variable

set_economy

Set the economy (prices of items) of the npc or player.

Parameters

  • npc_slug: Either "player" or npc slug name (e.g. "npc_maple").
  • economy_slug: Slug of an economy.

Examples

  • set_economy spyder_shopkeeper,spyder_candy_scoop

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

  • kennel: Name of the kennel.
  • visible: true/false.

Examples

  • set_kennel_visible name_kennel,true
  • set_kennel_visible name_kennel,false

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

  • kennel: Name of the kennel.
  • visible: true/false.

Examples

  • set_kennel new_kennel,true

set_money

Set the key and value in the money dictionary. It'll reset the previous amount.

Parameters

  • slug: Slug name (e.g. player or NPC, etc.).
  • amount: Amount of money

Examples

  • set_money player,500

set_monster_flair

Set a monster's flair to the given value.

Parameters

  • slot: Slot of the monster in the party.
  • category: Category of the monster flair.
  • flair: Name of the monster flair.

Examples

  • set_monster_flair 1,category,flair

set_monster_health

Changes 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

  • slot: The slot the monster appears in. If no slot is specified, all monsters are healed.
  • health: A float value between 0 and 1, which is the percent of max hp to be restored to. If no health is specified, the hp is maxed out.

Examples

  • set_monster_health 1,1

set_monster_level

Changes the level of a monster in the current player's party.

Parameters

  • slot: The slot the monster appears in. If no slot is specified, all monsters are leveled.
  • level: The amount by which to level. If no level is specified, the level is reverted to 1.

Examples

  • set_monster_level 1,100

set_monster_level

Change the level of a monster in the current player's party.

Parameters

  • level: Number of levels to add. Negative numbers are allowed.
  • slot: Slot of the monster in the party. If no slot is specified, all monsters are leveled. (optional)

Examples

  • set_monster_status 5,1

set_monster_status

Change the status of a monster in the current player's party.

Parameters

  • slot: Slot of the monster in the party. If no slot is specified, all monsters are modified. (optional)
  • status: Status to set. If no status is specified, the status is cleared.

Examples

  • set_monster_status 1,status_blinded

set_npc_attribute

Set the given attribute of the npc to the given value.

Parameters

  • npc_slug: Either "player" or npc slug name (e.g. "npc_maple").
  • attribute: Name of the attribute.
  • value: Value of the attribute.

Examples

  • set_player_attribute npc_maple,attribute,value

set_player_attribute

Set the given attribute of the player character to the given value.

Parameters

  • attribute: Name of the attribute.
  • value: Value of the attribute.

Examples

  • set_player_attribute attribute,value

set_player_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

  • sprite: must be inside mods/tuxemon/sprites, eg: adventurer_brown_back.png -> adventurer
  • combat_front: must be inside mods/tuxemon/gfx/sprites/player, eg: adventurer.png -> adventurer (optional)

Examples

  • set_player_template adventurer,adventurer

set_tuxepedia

Set the key and value in the Tuxepedia dictionary.

Parameters

  • monster_slug: Monster slug name (e.g. "rockitten").
  • string: seen / caught

Examples

  • set_tuxepedia rockitten,caught

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

Parameters

  • variable_name:value: A key, value pair of the variable_name to set with value.

Examples

  • set_variable battle_won:yes
  • set_variable talked_to_prof:true
  • set_variable environment:grass

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

  • npc_slug: Either "player" or npc slug name (e.g. "npc_maple").

Examples

  • spawn_monster

start_battle

Start a battle with an NPC defined in resources/db/npc.

Here is an example NPC file:

resources/db/npc/maple.json

   json
   {
   "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"
   }

Parameters

  • npc_slug: The NPC's slug as defined in the NPC's JSON file in resources/db/npc.

Examples

  • start_battle npc_maple

start_cinema_mode

Start cinema mode by animating black bars to narrow the aspect ratio.

Parameters

  • None

Examples

  • start_cinema_mode

stop_cinema_mode

Stop cinema mode by animating black bars back to the normal aspect ratio.

Parameters

  • None

Examples

  • stop_cinema_mode

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

  • monster_id: Id of the monster to store.
  • box: An existing box where the monster will be stored. (optional)

Examples

  • store_monster name_variable
  • store_monster name_variable,name_kennel

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

  • None

Examples

  • teleport_faint

teleport

Teleports the player to a given position on a map. This teleport is immediate and does not have any transition animation.

Parameters

  • map_name: The map file to teleport the player to.
  • x: The X-tile coordinate to teleport the player to.
  • y: The Y-tile coordinate to teleport the player to.

Examples

  • teleport map1.tmx,3,4
  • teleport room1.tmx,8,1

transfer_money

Performs a mathematical transaction on the player's money.

Parameters

  • transaction: Operator symbol.
  • amount: Amount of money.
  • slug: Slug name (e.g. NPC, etc.) (optional)

Examples

  • transfer_money +,100,npc_mom (player gets 100 from mom)
  • transfer_money -,100,npc_mom (mom gets 100 from player)
  • transfer_money +,100 (player gets 100)

transition_teleport

Teleports the player to a given position on a map with a screen transition over x seconds.

Parameters

  • map_name: The map file to teleport the player to.
  • x: The X-tile coordinate to teleport the player to.
  • y: The Y-tile coordinate to teleport the player to.
  • transition_time: The time in seconds the transition will last.

Examples

  • teleport map2.tmx,1,6,1.5
  • teleport room1.tmx,8,1,4

translated_dialog_chain

Deprecated. Use [#translated_dialog translated_dialog]

translated_dialog_choice

Asks the player to select a choice. The translations for the text are looked up based on a given key.

Parameters

  • choice_keys: Keys to reference translated text choices separated by colons.
  • variable: The variable to store the answer which will be the key for the translated text.

Examples

  • translated_dialog_choice yes:no,myvariable

translated_dialog

Opens the dialog box with translated text for a given key found in resources/db/locale/<locale>.json. Optional variable replacement will also be translated if the value is a key in the locale file. For line breaks, use the \n character. If you have multiple translated_dialog commands they will display sequentially. Using ${{end}} 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:

  • ${{name}} - The current player's name.

Parameters

  • dialog_key: The translated text for a given key found in resources/db/locale/<locale>.json to display in a dialog window.
  • parameters: Optional comma-separated var=value parameters to replace variables in the translation text. The value can either be text or a key found in resources/db/locale/<locale>.json.

Examples

  • translated_dialog received_x,name=a brand new car!
  • translated_dialog received_x,name=item_potion
  • translated_dialog combat_fainted,name=${{name}}
  • translated_dialog combat_opponent_call_tuxemon,user=${{name}},name=some guy

tuxepedia_print

Print the current value of Tuxepedia to the console. If no monster is specified, print out values of all Tuxepedia.

Parameters

  • monster_slug: Monster slug name (e.g. "rockitten").

Examples

  • tuxepedia_print
  • tuxepedia_print rockitten

unlock_controls

Unlock player controls

Parameters

  • None

Examples

  • unlock_controls

variable_math

Performs a mathematical operation on the key in the player.game_variables dictionary.

Parameters

  • variable_name
  • operation: +, -, * or /
  • value

Examples

  • variable_math badge_count,+,1

wait

Pauses execution of all events for the given amount of time in seconds.

Parameters

  • seconds: The amount of time in seconds to wait for.

Examples

  • wait 2.0
  • wait 5.2

withdraw_monster

Pull a monster from the given trainer's storage and puts it in their party.

Parameters

  • monster_id: The id of the monster to pull (variable).
  • trainer: Slug of the trainer that will receive the monster. It defaults to the current player.

Examples

  • withdraw_monster monster_id[,trainer_slug]

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: is variable_set name_variable:result_variable

Battle related

  • battle_last_result: the result can be won, draw, lost or ran.

other variables include:

  • battle_last_monster_name name of the last monster fought.
  • battle_last_monster_level level of the last monster fought.
  • battle_last_monster_type type of the last monster fought.
  • battle_last_monster_category category of the last monster fought.
  • battle_last_monster_shape shape of the last monster fought.
  • battle_last_trainer slug of the last trainer fought (it applies only to trainer battles).

World related

  • hour the result is the current hour.
  • day_of_year the result can be from 1 to 365/366.
  • year the results is the current year.
  • leap_year the result can be true or false
  • daytime the result can be true or false (true between from 06:00 to 18:00, false during the rest of the day).
  • stage_of_day the result can be dawn (from 4 to 8), morning (from 8 to 12), afternoon (from 12 to 16), dusk (from 16 to 20) or night (from 20 to 04).
  • season the result can be winter, spring, summer or autumn

Campaign related

  • steps the results shows the number of the steps.
  • gender_choice the result can be gender_male or gender_female, depending on the player's choice at the beginning. Useful to create different events for gender.

Party related (monsters)

  • party_level_lowest the result shows the lowest level in the player's party (weakest monster).
  • party_level_highest the result shows the highest level in the player's party (strongest monster).
  • party_level_average the result shows the average level in the player's party.

Examples

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

  • is variable_set day_of_year:146
  • is variable_set leap_year:true

or

  • is variable_set day_of_year:145
  • is variable_set leap_year:false

but if the specific date is before (included) the 28th February (day nr 59):

  • is variable_set day_of_year:59

Stage of the day

Let's say you want to block the access during the night:

  • not variable_set stage_of_day:night

while if you want to grand the access only during the night:

  • is variable_set stage_of_day:night

Season

Let's say you want to grant access to a location only in summer:

  • is variable_set season:summer