Looking for some kind of spawn bot tracker in array form
Im still really new to this, but I imagine you only need to keep calling “Get all actors of class” of the class object you’re looking for, and it gives you an array of all the objects of that class in an array. You can do this via either a Event tick or a looping timer that calls the function repeatedly, although I imagine the looping timer would be less taxing on a maching
EDIT: You don’t really need a loop now that I think of it. Just update the array (using get all actors of class) everytime an object of the class you’re looking for is either created or destroyed.
Doing “Get All Actors Of Class” on tick is insane idea
Which is why I don’t recommend it. It’s relatively taxing. It works if you want to test, but I do not recommend keeping it that way
Make you bot AIController to add itself to some array (in GamePlay?) on Begin Play and remove itself on destroy
I tried “is destroyed” node with “destroy actor” and it never fired, so I’m using “event tisk” with “branch” “is dead”.
Is that wrong? I’m doing everything from the character blueprint, not messing with the level at all.
Once you fire “Destroy Actor”, it will only fire events within the same tick.
I think if you want a better way, you may want to use the event “Destroyed” instead.
For example, this below won’t work because by the next tick the actor is gone.
http://puu.sh/kkXAY/e93ac803b9.png
However, this fires immediatly once the “Destroy Actor” is fired and does work
I was confused, event destroyed is for after you initiated destroy actor! I was thinking it was for before to trigger the destroy actor. So no matter what, event tick will always need to fire before a destroy actor, no need to worry about slowdown problems?
Below is my working destroy on death + all surrounding buildings.
Event tick just runs whatever it’s connected to every single frame, so having event tick AFTER destroy actor is run won’t work if im thinking about it correctly. Other people on here know way more than I do, so I may be wrong.
Like Shadow said though, refrain from using ticks as it is taxing on performance, use custom events instead to trigger stuff instead of checking every single frame
There On Destroyed event
So no problem with event tick on a branch checking for is dead?