Unit selection in an rts

Im making an rts. I have it so that when you click a unit it sets a variable called selected to 1. Then when you right click it saves the x and y in variables and then the unit moves towards it until they reach the location. The only problem im having is that I can figure out how to tell which specific unit you have selected so every unit of that type moves. I tried using instance variables to tell which instance of the unit was selected but I couldnt figure out how to change the instance variable of a specific instance of an object from the events. If you know what I could do please let me know. Thanks!

oh nvr mind. I fixed it. sorry!

1 Like

as far as I know, only the selected instance’s variable will change. check in the debugger. after that you should use a “for each” event to order only the desired instance(s).

1 Like

This is something i’ve been thinking about trying. How did you fix it?