|
|
(183 intermediate revisions by 2 users not shown) |
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 method under the '''core.components.event.condition''' module:
| | [[Event Reference Condition]] |
| | |
| === 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>
| |
| | |
| === player_at ===
| |
| 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'''
| |
| * <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'''
| |
| * <code>is player_at</code>
| |
| * <code>is player_at 4,3</code>
| |
| | |
| === player_facing ===
| |
| Check to see if the player is facing: <code>up</code>, <code>down</code>, <code>left</code> or <code>right</code>.
| |
| | |
| '''Parameters'''
| |
| * <code>direction</code>: Direction to check for: (<code>up</code>, <code>down</code>, <code>left</code>, <code>right</code>)
| |
| | |
| '''Examples'''
| |
| * <code>is player_facing up</code>
| |
| * <code>not player_facing down</code>
| |
| | |
| === player_facing_tile ===
| |
| 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.
| |
| | |
| '''Parameters'''
| |
| * <code>None</code>
| |
| | |
| '''Examples'''
| |
| * <code>is player_facing_tile</code>
| |
| | |
| === player_moved ===
| |
| Checks to see if the player has just moved. If the player is standing still, this condition will return <code>False</code>.
| |
| | |
| '''Parameters'''
| |
| * <code>None</code>
| |
| | |
| '''Examples'''
| |
| * <code>is player_moved</code>
| |
| * <code>not player_moved</code>
| |
| | |
| === has_monster ===
| |
| Checks to see the player is has a monster in his party.
| |
| | |
| '''Parameters'''
| |
| * <code>monster_slug</code>: The slug of the monster to check for.
| |
| | |
| '''Examples'''
| |
| * <code>is has_monster txmn_pigabyte</code>
| |
| | |
| === has_item ===
| |
| | |
| '''Parameters'''
| |
| * <code>item</code>: The item name to check for.
| |
| * <code>operator</code>: Greater than, less than, etc (optional).
| |
| * <code>quantity</code>: The quantity to check for (optional).
| |
| | |
| '''Examples'''
| |
| * <code>has_item player,hatchet,>=,1</code>
| |
| * <code>has_item player,hatchet</code>
| |
| | |
| === combat_started ===
| |
| Check to see if combat has currently started.
| |
| | |
| '''Parameters'''
| |
| * <code>None</code>
| |
| | |
| '''Examples'''
| |
| * <code>is combat_started</code>
| |
| | |
| === button_pressed ===
| |
| Check to see if a particular key has been pressed. E.g. <code>K_RETURN</code>.
| |
| | |
| '''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]
| |
| | |
| '''Examples'''
| |
| * <code>is button_pressed K_RETURN</code>
| |
| * <code>is button_pressed K_ESCAPE</code>
| |
| * <code>not button_pressed K_SPACE</code>
| |
| | |
| === dialog_open ===
| |
| Check to see if a dialog window is currently open.
| |
| | |
| '''Parameters'''
| |
| * <code>None</code>
| |
| | |
| '''Examples'''
| |
| * <code>is dialog_open</code>
| |
| * <code>not dialog_open</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>
| |
| | |
| === npc_exists ===
| |
| Check to see if an NPC exists on the current map with <code>npc_name</code>.
| |
| | |
| '''Parameters'''
| |
| * <code>npc_name</code>: The name of the NPC on the current map.
| |
| | |
| '''Examples'''
| |
| * <code>not npc_exists Apple</code>
| |
| | |
| === npc_at ===
| |
| 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.
| |
| | |
| '''Parameters'''
| |
| * <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)
| |
| | |
| '''Examples'''
| |
| * <code>is npc_at Maple</code>
| |
| * <code>is npc_at Maple,4,3</code>
| |
| | |
| === npc_facing ===
| |
| Check to see if the npc is facing: <code>up</code>, <code>down</code>, <code>left</code> or <code>right</code>.
| |
| | |
| '''Parameters'''
| |
| * <code>name</code>: The name of the NPC.
| |
| * <code>direction</code>: Direction to check for: (<code>up</code>, <code>down</code>, <code>left</code>, <code>right</code>)
| |
| | |
| '''Examples'''
| |
| * <code>is npc_facing Maple,up</code>
| |
| * <code>not npc_facing Maple,down</code>
| |
| | |
| === npc_facing_tile ===
| |
| 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.
| |
| | |
| '''Parameters'''
| |
| * <code>name</code>: The name of the NPC.
| |
| | |
| '''Examples'''
| |
| * <code>is npc_facing_tile Maple</code>
| |
| | |
| === facing_npc ===
| |
| Check to see if the player is facing an NPC with the name <code>npc_name</code>.
| |
| | |
| '''Parameters'''
| |
| * <code>npc_name</code>: The name of the NPC on the current map.
| |
| | |
| '''Examples'''
| |
| * <code>is facing_npc Apple</code>
| |
| | |
| === party_size ===
| |
| 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>.
| |
| | |
| '''Parameters'''
| |
| * <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>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>
| |
| | |
| === music_playing ===
| |
| Check to see if the specified music file is currently playing.
| |
| | |
| '''Parameters'''
| |
| * <code>music_file</code>: The music file to check.
| |
| | |
| '''Examples'''
| |
| * <code>is music_playing 472452_8-Bit-Ambient.ogg</code>
| |
|
| |
|
| == Action Reference == | | == Action Reference == |
|
| |
|
| 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:
| | [[Event Reference Action]] |
| | |
| === npc_move ===
| |
| Determines the NPC's movement behaviour.
| |
| | |
| '''Examples'''
| |
| * <code>npc_move spyder_homemakerpapertown, down 1, right 1, up 1, left 1</code>
| |
| | |
| === npc_speed ===
| |
| Sets the NPC's walk speed.
| |
| | |
| '''Examples'''
| |
| * <code>npc_speed npc_mom, 0.2</code>
| |
| | |
| === npc_run ===
| |
| Sets the NPC's speed to the universal run speed.
| |
| | |
| '''Examples'''
| |
| * <code>npc_run npc_mom</code>
| |
| | |
| === npc_walk ===
| |
| Sets the NPC's speed to the universal walk speed.
| |
| | |
| '''Examples'''
| |
| * <code>npc_walk npc_mom</code>
| |
| | |
| === npc_wander ===
| |
| Sets the NPC's behaviour to wander about instead of stand in place.
| |
| | |
| '''Examples'''
| |
| * <code>npc_wander npc_mom</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>
| |
| | |
| === 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>transition_time</code>: The time in seconds the transition will last.
| |
| | |
| '''Examples'''
| |
| * <code>teleport map2.tmx,1,6,1.5</code>
| |
| * <code>teleport room1.tmx,8,1,4</code>
| |
| | |
| === 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'''
| |
| * <code>event_id</code>: The id of the event whose actions should be executed.
| |
| | |
| '''Examples'''
| |
| * <code>call_event 11</code>
| |
| * <code>call_event 8</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.
| |
| | |
| '''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>
| |
| | |
| === play_sound ===
| |
| Plays an audio file located under "sounds/".
| |
| | |
| '''Parameters'''
| |
| * <code>filename</code>: The name of the sound file to play under "sounds/"
| |
| | |
| '''Examples'''
| |
| * <code>play_sound combat/falling_Macro.ogg</code>
| |
| | |
| === play_music ===
| |
| Plays an audio file located under "music/" on a loop.
| |
| | |
| '''Parameters'''
| |
| * <code>filename</code>: The name of the music file to play under "music/"
| |
| | |
| '''Examples'''
| |
| * <code>play_music 472452_8-Bit-Ambient.ogg</code>
| |
| | |
| === player_face ===
| |
| 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'''
| |
| * <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>.
| |
| | |
| '''Examples'''
| |
| * <code>player_face left</code>
| |
| * <code>player_face up</code>
| |
| | |
| === player_stop ===
| |
| Stops the player's current movement.
| |
| | |
| There is currently no way to stop a player from inputting another movement after being stopped ([https://github.com/Tuxemon/Tuxemon/issues/790 issue #790])
| |
| | |
| '''Parameters'''
| |
| * <code>None</code>
| |
| | |
| '''Examples'''
| |
| * <code>player_stop</code>
| |
| | |
| === player_resume ===
| |
| Does not currently have a purpose.
| |
| | |
| '''Parameters'''
| |
| * <code>None</code>
| |
| | |
| '''Examples'''
| |
| * <code>player_resume</code>
| |
| | |
| === pause_music ===
| |
| Pauses the currently playing music.
| |
| | |
| '''Parameters'''
| |
| * <code>None</code>
| |
| | |
| '''Examples'''
| |
| * <code>pause_music</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>
| |
| | |
| === dialog ===
| |
| 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>$<nowiki>{{</nowiki>end<nowiki>}}</nowiki></code> does nothing as it used to denote the end of a dialog chain. Here is a list of available variables:
| |
|
| |
| * <code>$<nowiki>{{</nowiki>name<nowiki>}}</nowiki></code> - The current player's name.
| |
| | |
| '''Parameters'''
| |
| * <code>text</code>: The text to display in a dialog window.
| |
| | |
| '''Examples'''
| |
| * <code>dialog Red:\n This is some dialog!</code>
| |
| * <code>dialog $<nowiki>{{</nowiki>name<nowiki>}}</nowiki>:\n Hello there! \nHow are you?</code>
| |
| | |
| === translated_dialog ===
| |
| 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>$<nowiki>{{</nowiki>end<nowiki>}}</nowiki></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>$<nowiki>{{</nowiki>name<nowiki>}}</nowiki></code> - The current player's name.
| |
| | |
| '''Parameters'''
| |
| * <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>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'''
| |
| * <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=$<nowiki>{{</nowiki>name<nowiki>}}</nowiki></code>
| |
| * <code>translated_dialog combat_opponent_call_tuxemon,user=$<nowiki>{{</nowiki>name<nowiki>}}</nowiki>,name=some guy</code>
| |
| | |
| === dialog_chain ===
| |
| Deprecated. Use [#dialog dialog]
| |
| | |
| === translated_dialog_chain ===
| |
| Deprecated. Use [#translated_dialog translated_dialog]
| |
| | |
| === dialog_choice ===
| |
| Asks the player to select a choice.
| |
| | |
| '''Parameters'''
| |
| * <code>choices</code>: The possible choices separated by colons.
| |
| * <code>variable</code>: The variable to store the answer.
| |
| | |
| '''Examples'''
| |
| * <code>dialog_choice Yes:No:Maybe,myvariable</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>dialog_choice yes:no,myvariable</code>
| |
| | |
| === screen_transition ===
| |
| Fades the screen to black and back over <code>x</code> seconds.
| |
| | |
| '''Parameters'''
| |
| * <code>transition_time</code>: Time in seconds to fade the screen to black.
| |
| | |
| '''Examples'''
| |
| * <code>screen_transition 2</code>
| |
| | |
| === create_npc ===
| |
| Creates an NPC and places them on the current map.
| |
| | |
| '''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>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>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'''
| |
| * <code>create_npc Maple,2,3,maple,wander</code>
| |
| * <code>create_npc Pine,1,6,maple,stand</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>
| |
| | |
| === 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>.
| |
| | |
| '''Parameters'''
| |
| * <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>.
| |
| | |
| '''Examples'''
| |
| * <code>npc_face Maple,left</code>
| |
| * <code>npc_face Pine,up</code>
| |
| | |
| === pathfind ===
| |
| Moves an NPC to a certain tile on the map.
| |
| | |
| '''Parameters'''
| |
| * <code>name</code>: The name of the NPC to be moved.
| |
| * <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.
| |
| | |
| '''Examples'''
| |
| * <code>pathfind Maple,2,3</code>
| |
| * <code>pathfind Pine,1,6</code>
| |
| | |
| === start_battle ===
| |
| Start a battle with an NPC defined in <code>resources/db/npc</code>.
| |
| | |
| 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'''
| |
| * <code>npc_slug</code>: The NPC's slug as defined in the NPC's JSON file in <code>resources/db/npc</code>.
| |
| | |
| '''Examples'''
| |
| * <code>start_battle npc_maple</code>
| |
| | |
| === add_item ===
| |
| Add the specified itemto the player's party.
| |
| | |
| '''Parameters'''
| |
| * <code>item_name</code>: The name of the item to add as defined in the monster JSON under <code>resources/db/item</code>.
| |
| | |
| '''Examples'''
| |
| * <code>add_item hatchet</code>
| |
|
| |
|
| === add_monster === | | == Variables == |
| Add the specified monster to the player's party.
| |
|
| |
|
| '''Parameters'''
| | The following are the "main" variables generated by the game and these can be useful to trigger specific events. |
| * <code>monster_name</code>: The name of the monster to add as defined in the monster JSON under <code>resources/db/monster</code>.
| |
| * <code>monster_lvl</code>: The level of the monster to start at.
| |
|
| |
|
| '''Examples'''
| | These can be used with the condition: |
| * <code>add_monster fruitera,10</code>
| | <code>is variable_set name_variable:result_variable</code> |
|
| |
|
| === remove_monster === | | === Battle related === |
| Removes the specified monster from the player's party.
| | * <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. |
|
| |
|
| '''Parameters'''
| | trainer battles: |
| * <code>monster_slug</code>: The slug of the monster to remove as defined in the monster JSON under <code>resources/db/monster</code>. | | * <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) |
|
| |
|
| '''Examples'''
| | === Time related === |
| * <code>remove_monster fruitera</code> | | * <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> |
|
| |
|
| === random_encounter === | | === Campaign related === |
| 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.
| | * <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. |
|
| |
|
| Here is an example encounter file:
| | === 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. |
|
| |
|
| ''resources/db/encounter/1.json''
| | == Examples == |
|
| |
|
| json
| | ==== Battle ==== |
| {
| | Let's say you want to trigger different events based on the output of the fight: |
| "id": 1,
| | * <code>is variable_set battle_last_result:won</code> |
| "monsters": [
| | or |
| {
| | * <code>is variable_set battle_last_result:lost</code> |
| "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''' | | ==== Date ==== |
| * <code>encounter_id</code>: The id of the encounter JSON file to use for random battles under <code>resources/db/encounter</code>. | | 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> |
|
| |
|
| '''Examples''' | | ==== Season ==== |
| * <code>random_encounter 1</code> | | Let's say you want to grant access to a location only in summer: |
| | * <code>is variable_set season:summer</code> |
|
| |
|
| === play_map_animation === | | ==== Stage of the day ==== |
| 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>.
| | 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> |
|
| |
|
| '''Parameters''' | | ==== Steps Countdown ==== |
| * <code>animation_name</code>: The name of the animation to play under <code>resources/animations/tileset</code>. | | Let's say you want to trigger an event after 1234 steps: |
| * <code>duration</code>: The amount of time in seconds between each frame.
| | * <code>set_variable steps_whatever:1234</code> |
| * <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>steps_</code> followed by your variable <code>whatever</code>. |
| * <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. | | * <code>is variable_is steps_whatever,equals,0.0</code>: Checking for the results, separate event. |
|
| |
|
| '''Examples'''
| | 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>. |
| * <code>play_map_animation grass,0.1,noloop,player</code>
| |
| * <code>play_map_animation sign01,0.4,loop,33,10</code>
| |
|
| |
|
| === wait_for_input === | | ==== Trading ==== |
| Pauses execution of all events until the given input is received.
| | 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) |
|
| |
|
| '''Parameters''' | | 1st: if the player has the monster |
| * <code>input</code>: The pygame input to wait for.
| | <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"/> |
|
| |
|
| '''Examples''' | | ==== Get Party Monster ==== |
| * <code>wait_for_input K_RETURN</code>
| | 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). |
| * <code>wait_for_input K_Q</code>
| |
|
| |
|
| === wait === | | <property name="act10" value="add_monster rockitten,20,npc_slug,27,10"/> |
| Pauses execution of all events for the given amount of time in seconds.
| | <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"/> |
|
| |
|
| '''Parameters'''
| | ==== Battle Among NPCs (the player watches without interacting) ==== |
| * <code>seconds</code>: The amount of time in seconds to wait for.
| | (eg npc_maple vs npc_apple) |
|
| |
|
| '''Examples'''
| | <property name="act10" value="create_npc npc_maple,0,7,stand"/> |
| * <code>wait 2.0</code>
| | <property name="act20" value="create_npc npc_apple,0,8,stand"/> |
| * <code>wait 5.2</code>
| | <property name="act30" value="add_monster chloragon,3,npc_maple"/> |
| | <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"/> |
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 (,
).
Event Reference Condition
Event Reference Action
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_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.
trainer battles:
battle_last_trainer
slug of the last trainer fought
battles PC vs NPC (eg player vs npc_maple or npc_maple vs player)
battle_last_result
: the result can be won
or draw
battles NPC vs NPC (eg npc_maple vs npc_apple) or PC vs NPC (eg player vs npc_maple or npc_maple vs player)
battle_last_loser
slug of the last trainer fought ("player" for the player)
battle_last_winner
slug of the last trainer fought ("player" for the player)
weekday
tracks the day of the week (Monday, Tuesday, etc.)
hour
tracks the hour
day_of_year
tracks the days in a year (1 to 365/366)
year
tracks the 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
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_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.
Let's say you want to trigger different events based on the output of the fight:
is variable_set battle_last_result:won
or
is variable_set battle_last_result:lost
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
Let's say you want to grant access to a location only in summer:
is variable_set season:summer
Let's say you want to block the access during the night:
not variable_set stage_of_day:night
while if you want to grant the access only during the night:
is variable_set stage_of_day:night
Let's say you want to trigger an event after 1234 steps:
set_variable steps_whatever:1234
steps_
followed by your variable whatever
.
is variable_is steps_whatever,equals,0.0
: Checking for the results, separate event.
Note: you can replace equals
with: less_than
, less_or_equal
, greater_than
, greater_or_equal
, and not_equals
.
Let's say you want to set up and event for trading monsters. You need 3 events after creating the NPC in map.
monster1
(monster desired by the NPC)
monster2
(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"/>
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)[edit | edit source]
(eg npc_maple vs npc_apple)
<property name="act10" value="create_npc npc_maple,0,7,stand"/>
<property name="act20" value="create_npc npc_apple,0,8,stand"/>
<property name="act30" value="add_monster chloragon,3,npc_maple"/>
<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"/>