• 🏆 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!

[Spell] Trigger not working right

Status
Not open for further replies.
Level 6
Joined
Aug 12, 2007
Messages
133
  • itemoftype
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-class of (Item being manipulated)) Equal to Permanent
          • (Item-class of (Item being manipulated)) Equal to Charged
        • Then - Actions
          • For each (Integer inv) from 1 to 6, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-class of (Item carried by (Hero manipulating item) in slot inv)) Equal to (Item-class of (Item being manipulated))
                • Then - Actions
                  • Set itemint = (itemint + 1)
                • Else - Actions
                  • Do nothing
        • Else - Actions
          • For each (Integer inv) from 1 to 6, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Item carried by (Hero manipulating item) in slot inv)) Equal to (Item-type of (Item being manipulated))
                • Then - Actions
                  • Set itemint = (itemint + 1)
                • Else - Actions
                  • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • itemint Greater than 1
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Hero manipulating item)
          • Game - Display to (All players) the text: You cannot carry tw...
        • Else - Actions
          • Do nothing
      • Set itemint = 0
For some reason this trigger isn't working right. My heroes can still wield two Charged/Permanent items.

What is the problem?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
When you put 2 conditions right under each other, it's seen as an AND-Condition.
Thus:
  • (Item-class of (Item being manipulated)) Equal to Permanent
  • (Item-class of (Item being manipulated)) Equal to Charged
means if ItemClass is Permanent AND ItemClass is Charged.
This is impossible: an item cannot have 2 classes.

You can use an "Or - multiple Conditions" and put them in there.
That said, this also means that an "And - multiple conditions" is, in most cases, useless and shouldn't be used (it's only useful inside multiple or-conditions).


Additional notes:
1) Never use "Do nothing", no exceptions. You can remove them all :).
2) If you need help with a trigger, use the "Triggers and scripts"-forum.
 
Status
Not open for further replies.
Top