hi,
i have a group of enemies and i would like them to attack each other by choosing either a random target or the closest enemy thus forming duels in pairs.
how can i do it? this is my current event but obviously it doesn’t work the enemies all move in one direction
thank you so much for sharing the events @MrMen ! what happens in both cases is a pile up of all the enemies… is it possible to create pairs of enemies that face each other?
In that case there’s a mistake in your events. I tested it with a dummy project, and the enemies paired up. Can you share a screen shot of your events?
Do your enemies all have a unique id? Keep track of the maximum id in a variable, and increase it and set enemy.id to it every time an enemy instance is created.
In that repeat event, you’ll need to set the enemy id, not set the scene variable id.
Change the last 2 events to:
sorry again @MrMen but the same thing always happens to me.
where am I going wrong?
In the third event:
set the value of enemy.id, not a target object. The target object doesn’t exist yet and only gets created further down.
You need to uncomment the event under “trova il nemico piu vicino senza pari al precedente”.
I attach the link of the project please if you have two minutes you can take a look thanks
ok perfect now it works thanks again