Line 87: |
Line 87: |
| | Mark a <samp>Data/TriggerActions</samp> entry as applied or non-applied for the [[#Target player|specified player(s)]], depending on {{o|applied}} (default <samp>true</samp>). This can be used to skip or re-run an entry, since <samp>Data/TriggerActions</samp> entries are only applied once by default. | | | Mark a <samp>Data/TriggerActions</samp> entry as applied or non-applied for the [[#Target player|specified player(s)]], depending on {{o|applied}} (default <samp>true</samp>). This can be used to skip or re-run an entry, since <samp>Data/TriggerActions</samp> entries are only applied once by default. |
| | | |
− | Note that an entry can't mark ''itself'' unapplied (but you can add a second entry which marks the first one unapplied). | + | Note that an entry can't use this to mark ''itself'' unapplied; see [[#Make Data/TriggerActions repeat|''Make <samp>Data/TriggerActions</samp> repeat'']] if you want to do that. |
| |- | | |- |
| | <samp>MarkEventSeen {{t|player}} {{t|event ID}} {{o|seen}}</samp> | | | <samp>MarkEventSeen {{t|player}} {{t|event ID}} {{o|seen}}</samp> |
Line 199: |
Line 199: |
| | <samp>HostOnly</samp> | | | <samp>HostOnly</samp> |
| | ''(Optional)'' Whether this trigger action can only run for the main player. If true, the action will be ignored for farmhands in [[multiplayer]]. | | | ''(Optional)'' Whether this trigger action can only run for the main player. If true, the action will be ignored for farmhands in [[multiplayer]]. |
| + | |- |
| + | | <samp>MarkActionApplied</samp> |
| + | | ''(Optional)'' Whether to mark the action applied when it's applied. Default true. |
| + | |
| + | * If true: the action is added to the player's <samp>triggerActionsRun</samp> list, [[Modding:Game state queries|queries]] like <samp>PLAYER_HAS_RUN_TRIGGER_ACTION</samp> will return true, and the action won't run again (unless you use the <samp>MarkActionApplied</samp> action to mark it unapplied). |
| + | * If false: the action can repeat immediately when the same trigger is raised, and [[Modding:Game state queries|queries]] like <samp>PLAYER_HAS_RUN_TRIGGER_ACTION</samp> will return false for it. |
| |- | | |- |
| | <samp>Condition</samp> | | | <samp>Condition</samp> |
Line 294: |
Line 300: |
| | | |
| ===Make <samp>Data/TriggerActions</samp> repeat=== | | ===Make <samp>Data/TriggerActions</samp> repeat=== |
− | Each entry in <samp>Data/TriggerActions</samp> is only applied once per player, but you can use the <samp>MarkActionApplied</samp> action to forget that it was applied. (Note that an action can't forget itself though.)
| + | By default, each entry in <samp>Data/TriggerActions</samp> is only applied once per player. |
| + | |
| + | There are two main ways to repeat actions: |
| + | <ul> |
| + | <li>To make it repeatable immediately, set <samp>"MarkActionApplied": false</samp> on the <samp>Data/TriggerActions</samp> entry.</li> |
| + | <li>To enable repeating at a different time, you can use the <samp>MarkActionApplied</samp> action to forget that it was applied. |
| | | |
| For example, this patch will set alternating 'work' or 'weekend' mail flags depending on the day of week: | | For example, this patch will set alternating 'work' or 'weekend' mail flags depending on the day of week: |
Line 333: |
Line 344: |
| } | | } |
| </nowiki>|lang=js}} | | </nowiki>|lang=js}} |
− |
| |
| | | |
| [[Category:Modding]] | | [[Category:Modding]] |