HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Detecting the Selected Unit

05-03-2004, 02:59 AM#1
Shimrra
I want to create a trigger that says when Player 1 (Red) types a certain text command, the game displays information about the selected unit. I can set up the player types string event, but how do I say "If selected unit is equal to footman, then do this, else do that?"

Any help that can be given on this subject will be greatly appreciated!

-Shimrra
05-03-2004, 03:51 AM#2
ThyFlame
I would say the best way for this is:
Player 1 selects a unit
Set tempSelected[1] = selected unit


Player 1 types -info
Player 2 types -info
...
Player 12 types -info

if
--unit-type of tempSelected[player number of (trigger player)] == footman
then
--display text Blah blah
else
--
[rest of units]
05-03-2004, 08:06 PM#3
Shimrra
You said set set the variable to Selected Unit, but I have been unable to locate it... Am I missing something? Would triggering unit work?
05-03-2004, 08:31 PM#4
sweet5
this displays the units name and health correctly
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
display unit info
Events
Player - Player 1 (Red) types a chat message containing -info as An exact match
Conditions
Actions
Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (If ((Unit-type of (Picked unit)) Equal to Footman) then do (Game - Display to Player Group - Player 1 (Red) the text: (Footman Health = + (String((Life of (Picked unit)))))) else do (Do nothing))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ignore thyflame, he confuses me too :\