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

[Trigger] Buy Item Trigger

Status
Not open for further replies.
Level 6
Joined
Apr 20, 2016
Messages
215
When I buy an Item The trigger always say your hands are fully equipped but I don't have the ability, the first ability was succesfull but now it won't work. I dont have the first trigger coz I updated it and changed the item in object editor
  • Weapons
    • 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-type of (Item being manipulated)) Equal to Elucidator
          • W_Count[(Player number of (Owner of (Buying unit)))] Equal to 0
        • Then - Actions
          • Special Effect - Create a special effect attached to the left,hand of (Hero manipulating item) using war3mapImported\Elucidator.mdx
          • Unit - Add Elucidator Left to (Hero manipulating item)
          • Unit - Add Elucidator to (Hero manipulating item)
          • Hero - Drop (Item being manipulated) from (Hero manipulating item)
          • Item - Remove (Last dropped item)
          • Set W_Count[(Player number of (Owner of (Hero manipulating item)))] = 1
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • W_Count[(Player number of (Owner of (Hero manipulating item)))] Equal to 1
            • Then - Actions
              • Special Effect - Create a special effect attached to the right,hand of (Hero manipulating item) using Abilities\Weapons\GlaiveMissile\GlaiveMissile.mdl
              • Unit - Add Elucidator Right to (Hero manipulating item)
              • Unit - Add Elucidator to (Hero manipulating item)
              • Hero - Drop (Item being manipulated) from (Hero manipulating item)
              • Item - Remove (Last dropped item)
              • Set W_Count[(Player number of (Owner of (Hero manipulating item)))] = 2
            • Else - Actions
              • Game - Display to (All players matching ((Owner of (Buying unit)) Equal to (Owner of (Buying unit)))) the text: Your hands are full...
              • Hero - Drop (Item being manipulated) from (Hero manipulating item)
              • Item - Remove (Last dropped item)
 
Level 42
Joined
Feb 27, 2007
Messages
5,330
"Hero manipulating item" doesn't refer to anything in this instance because nothing is being manipulated. Replace all instances of "Hero manipulating item", "buying unit", etc. with "Triggering Unit". ALWAYS use triggering unit if you can as it is wait-safe.

Also I believe the attachment points has "left" or "right" second so you should have "hand,right" and "hand,left" instead of the opposite order you do now. This might be causing the effects not to show properly.
 
Level 13
Joined
May 10, 2009
Messages
868
  • W_Count[(Player number of (Owner of (Buying unit)))] Equal to 0
"Buying unit" returns 1 in this case, because it's used for another item event. So, at best, this would only work for player 1 (red). You may want to use "Triggering Player" or "Triggering Unit" instead.


  • Hero - Drop (Item being manipulated) from (Hero manipulating item)
  • Item - Remove (Last dropped item)
I believe that just using the action "Item - Remove (Item being manipulated)" is enough for this purpose.


As for the attachment points via triggers, you should write "hand left" or "hand right". Otherwise, you won't get the effects placed where you want.
 
Level 5
Joined
May 2, 2015
Messages
109
I think your trigger should be like this
  • Weapons
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Elucidator
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • W_Count[(Player number of (Owner of (Buying unit)))] Less than or equal to 2
        • Then - Actions
          • set W_Count[(Player number of (Owner of (Buying unit)))] = W_Count[(Player number of (Owner of (Buying unit)))] + 1
        • Else - Actions
          • Game - Display to (All players matching ((Owner of (Buying unit)) Equal to (Owner of (Buying unit)))) the text: Your hands are full...
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • W_Count[(Player number of (Owner of (Buying unit)))] Equal to 1
        • Then - Actions
          • Special Effect - Create a special effect attached to the left,hand of (Hero manipulating item) using war3mapImported\Elucidator.mdx
          • Unit - Add Elucidator Left to (Hero manipulating item)
          • Unit - Add Elucidator to (Hero manipulating item)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • W_Count[(Player number of (Owner of (Buying unit)))] Equal to 2
        • Then - Actions
          • Special Effect - Create a special effect attached to the right,hand of (Hero manipulating item) using Abilities\Weapons\GlaiveMissile\GlaiveMissile.mdl
          • Unit - Add Elucidator Right to (Hero manipulating item)
          • Unit - Add Elucidator to (Hero manipulating item)
        • Else - Actions
      • Item - Remove (Last dropped item)
 
Level 13
Joined
May 10, 2009
Messages
868
Have you changed anything about your trigger? If not, any item other than Elucidator will display that message. If you want to know which unit acquired/cast/lost an item, use Triggering Unit; Buying Unit is used for these events:
  • Buying Unit
    • Events
      • Unit - A unit Sells a unit
      • Unit - A unit Sells an item (from shop)
      • Unit - A unit Pawns an item (to shop)
    • Conditions
    • Actions
 
Level 13
Joined
May 10, 2009
Messages
868
All right. For that item only, you have to reorganize the order of your if statements. If not, any item will display the "your hands are full..." message.

  • Weapons
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set unit = (Triggering unit)
      • Set item = (Item being manipulated)
      • Set pnum = (Player number of (Owner of unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of item) Equal to Elucidator
        • Then - Actions
          • -------- Remove item (?) --------
          • Item - Remove item
          • -------- Add effects and ability --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • W_Count[pnum] Equal to 0
            • Then - Actions
              • Special Effect - Create a special effect attached to the hand left of unit using Abilities\Spells\Undead\DeathCoil\DeathCoilMissile.mdl
              • Set W_Count[pnum] = 1
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • W_Count[pnum] Equal to 1
                • Then - Actions
                  • Special Effect - Create a special effect attached to the hand right of unit using Abilities\Spells\Undead\DeathCoil\DeathCoilMissile.mdl
                  • Set W_Count[pnum] = 2
                • Else - Actions
                  • Game - Display to (All players) the text: Your hands are full...
        • Else - Actions

However, sounds like you intend to apply this same idea for other items. If so, I suggest that you organize your items in the object editor through Classification (Permanent, Purchasable, Artifact, etc...), that way you can detect easily if an item is a weapon by using the condition "Item-Class Comparison" - Or you can also organize them by levels.

Your trigger would look like this:
  • Weapons
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set unit = (Triggering unit)
      • Set item = (Item being manipulated)
      • Set pnum = (Player number of (Owner of unit))
      • -------- Class: Permanent (Weapon) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-class of item) Equal to Permanent
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • W_Count[pnum] Less than 2
            • Then - Actions
              • -------- Increment your weapon_count variable --------
              • Set W_Count[pnum] = (W_Count[pnum] + 1)
              • -------- - --------
              • -------- ITEM: Elucidator --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of item) Equal to Elucidator
                • Then - Actions
                  • -------- Add effects and ability --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • W_Count[pnum] Equal to 1
                    • Then - Actions
                      • Special Effect - Create a special effect attached to the hand left of unit using Effect1.mdl
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • W_Count[pnum] Equal to 2
                        • Then - Actions
                          • Special Effect - Create a special effect attached to the hand right of unit using Effect2.mdl
                        • Else - Actions
                          • -------- This never happens --------
                • Else - Actions
                  • -------- Other weapons --------
                  • -------- ITEM: Claws of Attack --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item-type of item) Equal to Claws of Attack +12
                    • Then - Actions
                      • -------- Effect --------
                    • Else - Actions
                      • -------- More weapons --------
              • -------- - --------
              • -------- Remove item (?) --------
              • Item - Remove item
            • Else - Actions
              • Game - Display to (All players) the text: Your hands are full...
              • Hero - Drop item from unit
              • -------- Remove Item when player exceeds the weapon count limit (?) --------
        • Else - Actions
          • -------- Class: Purchasable (Armor) --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-class of item) Equal to Purchasable
            • Then - Actions
              • -------- items related to this class --------
            • Else - Actions
              • -------- other classes --------
 
Status
Not open for further replies.
Top