I am developing a 2D game with phase battle system, and I want to spawn some game object (eg. chest) and let them be destroyed after a set amount of turn (eg. 3 turns) in a battle. So far I only know we can destroy a prefab after a set amount of time, how about destroy a prefab after a set amount of turn?
- make the chest a passive combatant of the battle, with a status effect that kills it after 3 turns (e.g. via Join Battle node, enabling Is Passive) Passive combatants are available as targets in battle, but they're not part of the turn order and don't use any actions.
- use a Tick Machine on the chest with a schematic using Check Battle Turn to see if the turns are over (e.g. based on an object variable on the chest storing the turn it was created or until the turn it should be available)
- use phase start/end events to handle this, e.g. having all these objects stored in global selected data, changing/checking object variables on them and destroying them if their turns are up
Post edited by gamingislove on
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
- make the chest a passive combatant of the battle, with a status effect that kills it after 3 turns (e.g. via Join Battle node, enabling Is Passive)
Passive combatants are available as targets in battle, but they're not part of the turn order and don't use any actions.
- use a Tick Machine on the chest with a schematic using Check Battle Turn to see if the turns are over (e.g. based on an object variable on the chest storing the turn it was created or until the turn it should be available)
- use phase start/end events to handle this, e.g. having all these objects stored in global selected data, changing/checking object variables on them and destroying them if their turns are up
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!