GMS 2 [Solved] How will you handle troop teams?

Okay, I was thinking about something that should work:

For example we have the following;
- IA1 -> Team 1
- IA2 -> Team 1
- IA3 -> Team 2

Then when the IA1 creates soldiers, it will create obj_soldier_1, where 1 is the team number. This object will have the variable 'ia', which will be equal to IA1, this allows the soldier to interact with the IA1 and vice versa.

And the same with the IA2, it will create obj_soldier_1, with the difference of the variable 'ia', which will be equal to IA2.

Then we have IA3, which will create obj_soldier_2.

This allows obj_soldado_1 to make 'instance_nearest' of soldiers that are not from their team without problem.

It's easier than I thought, I leave this here in case someone has the same question or serves you.

A greeting!
 
Top