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

[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