I need to make a variable for the amount of enemies in the level
I need to make a variable for the amount of enemies in my level, the enemies spawn endlessly in a bounding box using an integer in a random range. This is why I can not just add X amount of enemies to the variable each spawn. Does anyone know how I can use the random number the engine picks as the number to add to the variable?
I am using blueprints to make the game.
Any help would be greatly appreciated.
asked Dec 15 '15 at 12:10 PM in Blueprint Scripting
Hi man your question is not fully clear so if i misunderstood , just rewrite your question more clearly.
You have a box , in wich you want to spawn endlessy a number N of monsters. N is a random number in a range. Like spawn every 10 seconds 2-5 ghost
So you should build up a function or a event "Spawn enemies"
the first thing is set your number of enemies, so take the "random int in range " node and calculate with some literal values or variables, the right amount of enemies you want to spawn.
Lets say i am at level 3 , so i want to spawn at least 1 ghost for lever and max 3 ghost for level of difficult.
Once you have completed the random in range you can use his output as number of iteration in loop.
Take the loop node and pin in the last index.
Now in the loop body build up your spawning .
be carefull that spawn all ghost in same location may cause troumble.
answered Dec 15 '15 at 01:40 PM
Oooo.... Maybe i get it now , You want know how many enemies you have already spawned to stop spawning? There is a node called "get all actor for class" or "get all actor with tag". These will give you an array ,with all the "enemies" you just get his "lenght" . So IF ( get all actor of class "Monsters" )Lenght is < of 50 , SPawn monsters otherwise, not spawn.
answered Dec 15 '15 at 03:20 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here