Why is my enemy spawn code only spawning one of each enemy?

I’m trying to make some code that spawns enemies at particular spawn points. Each enemy has a cost and when an enemy is spawned, a global variable goes down to match the enemy cost. I’ve done it this way so I can scale difficulty easily.

For some reason though, the game will not spawn multiple of one type of enemy, which is a huge problem that I don’t know how to fix.

I’ve tried a couple different things but nothing seems to work.

This is a little bit of the code I’m using

It’s the trigger once that’s preventing more that one spawn from happening. Have a good think about what “Trigger Once” means - if the outcomes of the conditions don’t change from the previous time it was tested, then don’t run the actions. For example, in this event:

if, for arguments sake, Enemy_Cost is 100, then it is decreased by 1 to 99. Since both conditions are still valid and evaluate the same as the previous time the conditions were evaluated, the trigger once kicks in and prevents the actions from being processed.

Only use a trigger once if you do not want an event to be actioned if the conditions are the same as the previous time. Don’t use a trigger once if the actions change the results of the conditions.

I have tried deleting the ‘trigger once’ in the past and it didn’t work. I just tested it again and it still didn’t work.

Here is the last part or my code if it’d help

I dont get it if the global variable of enemy is 0 then how will more enemies spawn your code is wrong And if it isnt then explain me your goal

It’s not wrong as the global variable isn’t about spawning the enemy, but making sure the enemy can spawn. I’m just messing around atm and my results so far have been relatively good so I’ll test it out some more

Unless you are speaking about the object variable? Their are multiple objects so that isn’t a problem

All those events have no real actions. There’s no creation of enemy objects, there’s no reduction of enemy cost.

My recommendation, to make the whole thing more flexible an be able to increase the number of enemies, would be to do the following:

  1. Create an object group named EnemyGroup, and add all the enemy obejcts into it (Marrikoo, Dolphn, Thor_deer, War_Boar etc)

  2. Create a structure variable to hold the enemy details. Make it global if you are spawning enemies in a number of scenes, or make it a scene variable if you’re only spawning enemies in one scene. The structure should look like the following, and to add new enemies just add them to the structure - no need to add a new set of events:

  3. Then to spawn the enemies, use:

Sorry about not telling people. I managed to fix it about 3 hours ago just by messing around