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

One Type of Item in Inventory at a Time

Status
Not open for further replies.
Level 4
Joined
Apr 15, 2008
Messages
82
How would I make it so that a unit can only be holding 1 "campaign" type item at at a time? I got this far and then I was stumped.

  • Offhand
    • 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 Campaign
        • Then - Actions
        • Else - Actions
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

As I understand you correctly you will need this three triggers:
  • Get Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Campaign
    • Actions
      • Set ItemCount[(Player number of (Owner of (Hero manipulating item)))] = (ItemCount[(Player number of (Owner of (Hero manipulating item)))] + 1)
  • Lose Item
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Campaign
    • Actions
      • Set ItemCount[(Player number of (Owner of (Hero manipulating item)))] = (ItemCount[(Player number of (Owner of (Hero manipulating item)))] - 1)
  • Check Item Number
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Campaign
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ItemCount[(Player number of (Owner of (Hero manipulating item)))] Greater than 1
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Hero manipulating item)
          • Game - Display to (Player group((Owner of (Hero manipulating item)))) for 5.00 seconds the text: You can take only 1 Item of this Item-Type.
        • Else - Actions
- ItemCount is an integer variable with array.
 
Level 14
Joined
Mar 4, 2009
Messages
1,156
you can make it with one trigger that works for every player and every hero

just check all 6 slots with integer actions

for each integer from 1 to 6 do
IF
item carried by triggering unit in slot integer A not equal to item being manipulated
item class of item carried my triggering unit in slot Integer A equal to item class of item being manipulated
THAN
drop item being manipulated from triggering unit
ELSE
(do nothing)
 
Status
Not open for further replies.
Top