• 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 cant get more than 2 items of type X

Status
Not open for further replies.
Level 7
Joined
Dec 28, 2009
Messages
257
Heya folks, another question of mine :D

Basically, i want my Heroes in map carry up to 1 Healing and Mana potion (1 of each), (youll buy those potions, and when you buy 2nd it should be removed or something) but i kinda cant figure it out, how to do it (cant find Integer condition "amount of items of type X carried by unit Y >1 etc), and id prefer doing it easiest way possible (its too simple, i think it should be possible with very complex trigger with many variables etc, but why make it complicated when it might work with one simple condition im missing?)

Current trigger

  • Unit - A unit Acquires an item
  • Or - Any (Conditions) are true
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Potion of Greater Healing
      • (Item-type of (Item being manipulated)) Equal to Potion of Greater Mana
  • Set Game_Hero_Buying_Potion = (Hero manipulating item)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Item carried by Game_Hero_Buying_Potion in slot 2) Equal to (Item carried by Game_Hero_Buying_Potion of type Potion of Greater Healing)
    • Then - Actions
      • Item - Remove (Item being manipulated)
      • Game - Display to (Player group((Owner of Game_Hero_Buying_Potion))) the text: You cant carry more...
    • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Game_Hero_Buying_Potion has an item of type Potion of Greater Mana) Equal to True
    • Then - Actions
      • Item - Remove (Item being manipulated)
      • Game - Display to (Player group((Owner of Game_Hero_Buying_Potion))) the text: You cant carry more...
    • Else - Actions
just removes bought potion just after you got it...

So, any help? thanks! :D
 
Level 7
Joined
Dec 28, 2009
Messages
257
Why use and-conditions if you have ony one condition ?

Please copy the whole trigger with ctrl+shift+c

Then
  • (Number of items carried by (Triggering unit)) Equal to 0

I guess i forget to delete it, i tried adding one more condition and doing some stuff but it didnt work (the 1st condition in Healing potion If-Then-Else is completely wrong, )

But that doesnt matter anyway, i said my trigger sucks, i just posted it ,dunnowhy, its obvious it sucks, :D

and,
  • (Number of items carried by (Triggering unit)) Equal to 0
I want my Heroes to carry other permanent items besides potions, and this would render them unable to carry both Mana and HP potion at once, wouldnt it?

So... help? :D
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
If you don't want unit to get an item twice or more, use this conditions:
  • ((Triggering unit) has an item of type Tome of Experience) Equal to True
else you would have to check each inventory slot and use an integer counter and then check if the counter is equal to 2 (= you have that item twice). If yes, remove item being manipulated.
 
Level 18
Joined
Sep 14, 2012
Messages
3,413
I guess i forget to delete it, i tried adding one more condition and doing some stuff but it didnt work (the 1st condition in Healing potion If-Then-Else is completely wrong, )

But that doesnt matter anyway, i said my trigger sucks, i just posted it ,dunnowhy, its obvious it sucks, :D

and,
  • (Number of items carried by (Triggering unit)) Equal to 0
I want my Heroes to carry other permanent items besides potions, and this would render them unable to carry both Mana and HP potion at once, wouldnt it?

So... help? :D

Oh sry my mind is west of there : pick the wrong one :/
 
Level 7
Joined
Dec 28, 2009
Messages
257
EDIT: I suck at JASS, ivew got no idea how to configure it (besides editing that non-JASS trigger with requirements etc, but ofc, i dont know how to remove requirement itself) so ill write to its created Doomlord for help.

Thanks anyway for this :D
 
Status
Not open for further replies.
Top