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

How to increase the max amount of charges of a potion

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
Say, i have a potion. How do i get it so, when you sell from a vendor, it gives you 5 but the maximum is 60?
 
Level 11
Joined
Nov 15, 2007
Messages
800
  • Chargestack
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Charged
    • Actions
      • Hero - Drop (Item being manipulated) from (Triggering unit)
      • 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-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
              • ((Charges remaining in (Item being manipulated)) + (Charges remaining in (Item carried by (Triggering unit) in slot (Integer A)))) Less than or equal to 60
            • Then - Actions
              • Item - Set charges remaining in (Item carried by (Triggering unit) in slot (Integer A)) to ((Charges remaining in (Item being manipulated)) + (Charges remaining in (Item carried by (Triggering unit) in slot (Integer A))))
              • Item - Remove (Item being manipulated)
              • Skip remaining actions
            • Else - Actions
              • Set boolean = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • boolean Equal to True
        • Then - Actions
          • Set boolean = False
          • Trigger - Turn off (This trigger)
          • Hero - Give (Item being manipulated) to (Triggering unit)
          • Trigger - Turn on (This trigger)
        • Else - Actions
I've never actually made a stacking trigger with a limit on max stacks, so there's probably a more optimal way to do it - but this works fine. Just change the conditions if you only want it to apply to a specific type or types of item rather than all charged items.

Edit: Oh, and if you want charged items to be purchasable with a full inventory, it's a whole different, slightly longer trigger, and would require you to remake any such items in the object editor twice.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
  • Chargestack
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Charged
    • Actions
      • Hero - Drop (Item being manipulated) from (Triggering unit)
      • 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-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
              • ((Charges remaining in (Item being manipulated)) + (Charges remaining in (Item carried by (Triggering unit) in slot (Integer A)))) Less than or equal to 60
            • Then - Actions
              • Item - Set charges remaining in (Item carried by (Triggering unit) in slot (Integer A)) to ((Charges remaining in (Item being manipulated)) + (Charges remaining in (Item carried by (Triggering unit) in slot (Integer A))))
              • Item - Remove (Item being manipulated)
              • Skip remaining actions
            • Else - Actions
              • Set boolean = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • boolean Equal to True
        • Then - Actions
          • Set boolean = False
          • Trigger - Turn off (This trigger)
          • Hero - Give (Item being manipulated) to (Triggering unit)
          • Trigger - Turn on (This trigger)
        • Else - Actions
I've never actually made a stacking trigger with a limit on max stacks, so there's probably a more optimal way to do it - but this works fine. Just change the conditions if you only want it to apply to a specific type or types of item rather than all charged items.

Edit: Oh, and if you want charged items to be purchasable with a full inventory, it's a whole different, slightly longer trigger, and would require you to remake any such items in the object editor twice.

Does it really need triggers...?
 
Level 6
Joined
Jun 18, 2011
Messages
168
I'm think this is what you want:

  • More Charges 2
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Your Item
    • Actions
      • Item - Set charges remaining in (Item being manipulated) to 5
I think you wanted the charges you recieve to be 5. So, set the number of charges in the object editor to 60, but change the number of charges when you aquire the item to 5 using the trigger editor. Then, you'll need another trigger to get you to the max stacks. Although, you never mentioned having the max stacks.
 
Last edited:
Status
Not open for further replies.
Top