HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Checking if a unit is selected

10-06-2005, 08:25 PM#1
Trombler
Hello again all happy faces

I am working on a map, in wich you should be able to zoom in and out with the ESC button, but, for instance, you have a building and training units, and want to cancel the training... then the view will be zoomed out. To the point: How do I make a trigger that checks if the triggering player has a building selected?
10-06-2005, 08:40 PM#2
duckduck
i don't have world edit open right now so it may be kinda off
Quote:
Events:
Player 1 selects a unit
Conditions:
Actions:
Set unit_is_selected = true
Quote:
Events:
Player 1 deselects a unit
Conditions:
Actions:
Set unit_is_selected = false
and in the trigger that zooms in with the trigger, you have to add the condition:
Quote:
Conditions:
unit_is_selected = false
10-07-2005, 08:54 AM#3
xxxSpikexxx
you can also use a condition with a unit group.

if (number of units in (units selected by (player)) > 0 then ...

that way you can figure out which unit is selected by the player. but if he selected more than one unit the camera thing could do strange things.

you could add a condition like 'if (picked unit) is a buildeing then ...'