• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Item Condition

Status
Not open for further replies.
I am making a bounty system.
So a neutral hostile has a chance to drop an item called bounty.
There are 5 bounty items.
Bounty level 1
Bounty level 2
...
Bounty level 5

Neutral Hostile doesn't give you gold when killed right away, instead they drop one of these items based on the level of the creep.
Then, you transfer those bounty items to a unit called "Bounty Table".
The Bounty Table now has the bounty item on his inventory.
and when the Bounty Table is targeted with the "interact" ability

Events - A unit starts the effects of an ability

The Bounty Table should destroy the Bounty Item and give the casting unit gold based on
(Bounty Level x multiplied by 25) + Intelligence of Triggering Unit.

The Question is, what condition do i use to check if the bounty table has a bounty item.
 
If your Bounty Table is a unit this should do the trick :

  • Give Item
    • Events
    • Conditions
    • Actions
      • 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 Bounty Table <gen> in slot (Integer A)) Not equal to (Load 0 of 0 in (Last created hashtable))
            • Then - Actions
              • Hero - Give (Item carried by Bounty Table <gen> in slot (Integer A)) to MyUnit <gen>
            • Else - Actions
 
Not sure what Swatosj is on about, that won’t do anything.

Easiest solution is to store the different bounty item types in an array, then loop over the item slots checking if any slot has a matching item, then award gold if it does.

  • Set BountyItem[1] = Bounty level 1
  • Etc.
  • Set BountyLevels = 5
  • ———— ————
  • For each (Integer A) from 1 to 6 do (actions)
    • Loop - Actions
      • For each (Integer B) from 1 to BountyLevels do (Actions)
        • Loop - Actions
          • If...
            • If - Conditions
              • (Item type of (Item carried by BountyTable in slot (Integer A)) equal to BountyItem[Integer B])
            • Then - Actions
              • ———— grant gold, destroy item, etc ————
 
@Pyrogasm Yes he could use an array but I've understood the Bounty Table is a unit so if this one carries the items in his inventory my solution is working as OP was asking for a condition :)
 
Not sure what Swatosj is on about, that won’t do anything.

Easiest solution is to store the different bounty item types in an array, then loop over the item slots checking if any slot has a matching item, then award gold if it does.

  • Set BountyItem[1] = Bounty level 1
  • Etc.
  • Set BountyLevels = 5
  • ———— ————
  • For each (Integer A) from 1 to 6 do (actions)
    • Loop - Actions
      • For each (Integer B) from 1 to BountyLevels do (Actions)
        • Loop - Actions
          • If...
            • If - Conditions
              • (Item type of (Item carried by BountyTable in slot (Integer A)) equal to BountyItem[Integer B])
            • Then - Actions
              • ———— grant gold, destroy item, etc ————
i wil try this when i get home, is there a function to drop every item from bounty table's that is not bounty?
 
No, you will have to check the item vs. all possibly bounty items and drop it if it doesn't match any of the items in the array.
  • Set BountyItem[1] = Bounty level 1
  • Etc.
  • Set BountyLevels = 5
  • -------- --------
  • For each (Integer A) from 1 to 6 do (actions)
    • Loop - Actions
      • Set IsBountyItem = False //boolean variable
      • For each (Integer B) from 1 to BountyLevels 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 BountyTable in slot (Integer A)) equal to BountyItem[Integer B])
            • Then - Actions
              • Set IsBountyItem = True
              • -------- grant gold, destroy item, etc --------
            • Else - Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • IsBountyItem equal to false //it didn't match any if its still false
        • Then - Actions
          • Unit - Cause BountyTable to drop Item in Slot (Integer A)
        • Else - Actions
 
Status
Not open for further replies.
Back
Top