I have a problem with the Spawn Actor node where the actor being spawned gets replaced by another actor that’s on a different Spawn Actor node. Here’s my code as a reference :
The changing of actor happens when two cooldowns overlap while another Spawn Actor node is being executed. Note that there’s a reason why there’s a delay node there
Edit : For a clearer picture of the problem. For example, the spawning is repeated 4 times, the Skeleton will spawn 2 times and the Skeleton Archer will spawn 6 times where it should be 4 Skeletons and 4 Skel Archers.
Not sure I’m following. Your delays are different. And since one time is 1s more than the other, you should be getting at least 3 spawns of the first skeleton before the archer starts spawning. At that point, it’ll be random which one is last to spawn. So from what I’m seeing, you could get 5/3 or 6/2 for spawn ratio. Seems to be working exactly as your graph is designed.
So why is the delay different? Also, you have it on a loop. So the spawn rate will change over time.
For example, if the spawn is repeated 5 times. What I was trying to achieve in the screenshot is Spawn 5 Skeletons and 5 Skel Archers. So by logic it should be – at seconds 3 1 Skel → 3.3 1 Skel -->3.6 1 Skel -->3.9 1 Skel -->4 1 Skel Archer -->4.2 1 Skel -->4.3 1 Skel Archer -->4.6 1 Skel Archer -->4.9 1 Skel Archer -->5.2 1 Skel Archer -->5.5 1 Skel Archer →
Guys, anyone? My guess is the Spawn Actor nodes are being treated as one command by the engine. That’s why even if there are multiple Spawn Actor nodes w/ different Actors to spawn that are being executed, the Actors that are supposed to spawn get replaced by the newest Spawn Actor node.
I’m using UE 5.0.3, maybe it’s different on later versions?
Ok, I made a workaround to this problem by pausing and unpausing the timer on other Timer Event linked to Spawn Actor at certain points but it’s still not perfect. There are still times where the numbers of spawned actors don’t match with the variable.
Hey there @Akimikage! Is the issue that the skeleton spawns sync up eventually? In most cases, having those delays separate you’ll end up in various sync states which may or may not be ideal. It might be better to have one spawning mechanism, and have that called based on just timers instead.
The problem is the Actor on the Spawn Actor node gets replaced. I can’t make only 1 spawning mechanism as these Spawn Actor nodes will have different cooldowns that are linked to different Custom Events and will be called at different times in-game. Note that I have 5 Spawn Actor nodes that will be running each having different cooldown timers. Also, these cooldown timers decrease overtime.
You said you’re using 5.0.3? What Blueprint actor is this graph in?
I looked a the C++ code for the Delay node. It seems to act like an event once it’s called. It does say that if it’s called again before it’s triggered, it is ignored. But that shouldn’t be a problem here.
Can we see your macro?
I’m going to mention the following just in case. Doesn’t seem likely, but you never know.
There’s a chance this could be a bug that exists in 5.0 to 5.2 where certain resources would disappear when running if the actor or widget was created in the main player character’s blueprint or anything used by it. Open your materials used on your actors. Are any nodes missing (usually length, but a few others would also disappear). DON’T SAVE. If there are nodes missing, then you’ve hit that bug and it’s been fixed in 5.3. If you don’t use the length node, then it may be difficult to see if you’ve hit this bug. So you could add a length node to a material used by one of the actors spawned, save, relaunch the editor. If it’s gone when you reload, then you need to update to 5.3.
Otherwise, I don’t know. This looks like odd behavior to me.
Wait, this is a macro. So isn’t this using the EXACT SAME counter variable? When one of the loops gets to 5, it will reset it to 1 and the the other loop will execute 5 more times.
My guess is they aren’t spawing in the exact order you think it is. It’s likely going Skel x3, Skel Archer, Skel resetting the variable to 1 since it’s the 5th update to the counter and that loop exits, then Skel Archer x5. That would be Skel x4 and Skel Archer x6 exactly as described and your network will 100% do this.
Am I wrong? Are you not using the exact same counter variable for both actors?