I’m trying to spawn multiple actors using the spawn actor node. I’ve tried implementing various loops but none of them work, however if I bind the event to a key press the items will spawn but only one at a time (It’s not looping). Any suggestions would be greatly appreciated.
Here’s a screen shot
so I’ve tried that but for some reason it’s not working I’ve just posted an image of my script above.
Where have you put this? put a print string after d to check if it is executed. also i think you already know this but this will spawn the actor at the location where you have put the this actor in (the actor in which you are executing the script.)
if this isnt the player character then you might have to do a little something.
go this actor’s settings and uncheck consume input.
so I’ve tried that but for some reason
it’s not working I’ve just posted an
image of my script above.
It does work, the way you execute it does not. Besides, you’re spawning all actors in the same spot.
The Delay will prevent spawning more than one object, if you call Delay while it’s counting down, the additional calls are ignored.
Have a look at the world outliner, all instances are listed there. And / or place a Print String node after spawning the actor and see if it executes.
But most importantly, remove he delay. If you need something to spawn at interval, use a timer. Or lower the tick rate of the actor to the desired frequency and use Tick. A looping timer is better - more granular control.
So I have physics enabled, so that the actors will just fall until they collide with a plane I have located below. I implemented the delay because I wanted to make sure the actors were far enough away from the spawn point to prevent any collisions as another tries to spawns. Now for some reason that I am not aware, of the loop doesn’t execute and I have to resort to pressing the “D” key to spawn another actor.
On a side note I’m working with parent-child blueprint classes, where the parent blueprint contains the actors(child blueprints) that I’m trying to spawn, the actual spawning is carried out by a “target point” actor.
I wanted to make sure the actors were
far enough away from the spawn point
to prevent any collisions as another
tries to spawns.
As mentioned above, this is not how Delay works and will not behave like you expect.
the loop doesn’t execute
There must be hundreds reason why this could be happening. You need to tell / show us how you’re triggering it. Begin Play / Construct / Custom Event / Trigger Volume?
On a side note I’m working with
parent-child blueprint classes, where
the parent blueprint contains the
actors(child blueprints) that I’m
trying to spawn, the actual spawning
is carried out by a “target point”
Probably irrelevant but when in doubt, simplify the setup until you have it working and then reintroduce more complex elements to pinpoint what broke it in the first place.
This is how I do it, just as a test. Found it somewhere on answer hub. Maybe it will be of some use to you.
[edited - nonsense]
Apology for trespassing
You do have a point. At Event Begin play I have a crude clock/timer set up and when it reaches a full minute it fires of custom event that spawns all the cubes. It’s really fun as I multiply current minute count x 20 so after say 5 minutes this becomes fun to watch. Oh yeah and the goal is to get as many of them destroyed, but it’s just a fun concept I’m working on as a payback to someone for making jokes. (cubes have his face on)
Ooops, sorry, I thought it was OP posting… Did not look at the name.