Warcraft III resources & community, 2003–2006 · archived

Deselect buildings trigger

5 posts
#1

Deselect buildings trigger

I have this trigger which is ment to not allow you to select more that 1 builing at a time of the same builing type.

Build
    Events
        Player - Player 1 (Red) Selects a unit
    Conditions
        ((Triggering unit) is A structure) Equal to True
    Actions
        Set tmpInteger = 0
        Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of (Triggering unit)) Equal to (Unit-type of (Picked unit))
                    Then - Actions
                        Set tmpInteger = (tmpInteger + 1)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                tmpInteger Greater than 1
                            Then - Actions
                                Selection - Remove (Picked unit) from selection for (Triggering player)
                            Else - Actions
                    Else - Actions




The problem is that this trigger does not allow you to select even one building... My personal though on what the problem is, is that the trigger upon selection adds one and thus deselct( even with only 1 building)... So i need to modify this trigger to add up the number of buildings selected... WHICH i dont know how to do. Anyone have any ideas for this?
#2
http://www.freewebs.com/fly-fishisherman/unit_selection.zip

and i shortend the trigger temendously, it works, ive tested it.


edit: found a bug, dont think anyone dl'd tho. tested it again. bug was that it toggled teh selection. just addded 2 lines and a 2 line trigger. works like a charm. also, you need to add teh other variable. and keep in mind you'd have to change a lot to get it multiplayer.
just use array and change player 1 to triggering player. k cool.

-late
#3
so... does it work for you?
#4
Yeah it works but it has a bug it think because when your playing on-line some times it delects units or doesent let you selct units at all or wont let you buy a unit... I think there is something really wrong with it...