• 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.

If/Then/Else?.... I'll do it anyways

Status
Not open for further replies.
Level 4
Joined
Oct 23, 2006
Messages
65
The trigger is supposed to tell the players the condition of the flag, whether it is being stolen or has been returned. The problem is I noticed some clever players liked to right-click the flag 100000 times while it was at the base and spam the '..flag has been returned.' message. There is a condition in the trigger that checks if Flags[1] is in the region, then don't say the message, otherwise go ahead.

Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        (Flags[1] is in WestStart <gen>) Equal to False
    Then - Actions
        Game - Display to (Player group((Player((Integer A))))) for 1.00 seconds the text: |c0000FF00The West ...
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Game - Display to (Player group((Player((Integer A))))) for 1.00 seconds the text: |c0000FF00The West ...
        For each (Integer A) from 7 to 12, do (Actions)
            Loop - Actions
                Game - Display to (Player group((Player((Integer A))))) for 1.00 seconds the text: |c00FF0000The West ...
    Else - Actions

This is a portion of the trigger. What is happening is : it is displaying the text regardless of the condition of Flags[1]. I have tested it to make sure Flags[1] is set properly and works when the flag is picked up and returned, and these functions all seem to work fine. It seems to be ignoring the condition Flags[1] and I cannot figure out why.

Code:
HasWestFlag
    Events
        Unit - A unit Acquires an item
    Conditions
        (Item-type of (Item being manipulated)) Equal to West Flag
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    Conditions
                        (Owner of (Triggering unit)) Equal to Player 1 (Red)
                        (Owner of (Triggering unit)) Equal to Player 2 (Blue)
                        (Owner of (Triggering unit)) Equal to Player 3 (Teal)
                        (Owner of (Triggering unit)) Equal to Player 4 (Purple)
                        (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
                        (Owner of (Triggering unit)) Equal to Player 6 (Orange)
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Flags[1] is in WestStart <gen>) Equal to False
                    Then - Actions
                        Game - Display to (Player group((Player((Integer A))))) for 1.00 seconds the text: |c0000FF00The West ...
                        For each (Integer A) from 1 to 6, do (Actions)
                            Loop - Actions
                                Game - Display to (Player group((Player((Integer A))))) for 1.00 seconds the text: |c0000FF00The West ...
                        For each (Integer A) from 7 to 12, do (Actions)
                            Loop - Actions
                                Game - Display to (Player group((Player((Integer A))))) for 1.00 seconds the text: |c00FF0000The West ...
                    Else - Actions
                Item - Move (Item being manipulated) to (Center of WestStart <gen>)
            Else - Actions
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        Game - Display to (Player group((Player((Integer A))))) for 1.00 seconds the text: |c00FF0000The West ...
                For each (Integer A) from 7 to 12, do (Actions)
                    Loop - Actions
                        Game - Display to (Player group((Player((Integer A))))) for 1.00 seconds the text: |c0000FF00The West ...
                Cinematic - Ping minimap for (All allies of Player 1 (Red)) at (Center of WestStart <gen>) for 5.00 seconds
                Unit - Add HasStandard  to (Triggering unit)
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Oh, and if you only have to store 2 values, use 2 seperate variables. Do not use an array. I'll let low-life explain why, if he wants :p

EDIT: Found your problem.

since Flags[1] has been picked up, it's not in West Flags anymore. Its hanging about in someone's inventory.

Just check for the position of the Triggering Unit or whatever the correct event response is in this case.
 
Level 8
Joined
Feb 10, 2006
Messages
466
since Flags[1] has been picked up, it's not in West Flags anymore. Its hanging about in someone's inventory.

So ((Flags[1] is in WestStart <gen>) Equal to False) is true and (Then - Actions) should be executed, which doesn't happen. That's his problem, and i'm not looking for solutions until trigger is more sane (without two variables describing same item)

‭‮‭‮‭‮‭‮Oh, and if you only have to store 2 values, use 2 seperate variables. Do not use an array. I'll let low-life explain why, if he wants icon_razz.gif
Huh? Although i would probably refrain from using [1] and [2], i don't see any reason for not using arrays. EXPLAIN.
 
Status
Not open for further replies.
Top