Warcraft III resources & community, 2003–2006 · archived

Preselecting units

7 posts
#1

Preselecting units

How can I preselct units to be able to use them later
when I trigger a unit?
#2
Selection event- select unit for player

Not sure if thats what you are looking for. Can you be more specific with what you are trying to do?
-VGsatomi
#3
Use a variable unit-array
When you use that unit in a trigger you set it to a variable and you can recall it later.
#4
Vgsatomi : I'll give you a example(mine)

I make a trigger, and I need a unit to create a unit under it, the unit is the spawner, but to select the unit-type you have to use the preselect, and in default preselect there is only no unit, i want to know how to put unit in there

Dude: Well it doesn't really work...

Answer me please!
#5
Well I'm trying to put a variable but it's variable type equal: unit-type (unit-code) initial value equal: Spawner

But i can't use that variable for a unit that does have an action on it :(
#6
I am unable to help you either. apocalypse_dude is right about variable using "unit" type to use recall pre-selected unit. But we are still unsure if you used variable improperly or didn't match your need.

See how this works:

blowup
    Events
        Player - Player 1 (Red) Selects a unit
    Conditions
    Actions
        If (unitselected Equal to (Triggering unit)) then do (Unit - Explode (Triggering unit)) else do (Set unitselected = (Triggering unit))


unitselected is a variable "unit" type

Here's a picture, there's Peasant, Footman, and Knight on a screen. Before player Red click on unit, inside unitselected is BLANK. Once upon clicking on Peasant, it check to see if clicked unit is same as BLANK - it's not the same, ELSE - it added Peasant to unitselected variable (to get rid of BLANK). Then Player Red clicked on Knight, it check to see if Peasant is same as Knight - it's not the same, ELSE - it added Knight to unitselected (to get rid of old Peasant from variable). Now Player Red click on same Knight again - it check to see if Knight is same as Knight from unitselected variable. It is the same - ACTION - blow up this unit.
#7
Well I think you could have just said you have to double click it to the action ocure lol. But anyway I think i'll be ok with this