-
Game Version: Premium
-
Build Number: v.100.18.42553.0 (566841R)
-
Platform: Steam
-
Operating System: Windows 10
Issue:
trDelayedRuleActivation doesn’t work on random maps running trigger code, it works in the editor running a random map just fine.
Trigger Event:
While testing out triggers that use trDelayedRuleActivation in skirmish, given an .xs RM file running trigger code from another class, it doesn’t work.
Repro Steps:
- Create a looping trigger with timer in editor.
- Test it in the editor to see it work.
- Make a RMS generate the exact same code and it will only run once. E.G. calling a class that contains the triggers in the script.
- Make this change: Replace trDelayedRuleActivation with xsEnableRule in the script. It makes the trigger loop, but the timer doesn’t work correctly due to the activation time not getting updated.
1 Like
Thank you @JSlusher - we are now tracking this.
trDelayedRuleActivation can be made to work under RMs, although, the following points have to be observed:
-
Just as in the trigger output for scenarios, xsDisableRule needs to be called before calling trDelayedRuleActivation
-
trDelayedRuleActivation has to be called with its second parameter explicitly set to false, which ensures trigger data is fully bypassed.
The following is an example of a sample rule, which would work under a XS include for a RM, for granting 1 food every five seconds to a player:
rule _Persistent_Resources
highFrequency
active
runImmediately
{
if (((xsGetTime() - (cActivationTime / 1000)) >= 5))
{
trPlayerGrantResources(1, "Food", 1);
xsDisableRule("_Persistent_Resources");
trDelayedRuleActivation("_Persistent_Resources", false);
}
}
Let us know if this resolves your issue! Thanks for reporting!