[Solved] Create an item for each free slot

At the beginning of the scene, 5 spawn points for ammunition are created inside the game arena.
After that a timer starts and every 10 seconds an ammo box is created at one of the spawn points


Now I’d like to add a power-up that creates an ammo crate for each free spawn point without overlapping other crates if there are any in the game.
Can anyone help me?

If you use an inverted collision condition between your spawn point object and the spawn object or object group, it will only pick the spawn locations without a spawn object. Make sure the spawn location is first in the condition.


I hadn’t thought of that, it was so simple… One last question: when the powerup is activated, the tween effect is activated on crates that collide with spawnpoints.
How can I cancel it on crates that are already on the ground?

I don’t know what you mean. Please elaborate. Tween only exist if you start them. If you want to ignore some then add a condition(s) to ignore them.

I meant that the crate at the spawn point is also triggered by the tween and therefore pushed away.
I don’t understand why the tween is still triggered if it isn’t created.

Which events are triggering the tween. Maybe you can use the same collision event. Inverting a collision condition can be tricky. Sometimes, it helps to put it inside a for each object. Other times, you need to use a regular collision inside a NOT condition. The order of the objects sometimes also matter.

Please help me, I’ve been trying for days without success.

These are all the events:
At the beginning of the scene, spawn points are created where ammunition is dropped.
ese2
a timer is activated which I set every 10 seconds for testing where it chooses one of the spawn points and creates a crate at -200 y activating an interpolation towards the spawn point simulating the fall from the sky


The timer is cleared after the fall and then reactivated once the crate is opened
ese1
What I’d like to do is create a power-up that generates ammo at all five spawn points, provided there isn’t already a spawn point occupied.
What I can’t figure out is how to ignore the interpolation if a crate is already at the spawn point, and how to avoid overlapping the free spawn points if there are still crates to open but the power-up is deactivated and the timer is reset.
this is what i currently have but it is wrong:

You probably don’t need the trigger once especially if there could be multiple objects in collision at the same time bc it would prevent the other objects from being triggered.

Check the variable
Add a subevent of a for each object
Put the other actions in it or as a subevent.

This line might be continously resetting the timer unless the object is deleted or the animation is changed. IDK the whole process.

ese1

I don’t have the right now to really look it over but thats what jumped out at me.

I’m attaching an example of the game to help you understand what’s happening… if anyone can help me solve it

please help me I’m stuck

I’m not clear on your goal and I’m on my phone so I can’t download your project.

This example uses an object variable for the Spawn Zone object to prevent a zone from being used until each zone has spawned an object.

I followed your code, but it’s not what I was trying to do.

I need to create a box every 10 seconds at one of the spawn points.
If the powerup is activated, fill all spawn points except the occupied one(s).

If it’s a matter of not filling the occupied zones then check the collision between the swawn point and chest. Using an inverted collision. That will will filter out the spawn points in collision with an object, then you could use a subevent of for each spawn point with the remaining spawn points and create a random box for each point then reset the timer or delete the timer and restart it when the chests are opened.

I had already tried to invert the collision but it doesn’t work… in addition to the problem of filling the spaces I have the problem of the tween being applied to all the boxes, consequently they are pushed out of the spawn points

This should fix your issue:

The placing of the extra condition is important - it filters the list of spawnammo objects used in the pick random condition:


And in both of the events it occurs, change this action:
image

to this one:
image


Because for some reason I haven’t understood, the existing box drops down by 2000 pixels.

Hi, I wanted to simulate the boxes falling from the sky.
Is there a way to ignore the tween of boxes that are already on the ground?

If you tween a box already on the ground to the position it’s already at, then it won’t appear to move.

Or is there some other reason for not wanting to tween the boxes on the ground?

Registrazione 2025-08-10 182814
This is what I wanted to achieve using tween.
But when all the crates are created, they are pushed away from the spawn point.

If the crates are pushed away with a tween then maybe you could spawn the object to a position above the spawn point and then tween it to the spawn point.

Another option would be to enlarge the spawn point object. That way if you move the crate, it would still be in collision with the spawn zone.

Another option is to use an object boolean like spawned. Set it to true when an object is spawned and then set it back to false when the crate is deleted.

I used object linking and because I’m on my phone, I used a delete zone object to trigger the deletion.

Here’s an example

A larger zone might be easier. You would spawn the object to the center X and Y.

Also, the zone might need a cool down timer so it doesn’t just spawn a new crate the second the old crate is deleted. Or maybe, you could check if the player was close to a spawn point.

This is what I assume you’re after (let me know if I’ve misunderstood):

Spawn


which was done with these 3 changes: