Please help me, I’m going to crazy. I found a lot of post regarding random placement of the same object, instead I need to do the opposite.
In the same place every 10 second I need to create a random enemy chosing it from a group of 1o different enemies.
Some one can post an example or help me?
What I would do is:
Name each enemy the same with a different number at the end:
Add each enemy to the same group.
Every 10 second, create an enemy object from it name and for number at the end use a random number like so:
“enemy” + ToString(Random(10))
This way you can pick a random object from the group and create it.
Here : basically i just named ennemies “1” and “2”. They are randomly picked from “group” by there name.
random group.zip (8.85 KB)
Just want to add another option, in case you don’t want to name every enemy as “enemyX”. You can create a structure as:
Then you can: generate random number >> access the child from the random number >> create object from name, with the name from the child, as:
Create object named VariableString(Enemies[ToString(Random(2))]) at X;Y
VariableString( Enemies[ ToString(Random(2)) ] )
returns a random enemy name.
This way the structure is like a map, maybe a bit overcomplex, but as I said, just want to add another option
the case become too complex…
I need to be sure that the random function will not generate an enemy currently created in the scene.
in some words I need to avoid duplicate enemy if they are still live…
someone can help me?