HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Is Unit Selected within certain time

11-04-2002, 07:00 PM#1
DKSlayer
Here is a problem I have ran into I know it can be figured out some how I just can't get my finger on it. This problem relates to the Commander. After someone types in lets say Cmd: Blue Attack Selected I then want the program to say wait unit a unit is selected. And after a little bit if nothing is selected then exit so
loop
set i = i + 1
wait(1)
exitwhen(UnitSelected == true) //Will exit loop when unit seleceted
exitwhen(i == 10) //This will cause it to wait 10 sec but test between each second to se if unit is selected
endloop

That is what I am kind of looking at. The thing is I need to be able to have it look and see if a unit is selected and is so to store it's unitid. I could use a TriggerEvent for when GetTRiggerPlayer(0 selects a unit and then store GetTriggerUnit() into a variable. But I don't want every unit selected during the whole game to be but into the variable. Just for a certain time.
So basically all I need to know is how to tell if a unit is being selected during those 10 sec. Any help would be appreciated Thanks.