• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! 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.
Level 20
Joined
Mar 16, 2018
Messages
215
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 20
Joined
Feb 27, 2019
Messages
592
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 20
Joined
Mar 16, 2018
Messages
215
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 20
Joined
Feb 27, 2019
Messages
592
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.
 
Level 20
Joined
Mar 16, 2018
Messages
215
1681035749219.png
 
Status
Not open for further replies.
Top