• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Deselect buildings trigger

Status
Not open for further replies.
Level 3
Joined
Apr 27, 2005
Messages
28
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.
Code:
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?
 
Level 6
Joined
May 8, 2005
Messages
249
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
 
Level 3
Joined
Apr 27, 2005
Messages
28
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...
 
Status
Not open for further replies.
Top