Download

After actor spawns, How do I call it again in the same blueprint?

At least I think that’s what I need to do. So I just created a post about having an event spawn an actor. Can be seen here. https://forums.unrealengine.com/showthread.php?78450-Stumped-by-something-super-easy-Regarding-a-one-time-action-maybe-no-clue!&p=344176#post344176

I got that working nice. Thanks again btw!

Here’s the new problem I’m having. I added a Do N node into the script because I only would like to spawn a set amount of of objects. Which you can see here.

However, what’s happening now is that it’s not working. After the object is destroyed, it keeps spawning more and more. I tried to debug what’s going on, and it seems like it spawns a new object. So I’m curious if the new object isn’t calling back to this blueprint?

Here’s the best way I can describe it. When I shoot my first object, my script runs perfectly. I can see it working as intended. However, right after the first object gets destroyed, it keeps spawning more objects when they keep getting destroyed without stopping. Which is bad because I only want 5-10 to spawn. When I debugged it, I only seen my script run one time. So I have to select a new object to see the script run again which you can see here.

So, I guess what I’m asking is how can I get this object to spawn another one, and still follow the same script? At least I think that’s what I need to do. Because I can only see this script run once, unless I select a new object. Would this have to do with the owner on the spawn actor node? Hopefully you can see what I’m trying to do. I can make a video maybe if it’s not clear enough. The new objects all follow this script, but they only follow the script once per instance I guess. So the Do N won’t work at all because technically the script is only running one time per object. So when a new object spawns, is there a way I can call it back in a loop to the same script as the first one? Perhaps that’s not the right way to do it, but I’m a noob here. lol

As I mentioned in the last post. It looks like the destructible mesh is spawning the same destructible mesh actor. Meaning Asteroid1_DM_BP is spawning Asteroid1_DM_BP and that’s where I see a problem. Is there any particular reason why you are doing it like this? Do Once isn’t going to work, it will work on the first actor, but when it’s spawned again that code hasn’t ran, so it’s going to do that once, and then over and over again.

Yeah, I’m trying to have the same actor spawn multiple times. Think of it like a shooting gallery where you destroy the same target 10 times. I’d like to destroy the same actor 5-10 times in a row. Just in different locations and what not. I’m sure I could figure a way around this. Such as creating the assets with different names… IE, taking out the “DO N” node and just keeping the “DO ONCE” and instead of having it spawn the same actor, have it spawn “asteroid1_DM_BP2” for example with a destroy actor after each one. But there’s got to be a way I can reference the same actor to keep running the same script right? Otherwise I’m going to have to duplicate my blueprint for every single time I want to destroy another object. . . urgh!

EDIT: I just ended up creating duplicate blueprints for the objects I want to destroy. I guess it’s a workaround like I mentioned. Still wouldn’t mind an answer though. But as of right now it works like I’d like it to. Just had to do more work.

I’ve got 10 blueprints for the 10 objects I want to spawn. Asteroid 1,2,3, etc. .
This way the death of asteroid 1 spawns asteroid 2, and so forth.

So I’m just guessing here that when the second bp spawned his health wasn’t initialized or it was set to 0 hence it blowing up again or something like that? I think the problem is just in the logic but sorry I didn’t study it that deeply. Yeah, anyway that’s kind of how I do it. My main BP actor is not a destructible mesh, but I have a copy of it that is a destructible mesh and when the main actor is destroyed it spawns just the destructible mesh actor. This works well with the mechanics of my game.