Hi, i created an spawner BP, and a BP actor, each time the BP actor is destroyed, it calls the spawner and makes it create a new one (replace); the spawner can create several spawned objects in random locations inside a cube, so, i canot use dont spawn if colliding, i wanted it to spawn several actors at same time in random locations in this cube, BUT… now i added this spawner to my scene several times and each time an actor is destroyed, it calls the spawner BP to recreate it… and instead of recreate this single one in that 1 spawner, all spawners create 1 actor, creating tons of duplicans because all the spawners received this order from same actor, then all make 1.
To fix it, i need to stop casting the spawner BP from actor BP, and make the spawner auto detect when one of his creations was destroyed, how can i do it?
Just give your actor a specific spawner variable, and when it is swapped set it’s var to the spawner that spawned it. Then on destroy tell that spawner to spawn an actor
It sounds cool, nice channel BTW, i think a picture Will be better to understand this logic,
I already added a name variable to my actor, BUT how is the spawner going to write his name, exactly to that actor it just created? not to every actor in the game with same BP name, since all actors are the same (lets say: BPmynameisTaz); if already 20 actors of the same BP, the spawner will rename all actors called as the one it created. what if 2 spawners create same actor BPmynameisTaz at same time, is the spawner going to become confused, and choose to name all as spawner B?
Isn´t this going to affect the actor too, because now only that spawner Will be able to spawn that “BPmynameisTaz_childrenofBspawner” … I think it Will be most likely to serilized with numbers every single actor BP been created by any spawner and then make each spawner to remember that specific code it added, but how? This is too confusing to understand without a picture, i still have no idea how an actor can recognize wich spawner created it to add the tag, its like coming back to the same problem again.
I think a BP pic will be better help, it sounds pretty cool do,
For now this is my progress… i´m still strugling with some problems:
Each actor… need to have a reference to every single spawner (cast every spawner in the game)… no way to make the spawner to auto detect when their creations have been destroyed, so i need to keep sending this message through the actor, meaning that if i have 10 spawners and i want all of them spawning same actor at least once, all actors must cast all spawners in the game… at the moment of destroy and then… all spawners need to decide if it has one of histags or not to create it… this proces is not the best to me really, since there is tons of ticks at same time every time i destroy actors, worst if i destroy several fast.
Second and more evident problem, if i choose to create 4 actors at event begin play for each spawner and tag them with the spawner name, if i destroy the first one from 2 spawners (1 actor out of 8), nothing happens… then when i destroy the second one (2° out of 8) now it works, so i only have 7 actors restoring and the first i destroyed Will never regenerate… and if now i go for the spawner with 4 actors (been 4 the “lenght < 4” since i originally created 4 and i want to keep that limit) and if now i destroy 1 actor, since 1 spawner has 3 actors and the other spawner has 4, it confuses where to create the new one, so it creates the new actor, not in spawner B (current) but in A, so there is always like a flip flop effect, the one spawner with 1 less before destroying second actor is the one that spawns it… unles i destroy 2 now, then 1 restores well at current spawner and the other at the other spawner.
It has to be an error in my confing, but since i did not understood well the connections Ispheria suggested, well this is what i have now, bassically spawners receive the respawn order, but first count all their children before deciding if they should do 1 or not (forloop without the -1 doesn´t work btw).
Thanks to all your support guys! I finally make it work, the way i wanted,
Instead of casting all spawners from each actor… wich was very por choice for performance, what i did was simply add a tick to the spawners, but lowering the tick Interval to lower the amount of ticks… it Will only send 1 tick every 1 minute for example, when Event Begin Start, the spawner Will create the first round of actors and tag them with each specific spawner, the tick Will check every minute if the actors are still alive by counting them….this Will naturally delay the spawns, if its less than the original count of tags, that specific spawner will create a new actor untill the count is equal, if the check fails, meaning count of tags is less tan the original count the tick Will continue to create a new spawn, if the count is a success, equal to the original count, the spawner wont do anything, and also the tick Will only start working if player is close. PERFECT!
Thanks for all the help & I hope this also helps a lot of people!