Changes

Jump to navigation Jump to search
1,174 bytes added ,  01:00, 17 December 2023
+ data format
Line 46: Line 46:     
Remember that quotes and backslashes inside JSON strings need to be escaped too. For example, <code>"AddFriendshipPoints \"Mister Qi\" 10"</code> will send <code>AddFriendshipPoints "Mister Qi" 10</code> to the game code. Alternatively, you can use single-quotes for the JSON string instead, like <code>'AddFriendshipPoints "Mister Qi" 10'</code>.
 
Remember that quotes and backslashes inside JSON strings need to be escaped too. For example, <code>"AddFriendshipPoints \"Mister Qi\" 10"</code> will send <code>AddFriendshipPoints "Mister Qi" 10</code> to the game code. Alternatively, you can use single-quotes for the JSON string instead, like <code>'AddFriendshipPoints "Mister Qi" 10'</code>.
 +
 +
==Data format==
 +
Trigger actions are stored in the <samp>Data/Triggers</samp> asset. This consists of a list of models with these fields:
 +
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>Id</samp>
 +
| The [[Modding:Modder Guide/Game Fundamentals#Unique string IDs|unique string ID]] for this trigger action.
 +
|-
 +
| <samp>Trigger</samp>
 +
| When to apply the trigger action. This must be a [[#Triggers|valid trigger type]].
 +
|-
 +
| <samp>Actions</samp>
 +
| The actions to perform. This consists of a list of strings matching the [[#Actions|action format]].
 +
|-
 +
| <samp>Location</samp>
 +
| ''(Optional)'' If set, the internal location name where this action should be applied. This is a shortcut for (and more efficient than) using a <samp>LOCATION_NAME</samp> game state query. Default none.
 +
|-
 +
| <samp>HostOnly</samp>
 +
| ''(Optional)'' Whether this trigger action can only run for the main player. This will be ignored for farmhands in [[multiplayer]].
 +
|-
 +
| <samp>Condition</samp>
 +
| ''(Optional)'' A [[Modding:Game state queries|game state query]] which indicates whether this action can be applied currently. Defaults to always true.
 +
|}
 +
 +
See [[#Overview|example under ''Overview'']].
    
==Valid values==
 
==Valid values==
translators
8,447

edits

Navigation menu