How do I emit the number of objects in a variable?
I have a variable which is modifiable by the player, I want to then hit one button to trigger the emitter to emit the number of objects they have selected in the variable.
For example, they choose how many warriors to send out onto the battlefield then press "Attack!" and the same number of soldiers are emitted.
I have a setup with counters and signal manipulators but I can't make it all come together, any help would be really appreciated :)
-
I'd probably have a setup like this:
A counter, with the target number wired into the target input. Wire the counter full output into a NOT gate. Use that to power the emitter. Use the emitter's "emitted object" output to wire into the counter's +, so it adds 1 every time something is emitted. Set the emitter to emit continuously with an interval of 0.
So what should happen is, while the counter isn't at the target number, a new object is emitted each frame and 1 is added to the counter. Once the counter gets to the target number, it will no longer power the emitter and so not spit out any more objects. -
Thanks worked perfectly!
If anyone's wondering: for the one time activation I placed all the logic into a microchip, wired the button press into a signal manipulator set to 'toggle output at ON' and wired that into the microchip. So when the button is pressed the microchip powers on, activating the emitter inside until it reaches the maximum count in the variable and then shuts off. -
?
Please sign in to leave a comment.