The "Do N" action is similar to the "Do Once" action, but instead of executing only once it is possible to inform how many times the actions connected to the output pin can be executed. After these executions, the actions of the output pin will only be executed again if the "Reset" pin is triggered.Input
- N: Number of times the output pin actions can be executed.
- Reset: Execution pin used to restart the "Do N" count and allow new executions of the output pin.
- Counter: Number that indicates the current execution.
As an example, a player has a special weapon. When the weapon is fully charged, its "Power" is 100. The player can press the "R" key to recharge this weapon. This recharge can be done 3 times. The first recharge is complete, the second recharge leaves the "Power" of the weapon at 75 and the third recharge recovers only half the weapon's capacity. To recharge again, the player needs to collect an item of type "WeaponPowerRecharger".
|Click to enlarge|
The "R" event is triggered when the R key is pressed. It executes the "Do N" action that was created with N = 3, allowing up to 3 executions. After "Do N", the "Switch on Int" action is used with the "Counter" value of "Do N" to perform different actions according to the execution number. After the third execution, the "Do N" action will no longer execute the output pin when the R key is pressed. When a collision event occurs with an item of type "WeaponPowerRecharger", the "Reset" pin of "Do N" will be triggered allowing the weapon to be recharged again.
Table of Contents