Spawning Barrel on Barrel Spawn with max of 5

I have a PumpJack which is a looping animation with a Barrel Spawn behind it.
I want to spawn the Barrels on that Platform with a max of 5 Barrels.
But the Barrel spawn only 1 time and on the side of the PumpJack and I dont understand why.
In my Blueprint I still need to add a condition for the Barrels to stop spawning and a counter for the Barrels but I cant figure it out how. I appreciate any help. Thanks.

1 Like

I think many barrels are spawning, but all in one place.

They are all spawning in the wrong place, I think, because you need to position ‘barrel spawn’ correctly.

You can make an int variable, barrel_count. Add 1 to it each time a barrel spawns, when you reach the required amount, destroy the timer.

(post deleted by author)

Yea I understand. Do u know how to let them spawn next to each other? Or in a specific field. I tried with a box but that just streched the barrel out.

1 Like

You can work it out for each barrel using a bit of maths, or you can spawn them randomly in a box, but then they will overlap.

I can show you a bit later, not at a machine rn… :slight_smile:

Ok thanks, that would be amazing.

1 Like

barrels

2 Likes

That looks amazing, exactly what I was looking for. Thank you.

1 Like

What did u use for Barrels Corner? Which Structure did u use for MyTimer? Because I cant get the Barrels to spawn.
Sorry If Im asking stupid question Im new to blueprints.

Add a static mesh in the components, but just don’t set it to anything. That way, you still have something you can drag around.

You can always get the right type of variable, by right clicking on the output pin and choosing ‘promote to variable’

That is good too know.
It should work in theory now, because all the Nodes are getting called up but It just wont spawn in a barrel. Do I have to edit something inside the Barrel or something?
It workes in the Vieport but not on the map

1 Like

Can you show your code?

Do you have an actual barrel in the barrel blueprint?

Yes

It spawns in the viewport but not on the map

Which viewport, blueprint or world?

Blueprint

1 Like

On the spawn node

I got it working my Map is higher than z 0 so it just spawn way below the map. Thank you so much.