Is there a way to pause a timer in all children of an actor class.

I’m working on a turn based rpg prototype. All the enemy units (of the same parent class) have a timer running that effects some of the their functionality. I want this timer to pause and unpause at specific parts of combat (such as during the players turn, so I am looking for a way to pause or unpause the timer for all enemy units at once. Is there a way to pull the timer handle variable from all present units either using a class or object reference or something that doesn’t involve individually listing units individually (since that would be inefficient. Thank you!

Hey @Zanzibarios!

So what I did for this was: Upon entering battle, add all enemies into an array of “CombatEnemies.” Then that allowed me to do stuff like "Cast spell to hit each index of array “Enemies” " or in this case "Pause timer for each index of array “Enemies”!

The way I added them to an array was the tag system! On the parent of enemies (Provided the player doesn’t have the same parent) You can add the “Enemy” tag, and then on battle start, “Get all actors with Tag: Enemy” And then output that into an array of actors for this use! Then when one dies, make sure to subtract them from the Array. It’s a GREAT thing to have throughout your project! :slight_smile:

Thanks so much, this worked great!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.