Is there a way to count how many times a specific trigger has been executed? I don't want to copy it and put it in a row of self executing triggers, because I also need to disable it some times.
Yes you can, its under integer- function: trigger execution count. You can do the same with trigger evaluation count. The only difference is that trigger is only executed when it meet the condition. If not, it is only evaluated
Trigger 1 is the trigger that should run 3 times. You make a variable and name it something like 'Trigger run amount' as integer. Integers start counting at 0 (like computers). Then each time you run trigger 1 you also include the action at the trigger 'Modify Trigger run amount + 1' (search for variable, then type in modify) there are 2 options, take the one that has the discription about an integer and NOT the one with a 'real'.
Then you should add an action at the bottom which is called 'If then else if' which allows you to put in a condition inside the actions of the trigger. Add a new action after the 'If then else if' and it will allow you to put in a condition. Put in the condition 'Comparison' and press the first blue '('and select Trigger run amount. Then put Value on 3. Then put in the stuff the trigger should do, perhaps activate another trigger so that it counts as the reaction you want. If you want to make sure that Trigger 1 can run another 3 times and then get the same effect. Make sure you 'set Trigger run amount' to 0 after the If Then Else If so that it basically resets the variable and allows you to count again.
Do note that, if you use this function inside the trigger that you're checking, the value you'll get will be the actual value -1 because it increments after the trigger has executed.
Is there a way to count how many times a specific trigger has been executed? I don't want to copy it and put it in a row of self executing triggers, because I also need to disable it some times.
File -> Preferences -> Test Dcoument -> Run game in a window -> Show Trigger debugging window
@xhatix: Go
Ah sorry, I wasn't specific - I meant count this in a trigger function. You see, I want to do something like this:
< Trigger 1 - has been fired 3 times > then < Run Trigger 2 >
Could you not just make an integer variable called "Trigger Runs" and just have Trigger 1 increase it by 1 each time it runs?
@Callex: Go
Hmm, I'm not too good with variables yet. I can set this up, but how do I make an action that reacts if the counter has reached 3 ?
@Namsom: Go
Yes you can, its under integer- function: trigger execution count. You can do the same with trigger evaluation count. The only difference is that trigger is only executed when it meet the condition. If not, it is only evaluated
@Namsom: Go
You can do it like the following:
Trigger 1 is the trigger that should run 3 times. You make a variable and name it something like 'Trigger run amount' as integer. Integers start counting at 0 (like computers). Then each time you run trigger 1 you also include the action at the trigger 'Modify Trigger run amount + 1' (search for variable, then type in modify) there are 2 options, take the one that has the discription about an integer and NOT the one with a 'real'.
Then you should add an action at the bottom which is called 'If then else if' which allows you to put in a condition inside the actions of the trigger. Add a new action after the 'If then else if' and it will allow you to put in a condition. Put in the condition 'Comparison' and press the first blue '('and select Trigger run amount. Then put Value on 3. Then put in the stuff the trigger should do, perhaps activate another trigger so that it counts as the reaction you want. If you want to make sure that Trigger 1 can run another 3 times and then get the same effect. Make sure you 'set Trigger run amount' to 0 after the If Then Else If so that it basically resets the variable and allows you to count again.
I hope this helps.
TriggerGetExecCount()
Do note that, if you use this function inside the trigger that you're checking, the value you'll get will be the actual value -1 because it increments after the trigger has executed.
Wow, thanks to all of you. I'll be integrating that asap and let you know.
@hddante: Go
Works absolutely flawless, thanks :)