• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Charges stacking when picking from ground/obtaining from the shop

Status
Not open for further replies.
Level 18
Joined
May 11, 2012
Messages
2,103
Can somebody take a good look at these triggers and tell me why sometimes this fails to combine charges from items I buy from shop/pick from ground?

There are times where I'll pick same item from the ground that I have in the inventory and it will just be there and won't fuse with existing item until I drop it and pick it up again, then it fuses.

  • Item Purchase Stack
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • -------- ------------------------------------------------------------------------------------- --------
      • Set TempUnit = (Buying unit)
      • Set TempItem = (Sold Item)
      • -------- ------------------------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Item-type of TempItem) Equal to Ankh
              • (Item-type of TempItem) Equal to Health Potion
              • (Item-type of TempItem) Equal to Mana Potion
              • (Item-type of TempItem) Equal to Ursa Warrior
          • (TempUnit has an item of type (Item-type of TempItem)) Equal to True
          • TempItem Not equal to (Item carried by TempUnit of type (Item-type of TempItem))
        • Then - Actions
          • -------- ------------------------------------------------------------------------------------- --------
          • Item - Set charges remaining in (Item carried by TempUnit of type (Item-type of TempItem)) to ((Charges remaining in (Item carried by TempUnit of type (Item-type of TempItem))) + 3)
          • Hero - Drop TempItem from TempUnit
          • Item - Remove TempItem
          • -------- ------------------------------------------------------------------------------------- --------
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of TempItem) Equal to Invurnerability
                  • (Item-type of TempItem) Equal to Infernal Warrior
              • (TempUnit has an item of type (Item-type of TempItem)) Equal to True
              • TempItem Not equal to (Item carried by TempUnit of type (Item-type of TempItem))
            • Then - Actions
              • -------- ------------------------------------------------------------------------------------- --------
              • Item - Set charges remaining in (Item carried by TempUnit of type (Item-type of TempItem)) to ((Charges remaining in (Item carried by TempUnit of type (Item-type of TempItem))) + 1)
              • Hero - Drop TempItem from TempUnit
              • Item - Remove TempItem
              • -------- ------------------------------------------------------------------------------------- --------
            • Else - Actions
      • -------- ------------------------------------------------------------------------------------- --------
      • Custom script: set udg_TempUnit = null
      • Custom script: set udg_TempItem = null
      • -------- ------------------------------------------------------------------------------------- --------
  • Item Charges Stack
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Ankh
          • (Item-type of (Item being manipulated)) Equal to Health Potion
          • (Item-type of (Item being manipulated)) Equal to Mana Potion
          • (Item-type of (Item being manipulated)) Equal to Invurnerability
          • (Item-type of (Item being manipulated)) Equal to Ursa Warrior
          • (Item-type of (Item being manipulated)) Equal to Infernal Warrior
      • ((Hero manipulating item) has an item of type (Item-type of (Item being manipulated))) Equal to True
      • (Item being manipulated) Not equal to (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated)))
    • Actions
      • -------- ------------------------------------------------------------------------------------- --------
      • Item - Set charges remaining in (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated))) to ((Charges remaining in (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated)))) + (Charges remaining in (Item being manipulated)))
      • Hero - Drop (Item being manipulated) from (Hero manipulating item)
      • Item - Remove (Item being manipulated)
      • -------- ------------------------------------------------------------------------------------- --------
 
Level 10
Joined
May 28, 2011
Messages
455
If I am not mistaken, just use Acquires an item. It should be a sufficient event for a unit to get item regardless from shop or ground or given by other units.

Add "call BJDebugMsg("?")" to every action of IF statement to see if its condition actually passes.
 
Level 18
Joined
May 11, 2012
Messages
2,103
If I am not mistaken, just use Acquires an item. It should be a sufficient event for a unit to get item regardless from shop or ground or given by other units.

Add "call BJDebugMsg("?")" to every action of IF statement to see if its condition actually passes.

I have these 2 sperate triggers because when you buy chargeable item from the shop, you always gain either 3 or 1 charge, depending on which item you bought.

But when you pick an item from the ground, that item may contain 50 000 charges, and I have to add the amount of charges the item has, so no, I can't just use "Aquires an item".

ALl the conditions pass, but I still can't figure out the problem why something the items bought from the shop won't combine with inventory (sometimes, this works most of the times tho).
 
Level 10
Joined
May 28, 2011
Messages
455
I have these 2 sperate triggers because when you buy chargeable item from the shop, you always gain either 3 or 1 charge, depending on which item you bought.

When a unit acquire an item. It can be from shop, ground or other units. So, when a unit purchase an item (trigger sell item) will immediately give the item to the purchasing unit (trigger acquire item). Therefore, 2 triggers execute immediately.

This is what I understand
If hero purchase item (in list) from shop and has that item, it gets additional 1 or 3 charges.
If hero acquire item, items' charge will be combined.

But when you pick an item from the ground, that item may contain 50 000 charges, and I have to add the amount of charges the item has, so no, I can't just use "Aquires an item".

Please make an example of this?

ALl the conditions pass, but I still can't figure out the problem why something the items bought from the shop won't combine with inventory (sometimes, this works most of the times tho).

There are times where I'll pick same item from the ground that I have in the inventory and it will just be there and won't fuse with existing item until I drop it and pick it up again, then it fuses.

Confused!
 
Status
Not open for further replies.
Top