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

Unit - A unit Loses an item

Status
Not open for further replies.
Level 12
Joined
Sep 11, 2011
Messages
1,176
Hello, everyone.

I have a problem regarding the above event..
When i lose an item and my inventory is empty, I looped through my inventory to check number of item in my inventory and it always show that i have 1 item in my inventory, then i checked the name of the item, and it was the item that i dropped recently...
How can i counter this ? anyone have ideas ?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
What exactly you want to do ?
I always adjust my itemCounter to == 1, means that he has no item and if itemCounter > 1, he has at least one item.

Just adjust the zero error.

OR
You can do a short timer to it;
  • Start Timer
    • Events
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • Set TempUnit = (Triggering unit)
      • Countdown Timer - Start DropItemTimer as a One-shot timer that will expire in 0.00 seconds
      • Set DropItemTimer = (Last started timer)
  • Stop Timer
    • Events
      • Time - DropItemTimer expires
    • Conditions
    • Actions
      • Set TempInt = 0
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item carried by TempUnit in slot (Integer A)) Not equal to No item
            • Then - Actions
              • Set TempInt = (TempInt + 1)
            • Else - Actions
      • Game - Display to (All players) the text: (String(TempInt))
EDIT
Grrr, Maker.
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
actually, i'm just trying to help someone here to make an equip set system..

i had done it like this

  • The Holy Vestments
    • Events
      • Unit - A unit Acquires an item
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • Set PartCount = 0
      • For each (Integer loopInt) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Triggering unit) in slot loopInt)) Equal to Armor of Retribution
                  • (Item-type of (Item carried by (Triggering unit) in slot loopInt)) Equal to Boots of Retribution
                  • (Item-type of (Item carried by (Triggering unit) in slot loopInt)) Equal to Hammer of Retribution
                  • (Item-type of (Item carried by (Triggering unit) in slot loopInt)) Equal to Helm of Retribution
                  • (Item-type of (Item carried by (Triggering unit) in slot loopInt)) Equal to Pants of Retribution
            • Then - Actions
              • Set PartCount = (PartCount + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • PartCount Less than 2
                • Then - Actions
                  • Unit - Remove 2 Parts of The Holy Vestments from (Triggering unit)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • PartCount Less than 4
                • Then - Actions
                  • Unit - Remove 4 Parts of The Holy Vestments from (Triggering unit)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • PartCount Greater than or equal to 2
                • Then - Actions
                  • Unit - Add 2 Parts of The Holy Vestments to (Triggering unit)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • PartCount Greater than or equal to 4
                • Then - Actions
                  • Unit - Add 4 Parts of The Holy Vestments to (Triggering unit)
                • Else - Actions
            • Else - Actions
      • Game - Display to (All players) the text: (String(PartCount))
but it's failed...
when i pick it goes 1 2 3 4 5 fluently
but when i drop it, it should be 4 3 2 1 0, but it's showing 5 4 3 2 1 like as the first drop didn't count.
I knew that i could divided them to 2 triggers, but as long as 1 trigger worked, it would be simpler, isn't it ?

i'll try what you guys suggested, thanks a lot.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Nonono, that is just your reference point.
You see, the trigger can never show itemCounter == 0 without using the approach that I've been suggesting (except with Timers).

Therefore, you have to acknowledge yourself when itemCounter gives a value of '1', it means the unit doesn't has any item at all.

But I still think that by using Timer would work better, easy to handle and manage.
 
Status
Not open for further replies.
Top