Event Reference Condition
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[edit | edit source]
Check to see if a character has fought against another one and won, lost or draw.
Parameters
fighter
: Npc slug name (e.g. "npc_maple").outcome
: One among "won", "lost" or "draw".opponent
: Npc slug name (e.g. "npc_maple").
Examples
is battle_is player,won,npc_maple
(has player won against npc_maple in the last fight?)
button_pressed[edit | edit source]
Check to see if a particular key has been pressed. E.g. K_RETURN
.
Parameters
key
: A pygame key constant such asK_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
char_at[edit | edit source]
Check to see if the character is at the condition position on the map.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").
Examples
is char_at Maple
char_defeated[edit | edit source]
Check to see the character has at least one tuxemon, and all tuxemon in their party are defeated.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").
Examples
is char_defeated player
char_exists[edit | edit source]
Check to see if a character object exists in the current list of NPCs.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").
Examples
not char_exists npc_maple
char_facing[edit | edit source]
Check to see where a character is facing.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").direction
: One of "up", "down", "left" or "right".
Examples
is char_facing npc_maple,up
not char_facing npc_maple,down
char_facing_char[edit | edit source]
Check to see the character is next to and facing a particular character.
Parameters
character1
: Either "player" or npc slug name (e.g. "npc_maple").character2
: Either "player" or npc slug name (e.g. "npc_maple").
Examples
is char_facing_char npc_maple,player
char_facing_tile[edit | edit source]
Check to see if a character is facing a tile position.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").
Examples
is char_facing_tile npc_maple
char_in[edit | edit source]
Check to see if the character is at the condition position on a specific set of tiles.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").value
: value (eg surfable) inside the tileset.
Examples
is char_in npc_maple,surfable
char_moved[edit | edit source]
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.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").
Examples
is char_moved player
char_position[edit | edit source]
Check to see if the character is at the position on the map.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").character
: X position to set the character to.tile_pos_x
: Y position to set the character to.
Examples
is char_position player,6,9
char_sprite[edit | edit source]
Check the character's sprite
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").sprite
: NPC's sprite (eg maniac, florist, etc.)
Examples
is char_sprite player,adventurer
check_char_parameter[edit | edit source]
Check the parameter's value of the character against a given value.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").parameter
: Name of the parameter to check (eg. "name", "steps", etc.).value
: Given value to check.
Examples
is check_char_parameter player,name,alpha
check_evolution[edit | edit source]
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 evolution
.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").
Examples
is check_evolution player
check_max_tech[edit | edit source]
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.
Parameters
nr
: Number of tech, default the constant
Examples
is check_max_tech
is check_max_tech 2
check_mission[edit | edit source]
Check to see the player has failed or completed a mission. Check to see if a mission is still pending.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").method
: Mission or missions, "all" means all the existing missions.staths
: pending, completed or failed
Examples
is check_mission player,mission1,completed
is check_mission player,mission1,pending
is check_mission player,mission1:mission2,completed
is check_mission player,all,completed
check_party_parameter[edit | edit source]
Check to see the player has failed or completed a mission. Check to see if a mission is still pending.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").attribute
: Name of the monster attribute to check (e.g. level).value
: Value to check (related to the attribute) (e.g. 5 - level).operator
: Numeric comparison operator. Accepted values are "less_than", "less_or_equal", "greater_than", "greater_or_equal", "equals" and "not_equals".times
: Value to check with operator (how many times in the party?).
Examples
check_party_parameter player,level,5,equals,1
(is there 1 monster in the party at level 5? True/False)
check_world[edit | edit source]
Check some world's parameter against a given value.
Parameters
parameter
: Name of the parameter to check (eg. "layer", etc.).value
: Given value to check.
Supported parameters
- layer: color value which is used to overlay the world
- bubble: speech bubble of an npc
Examples
is check_world
is check_world layer,255:255:255:0
current_state[edit | edit source]
Check to see if one or multiple state/states has/have been started or not.
Parameters
state
: Either "CombatState", "DialogState", etc
Examples
is current_state DialogState
is current_state CombatState:DialogState
has_bag[edit | edit source]
Check to see how many items are in the character's bag. It doesn't count invisible items.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").operator
: Numeric comparison operator. Accepted values areless_than
,less_or_equal
,greater_than
,greater_or_equal
,equals
andnot_equals
.value
: The value to compare the bag with.
Examples
is has_bag player,equals,5
(player's bag: 5 potions and 2 tuxeball (5 items), in this case is true because 5 = 5)is has_bag player,equals,9
(player's bag: 5 potions and 2 tuxeball (5 items), in this case is false because 9 != 5)
has_item[edit | edit source]
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 areless_than
,less_or_equal
,greater_than
,greater_or_equal
,equals
andnot_equals
.quantity
: Quantity to compare with. (optional)
Examples
is has_item player,potion
is has_item player,potion,greater_than,2
has_kennel[edit | edit source]
Check to see how many monsters are in the character's box.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").operator
: Numeric comparison operator. Accepted values areless_than
,less_or_equal
,greater_than
,greater_or_equal
,equals
andnot_equals
.value
: The value to compare the party with.box
: The box name.
Examples
is has_kennel player,Kennel,less_than,1
has_monster[edit | edit source]
Check to see if a character has a monster in its party.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").monster_slug
: Monster slug name (e.g. "rockitten").
Examples
is has_monster player,rockitten
has_party_breeder[edit | edit source]
Check to see if the character has a male and female monsters not basic (first evolution stage) in the party.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").
Examples
is has_party_breeder player
has_tech[edit | edit source]
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
kennel[edit | edit source]
Check if a kennel is hidden or visible.
Note: This condition checks if the kennel is in the HIDDEN_LIST. If the kennel is in the list, it is considered hidden; otherwise, it is considered visible.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").kennel
: The name of the kennel to check.option
: The expected visibility of the kennel ("hidden" or "visible") or existence of it ("exist").
Examples
is kennel player,Kennel,hidden
is kennel player,Kennel,visible
is kennel player,Kennel,exist
location_inside[edit | edit source]
Check to see if the player is inside.
Examples
is location_inside
location_name[edit | edit source]
Check to see if the player is in a certain location name.
Parameters
technique
: Slug name. It's the name inside the maps. eg.<property name="slug" value="routeb"/>
, so slug = routeb
Examples
is location_name routeb
is location_name routea:routeb
location_type[edit | edit source]
Check to see if the player is in a certain location type.
Parameters
slug
: Slug name. Either all, notype, town, route, clinic, shop, dungeon
Examples
is location_type town
is location_type town:shop:clinic
money_is[edit | edit source]
Check to see if the player has a certain amount of money (pocket).
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").operator
: Numeric comparison operator. Accepted values are "less_than", "less_or_equal", "greater_than", "greater_or_equal", "equals" and "not_equals".amount
: Amount of money or value stored in variable.
Examples
is money_is player,>=,500
is money_is player,equals,name_variable
(name_variable:75)
monster_flair[edit | edit source]
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
music_playing[edit | edit source]
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
once[edit | edit source]
Checks the date saved in the variables with today's date.
Parameters
timeframe
: nr of days the event stays "blocked" (eg. 1, 7, etc.)variable
: Variable where the date is stored.
Examples
set_variable variable_name:today
is once 1,variable_name
(it blocks the event for 1 day)
or
is once 7,variable_name
(it blocks the event for 7 days - 1 week)
one_of[edit | edit source]
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
variable
: The variable to check.values
: Value to check for (multiple values separated by ":").
Examples
is one_of stage_of_day,afternoon:dusk:morning
party_infected[edit | edit source]
Check to see how many monster are infected in the character's party.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").plague_slug
: The slug of the plague to target.value
: all, some or none.
Examples
is party_infected plague_slug,some
party_size[edit | edit source]
Check the character's party size. The check
parameter can be: equals
, less_than
, or greater_than
.
Parameters
character
: Either "player" or npc slug name (e.g. "npc_maple").operator
: Numeric comparison operator. Accepted values areless_than
,less_or_equal
,greater_than
,greater_or_equal
,equals
andnot_equals
.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
to_use_tile[edit | edit source]
Check if we are attempting interact with a map condition tile.
Parameters
None
Examples
is to_use_tile
true[edit | edit source]
The true
condition will always evaluate to *True* (unless the "not" operator is used)
Parameters
None
Examples
is true
not true
tuxepedia[edit | edit source]
Check Tuxepedia's progress.
Parameters
operator
: Numeric comparison operator. Accepted values are "less_than", "less_or_equal", "greater_than", "greater_or_equal", "equals" and "not_equals".percentage
: Number between 0.1 and 1.0total
: Total, by default the total number of tuxemon.
Examples
is tuxepedia less_than,0.2
is tuxepedia less_than,0.2,10
variable_is[edit | edit source]
Check an operation over a variable.
Parameters
value1
: Either a variable or a number.operation
: Numeric comparison operator. Accepted values are "less_than", "less_or_equal", "greater_than", "greater_or_equal", "equals" and "not_equals".value2
: Either a variable or a number.
Examples
is variable_is [value1],operator,[value2]
variable_set[edit | edit source]
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