• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

[Solved] Item charges: make new item when charges remaining equal to specific number

Status
Not open for further replies.
Event:
Unit gets item

And - all (conditions) are True
1.Item type of (item being manipulated) equal (insert your item)
2.Hero manipulating item has an item of type (insert your item) equal Yes
3.Item being manipulated not equal Item carried by hero manipulating item of type (insert your item)

Action:
1.Item set charges remaining in item carried by hero manipulating item of type (insert your item) to charges remaining in item carried by hero manipuilating item of type (insert your item) + charges remaining in item being manipulated
2.Item remove (item being manipulated)
3.If (all conditions are True) then do (then actions) else do (else actions)
1.Charges remaining in item carried by hero manipulating item of type (insert your item)
Then:
Item remove item carried by hero manipulating item of type (insert your item)
Hero - create (new item) and give it to Hero manipulating item
Item - make (last created item) invulnerable
Else:


Explanation:
It doesnt work. When i pick up items it gains charges, but when it becomes equal 5 it doesnt remove and doesnt give item to hero. It also may become more than 5

What I ask for:
I need when item charges remaining become 5, it is removed and adds whole new item.
 
Level 24
Joined
Feb 27, 2019
Messages
785
On newer versions inside of gameplay constants there is an option called Inventory - Enable Item Stacking that can be set to True. This allows the game to handle the charges/stacks automatically. All that is needed is to change each items Max Stacks to the desired maximum amount of stacks. With that set you can use this trigger.
  • Replace Stacked Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Potion of Healing
    • Actions
      • Set VariableSet TempUnit = (Triggering unit)
      • For each (Integer ItemL) from 1 to 6, 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 TempUnit in slot ItemL)) Equal to Potion of Healing
              • (Charges remaining in (Item carried by TempUnit in slot ItemL)) Equal to 5
            • Then - Actions
              • Item - Remove (Item carried by TempUnit in slot ItemL)
              • Hero - Create Potion of Greater Healing and give it to TempUnit
              • Custom script: exitwhen true
            • Else - Actions
 
could you send map?
On newer versions inside of gameplay constants there is an option called Inventory - Enable Item Stacking that can be set to True. This allows the game to handle the charges/stacks automatically. All that is needed is to change each items Max Stacks to the desired maximum amount of stacks. With that set you can use this trigger.
  • Replace Stacked Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Potion of Healing
    • Actions
      • Set VariableSet TempUnit = (Triggering unit)
      • For each (Integer ItemL) from 1 to 6, 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 TempUnit in slot ItemL)) Equal to Potion of Healing
              • (Charges remaining in (Item carried by TempUnit in slot ItemL)) Equal to 5
            • Then - Actions
              • Item - Remove (Item carried by TempUnit in slot ItemL)
              • Hero - Create Potion of Greater Healing and give it to TempUnit
              • Custom script: exitwhen true
            • Else - Actions
 
Level 24
Joined
Feb 27, 2019
Messages
785
I dont think theres built in stacking in version 1.27. However there was stacking made by players before that already. Since its pretty hard to make it work flawlessly I just dont have the time or energy to make an item stack. There is plenty of better information on how to do it out there though.
 
1681035749219.png
 
Status
Not open for further replies.
Top