• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Trigger is taking destroying item instead of taking away 2 charges.

Status
Not open for further replies.
Level 6
Joined
Dec 9, 2014
Messages
176
Trigger is destroying item instead of taking away 2 charges.

As the title states, this trigger is destroying the item instead of reducing its charges. Do I have something wrong?

  • Making Wool Bandages
    • Events
      • Dialog - A dialog button is clicked for FirstAidRecipes[1]
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to FirstAidRecipeButton[1]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Charges remaining in (Item carried by Sorceress of type Tuft of Wool)) Greater than or equal to 2) or ((Charges remaining in (Item carried by Wizard of type Tuft of Wool)) Greater than or equal to 2)
            • Then - Actions
              • Item - Set charges remaining in (Item carried by Sorceress of type Tuft of Wool) to ((Charges remaining in (Item carried by Sorceress of type Tuft of Wool)) - 2)
              • Item - Set charges remaining in (Item carried by Wizard of type Tuft of Wool) to ((Charges remaining in (Item carried by Wizard of type Tuft of Wool)) - 2)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Charges remaining in (Item carried by Sorceress of type Tuft of Wool)) Equal to 0) or ((Charges remaining in (Item carried by Wizard of type Tuft of Wool)) Equal to 0)
                • Then - Actions
                  • Item - Remove (Item carried by Sorceress of type Tuft of Wool)
                  • Item - Remove (Item carried by Wizard of type Tuft of Wool)
                • Else - Actions
              • Game - Display to (All players) the text: |cff32cd32[---- ...
              • Wait 0.75 seconds
              • Cinematic - Clear the screen of text messages for Player Group - Player 1 (Red)
              • Game - Display to (All players) the text: |cff32cd32[--------...
              • Wait 0.75 seconds
              • Cinematic - Clear the screen of text messages for Player Group - Player 1 (Red)
              • Game - Display to (All players) the text: |cff32cd32[--------...
              • Wait 0.75 seconds
              • Cinematic - Clear the screen of text messages for Player Group - Player 1 (Red)
              • Game - Display to (All players) the text: |cff32cd32[--------...
              • Wait 0.75 seconds
              • Cinematic - Clear the screen of text messages for Player Group - Player 1 (Red)
              • Game - Display to (All players) the text: |cff32cd32[--------...
              • Wait 0.75 seconds
              • Cinematic - Clear the screen of text messages for Player Group - Player 1 (Red)
              • Game - Display to (All players) the text: |cff32cd32[--------...
              • Wait 0.30 seconds
              • Item - Create Wool Bandage at (Position of Sorceress)
              • Item - Create Wool Bandage at (Position of Wizard)
            • Else - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: |cffffcc00You don't...
        • Else - Actions
 
Level 21
Joined
Aug 13, 2011
Messages
739
It's the "or" condition which checks a unit that doesn't exist, because your chosen hero is either a sorceress or a wizard. That automatically returns 0 charges and always makes it remove the item regardless of the charges left. So replace your If/Then/Else with something like this (adding a double negative condition which basically checks if the unit variable is in use):
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Or - Any (Conditions) are true
          • Conditions
            • And - All (Conditions) are true
              • Conditions
                • Sorceress Not equal to No unit
                • (Charges remaining in (Item carried by Sorceress of type Tuft of Wool)) Equal to 0
            • And - All (Conditions) are true
              • Conditions
                • Wizard Not equal to No unit
                • (Charges remaining in (Item carried by Wizard of type Tuft of Wool)) Equal to 0
      • Then - Actions
        • Item - Remove (Item carried by Sorceress of type Tuft of Wool)
        • Item - Remove (Item carried by Wizard of type Tuft of Wool)
      • Else - Actions
 
Level 6
Joined
Dec 9, 2014
Messages
176
Oh ok! Thank you! I thought if the unit couldn't be checked due to it not existing that that condition wouldn't apply.
 
Status
Not open for further replies.
Top