'Else' is playing even if the conditions are true...

Status
Not open for further replies.
Level 5
Joined
Aug 8, 2012
Messages
154
Hey there, this is my trigger:


  • Fencecreate
    • Events
      • Dialog - A dialog button is clicked for Dialogz[2]
      • Dialog - A dialog button is clicked for Dialogz[7]
      • Dialog - A dialog button is clicked for Dialogz[12]
      • Dialog - A dialog button is clicked for Dialogz[17]
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Butaanzzz[4]
        • Then - Actions
          • Set Temp_Group = (Units in (Playable map area))
          • Unit Group - Pick every unit in Temp_Group and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A Hero) Equal to True
                  • (Owner of (Picked unit)) Equal to (Triggering player)
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) has an item of type Wood Axe) Equal to True
                      • ((Triggering player) Current lumber) Greater than or equal to 10
                    • Then - Actions
                      • Special Effect - Create a special effect at (Position of (Last created item)) using Abilities\Spells\Human\Slow\SlowCaster.mdl
                      • Player - Set (Triggering player) Current lumber to (((Triggering player) Current lumber) - 10)
                      • Item - Create Crude Fencing at (Position of (Picked unit))
                    • Else - Actions
                      • Game - Display to (Player group((Triggering player))) the text: |CFFFF0303You lack ...
                • Else - Actions
        • Else - Actions
For some reason even if the conditions of the last 'if/then/else' are true, the 'else' action still plays and the 'Game - Display Text' appears... which is not good D: Any idea why this might be happening?

Edit: Wrong forum, my bad! :(
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
How many units are being looped successfully through this?

Say we have unit A, it is a hero and belongs to the triggering player, so it passes through to the last if/then/else - if the conditions are true then yes the game message won't display.
But if we also have a unit B, also a hero and also belonging to the triggering player, it passes through to the last if/then/else - and if the conditions are false you'll get the game message.

How many units should be passing through this code? If it's only one hero per player, you should put
  • Skip remaining actions
right after
  • Item - Create Crude Fencing...
to prevent any further things happening.
 
Level 5
Joined
Aug 8, 2012
Messages
154
Each player only has one hero unit at any time D:

Think I have fixed it though, by assigning a variable to that one hero unit when it is created and using that unit being picked as a condition itself... Now I have to go and assign all the player's heroes to unit variables and do the same for their triggers T.T Thank you!

I couldn't use skip remaining actions, because numerous players' 'if/then/else's are handled all in that one trigger. It works alright now though with the unit variables in the conditions :)
 
Level 15
Joined
Mar 8, 2009
Messages
1,649
the problem may be due to you having two separate conditions in each Conditions tab. I'm not sure, if WCIII engine treats them as AND or OR. try uniting them with ANDs and see if it helps
 
Status
Not open for further replies.
Top