• 🏆 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!

[Trigger] Magic Stick (Energy Charge) - MUI Item Ability

Status
Not open for further replies.
Level 4
Joined
Sep 25, 2018
Messages
81
I am trying to create an item, like magic stick from Dota, which restores 15 health and mana based on the number of charges the item has.

When the item is bought, it starts with 0 charges. The number of charges increases by +1 every time an enemy or neutral unit casts an ability within 800 of the item carrier, up to a maximum of 10 charges. When the item is used, the unit has [15 x (number of charges)] health and mana restored, and the charges are reset to 0.

I seem to be having an issue when there is only 1 charge in the item. If I have 2 charges, the item works correctly and give me +30 health and mana. But if I have only one charge, it doesn't do anything...

Here is what I have so far, I am just wondering if there is a better way of doing this.

  • MagicStickCharge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • -------- - --------
      • -------- Set MS_Point --------
      • Set VariableSet MS_Point = (Position of (Triggering unit))
      • -------- - --------
      • -------- Add to MS_UnitGroup --------
      • Set VariableSet MS_UnitGroup = (Units within 800.00 of MS_Point matching (((Matching unit) has an item of type Magic Stick) Equal to True).)
      • -------- - --------
      • -------- Add charge to MagicStick --------
      • Unit Group - Pick every unit in MS_UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is visible to (Owner of (Picked unit)).) Equal to True
              • ((Triggering unit) belongs to an ally of (Owner of (Picked unit)).) Not equal to True
              • (Charges remaining in (Item carried by (Picked unit) of type Magic Stick)) Less than 10
              • (Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Boolean Field: Item Ability ('aite')) Not equal to True
            • Then - Actions
              • Item - Set charges remaining in (Item carried by (Picked unit) of type Magic Stick) to ((Charges remaining in (Item carried by (Picked unit) of type Magic Stick)) + 1)
            • Else - Actions
      • -------- - --------
      • -------- Clean up --------
      • Custom script: call RemoveLocation (udg_MS_Point)
      • Custom script: call DestroyGroup (udg_MS_UnitGroup)

  • MagicStickUse
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Magic Stick
    • Actions
      • -------- - --------
      • -------- Use MagicStick --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Charges remaining in (Item being manipulated)) Greater than 0
        • Then - Actions
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (15.00 + (Real((15 x (Charges remaining in (Item being manipulated)))))))
          • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + (15.00 + (Real((15 x (Charges remaining in (Item being manipulated)))))))
          • Item - Set charges remaining in (Item being manipulated) to 0
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIre\AIreTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
 
Last edited:
Level 25
Joined
Sep 26, 2009
Messages
2,387
Looking at the code, I do not see any apparent issue.
But what you wrote and the triggers you posted do not match. You wrote that 2 charges give you correctly 30hp/mp, but that is not what the trigger should be doing.
If "charges remaining" is 2, then the calculation: (15.00 + (Real((15 x (Charges remaining in (Item being manipulated))) should give you +45 hp/mp.

Also, when you use an item that has an ability tied to it, you actually also trigger the "Unit starts the effect of an ability" event - it may be good idea to put a condition right below the events section in MAgicStickCharge trigger ( (Ability being cast) Not equal to YourMagicStickAbility) - this way you may prevent the trigger from messing things up unintentionally.

I advise just using game messages to print values - the easiest one is to print the remaining charges on the item, so that you can see what is actually going on in your triggers
 
Level 4
Joined
Sep 25, 2018
Messages
81
But what you wrote and the triggers you posted do not match. You wrote that 2 charges give you correctly 30hp/mp, but that is not what the trigger should be doing.
Yeah, this is my problem. It seems to not register the fact that there is 1 charge in the item.

If "charges remaining" is 2, then the calculation: (15.00 + (Real((15 x (Charges remaining in (Item being manipulated))) should give you +45 hp/mp.
I initially had the trigger like you have here, but the hp/mp return was always 15 less than it should be.

- it may be good idea to put a condition right below the events section in MAgicStickCharge trigger ( (Ability being cast) Not equal to YourMagicStickAbility) - this way you may prevent the trigger from messing things up unintentionally.
Thats why I have this part here, it will not gain a charge with any item ability.
if.gif
(Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Boolean Field: Item Ability ('aite')) Not equal to True

I advise just using game messages to print values - the easiest one is to print the remaining charges on the item, so that you can see what is actually going on in your triggers
Strangely, I tried this, after you mentioned to do it, and it does say that there is 1 charge in the item (when there is supposed to be 1 charge). However, it still does not register the fact that there is 1 charge when I activate the item.

Edit: Just did a few more tests to see what the problem could be. It seems that if you only have 1 charge in an item, the charge gets used up before the trigger has time to recognise the 1 charge. Also, it seems, you cannot have a charged item that starts with no charges. (I suppose that does make sense).

Edit Edit: Ok, it seems the previous edit is partially correct. The reason for the trigger’s calculation being [15 + 15 x (number of charges)] is because when you activate the item, 1 charge is used when the trigger fires. For example, if I had 10 charges, then activate Magic Stick, I will actually have 9 charges when the trigger calculates how many charges are multiplied by 15. Therefore there is a problem when I only have 1 charge left. Because when the item is activated, it now has 0 charges left, which means the trigger will not fire at all because “Charges remaining in (Item being manipulated))” is 0.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
You could use an Item Indexer and manually track the charges on the Item with an Integer variable. This way you would always have the correct amount of charges and would be in control of everything.

But before doing that, I would check to see if there is an option to prevent an Item from consuming charges upon use.
 
Level 4
Joined
Sep 25, 2018
Messages
81
You could use an Item Indexer and manually track the charges on the Item with an Integer variable.
Just gave it some thought and have come up with a simple solution to the problem. I think an Item Indexer might be more complicated than it needs to be.

I would check to see if there is an option to prevent an Item from consuming charges upon use.
Unfortunately, there is no option. That would make my life a lot easier!

I think I have found a simple solution to the problem. By turning off/on the Stats - Actively Used part of the item.

  • MagicStickCharge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • -------- - --------
      • -------- Set MS_Point --------
      • Set VariableSet MS_Point = (Position of (Triggering unit))
      • -------- - --------
      • -------- Add to MS_UnitGroup --------
      • Set VariableSet MS_UnitGroup = (Units within 800.00 of MS_Point matching (((Matching unit) has an item of type Magic Stick) Equal to True).)
      • -------- - --------
      • -------- Add charge to MagicStick --------
      • Unit Group - Pick every unit in MS_UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is visible to (Owner of (Picked unit)).) Equal to True
              • ((Triggering unit) belongs to an ally of (Owner of (Picked unit)).) Not equal to True
              • (Charges remaining in (Item carried by (Picked unit) of type Magic Stick)) Less than 10
              • (Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Boolean Field: Item Ability ('aite')) Not equal to True
            • Then - Actions
              • Item - Set charges remaining in (Item carried by (Picked unit) of type Magic Stick) to ((Charges remaining in (Item carried by (Picked unit) of type Magic Stick)) + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Charges remaining in (Item carried by (Picked unit) of type Magic Stick)) Greater than 0
                • Then - Actions
                  • Item - Set Item: (Item carried by (Picked unit) of type Magic Stick)'s Boolean Field: Actively Used ('iusa') to Value: True
                • Else - Actions
            • Else - Actions
      • -------- - --------
      • -------- Clean up --------
      • Custom script: call RemoveLocation (udg_MS_Point)
      • Custom script: call DestroyGroup (udg_MS_UnitGroup)
  • MagicStickUse
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Magic Stick
    • Actions
      • -------- - --------
      • -------- Use MagicStick --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Charges remaining in (Item being manipulated)) Greater than 0
        • Then - Actions
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (15.00 x (Real((Charges remaining in (Item being manipulated))))))
          • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + (15.00 x (Real((Charges remaining in (Item being manipulated))))))
          • Item - Set charges remaining in (Item being manipulated) to 0
          • Item - Set Item: (Item being manipulated)'s Boolean Field: Actively Used ('iusa') to Value: False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Charges remaining in (Item being manipulated)) Equal to 0
          • (Item: (Item being manipulated)'s Boolean Field: Actively Used ('iusa')) Equal to True
        • Then - Actions
          • Item - Set Item: (Item being manipulated)'s Boolean Field: Actively Used ('iusa') to Value: False
        • Else - Actions

Probably needs cleaning up, removing unnecessary Boolean, but this pretty much works! What do you think?

I just need to think about what happens if the unit has more than one magic stick in his inventory.

Edit: Ok, so after some testing, I have found that the method I just posted does not work either. I have now tried adding/removing the ability from the item, and it works pretty nicely!

  • MagicStickCharge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • -------- - --------
      • -------- Set MS_Point --------
      • Set VariableSet MS_Point = (Position of (Triggering unit))
      • -------- - --------
      • -------- Add to MS_UnitGroup --------
      • Set VariableSet MS_UnitGroup = (Units within 800.00 of MS_Point matching (((Matching unit) has an item of type Magic Stick) Equal to True).)
      • -------- - --------
      • -------- Add charge MagicStick --------
      • Unit Group - Pick every unit in MS_UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is visible to (Owner of (Picked unit)).) Equal to True
              • ((Triggering unit) belongs to an ally of (Owner of (Picked unit)).) Not equal to True
              • (Charges remaining in (Item carried by (Picked unit) of type Magic Stick)) Less than 10
              • (Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Boolean Field: Item Ability ('aite')) Not equal to True
            • Then - Actions
              • Item - Set charges remaining in (Item carried by (Picked unit) of type Magic Stick) to ((Charges remaining in (Item carried by (Picked unit) of type Magic Stick)) + 1)
              • -------- - --------
              • -------- Give ability ItemEnergyCharge --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Item Energy Charge for (Picked unit)) Less than or equal to 0
                • Then - Actions
                  • Item - For Item: (Item carried by (Picked unit) of type Magic Stick), Add Ability: Item Energy Charge
                • Else - Actions
            • Else - Actions
      • -------- - --------
      • -------- Clean up --------
      • Custom script: call RemoveLocation (udg_MS_Point)
      • Custom script: call DestroyGroup (udg_MS_UnitGroup)
  • MagicStickUse
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Magic Stick
    • Actions
      • -------- - --------
      • -------- Remove ability ItemEnergyCharge --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Item Energy Charge for (Triggering unit)) Greater than or equal to 1
        • Then - Actions
          • Item - For Item: (Item carried by (Triggering unit) of type Magic Stick), Remove Ability: Item Energy Charge
        • Else - Actions
      • -------- - --------
      • -------- Use MagicStick --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Charges remaining in (Item being manipulated)) Greater than 0
        • Then - Actions
          • -------- - --------
          • -------- HP/MP gain based on charges --------
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (15.00 x (Real((Charges remaining in (Item being manipulated))))))
          • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + (15.00 x (Real((Charges remaining in (Item being manipulated))))))
          • -------- - --------
          • -------- Set charges MagicStick 0 --------
          • Item - Set charges remaining in (Item being manipulated) to 0
        • Else - Actions

Now if I wanted to have a cooldown when there are no charges, I can just create a dummy ability for the item and add/remove it when I add/remove the actual ability.
 
Last edited:
Level 4
Joined
Sep 25, 2018
Messages
81
You could use an Item Indexer and manually track the charges on the Item with an Integer variable. This way you would always have the correct amount of charges and would be in control of everything.

But before doing that, I would check to see if there is an option to prevent an Item from consuming charges upon use.
Had another attempt with the trigger.

Basically, I needed to have a cooldown on the item after it is used, otherwise the charges gained, if a unit casts an ability straight you have already used Magic Stick, can be used straight away with no cooldown. If I remove the ability from the item, you do not get a cooldown after activating the item.

I decided I needed to use a timer while the item is on cooldown, then remove the ability from the item once the cooldown is finished. I feel like using Hashtables may be overkill, but it seems to be pretty much working.

  • MagicStickCharge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • -------- - --------
      • -------- Set MS_Point --------
      • Set VariableSet MS_Point = (Position of (Triggering unit))
      • -------- - --------
      • -------- Add to MS_UnitGroup --------
      • Set VariableSet MS_UnitGroup = (Units within 800.00 of MS_Point matching (((Matching unit) has an item of type Magic Stick) Equal to True).)
      • -------- - --------
      • -------- Edit MagicStick --------
      • Unit Group - Pick every unit in MS_UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is visible to (Owner of (Picked unit)).) Equal to True
              • ((Triggering unit) belongs to an ally of (Owner of (Picked unit)).) Not equal to True
              • (Charges remaining in (Item carried by (Picked unit) of type Magic Stick)) Less than 10
              • (Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Boolean Field: Item Ability ('aite')) Not equal to True
            • Then - Actions
              • -------- - --------
              • -------- Add charge MagicStick --------
              • Item - Set charges remaining in (Item carried by (Picked unit) of type Magic Stick) to ((Charges remaining in (Item carried by (Picked unit) of type Magic Stick)) + 1)
              • -------- - --------
              • -------- Add ability ItemEnergyCharge --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Item Energy Charge for (Picked unit)) Less than or equal to 0
                • Then - Actions
                  • Item - For Item: (Item carried by (Picked unit) of type Magic Stick), Add Ability: Item Energy Charge
                • Else - Actions
            • Else - Actions
      • -------- - --------
      • -------- Clean up --------
      • Custom script: call RemoveLocation (udg_MS_Point)
      • Custom script: call DestroyGroup (udg_MS_UnitGroup)
  • MagicStickUse
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Magic Stick
    • Actions
      • -------- - --------
      • -------- Save key for MS_DurationHandle --------
      • Hashtable - Save 10.00 as (Key MS_DurationHandle.) of (Key MS_TempHandle.) in MS_HastTable.
      • -------- - --------
      • -------- Add to MS_UnitGroup_Timer --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in MS_UnitGroup_Timer.) Equal to False
        • Then - Actions
          • Unit Group - Add (Triggering unit) to MS_UnitGroup_Timer
        • Else - Actions
      • -------- - --------
      • -------- Use MagicStick --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Charges remaining in (Item being manipulated)) Greater than 0
        • Then - Actions
          • -------- - --------
          • -------- HP/MP gain based on charges --------
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (15.00 x (Real((Charges remaining in (Item being manipulated))))))
          • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + (15.00 x (Real((Charges remaining in (Item being manipulated))))))
          • -------- - --------
          • -------- Set charges MagicStick 0 --------
          • Item - Set charges remaining in (Item being manipulated) to 0
        • Else - Actions
      • -------- - --------
      • -------- Turn on MagicStickTimer --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (MagicStickTimer <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on MagicStickTimer <gen>
        • Else - Actions
  • MagicStickTimer
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in MS_UnitGroup_Timer and do (Actions)
        • Loop - Actions
          • -------- - --------
          • -------- Set Variables --------
          • Set VariableSet MS_TempUnit = (Picked unit)
          • Set VariableSet MS_TempHandle = (Picked unit)
          • Set VariableSet MS_Duration = (Load (Key MS_DurationHandle.) of (Key MS_TempHandle.) from MS_HastTable.)
          • -------- - --------
          • -------- Remove MS_UnitGroup_Timer --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (MS_TempUnit is alive) Not equal to True
                  • (Charges remaining in (Item carried by MS_TempUnit of type Magic Stick)) Greater than 0
            • Then - Actions
              • Unit Group - Remove MS_TempUnit from MS_UnitGroup_Timer.
            • Else - Actions
              • -------- - --------
              • -------- Loop until cooldown finishes --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • MS_Duration Greater than 0.00
                • Then - Actions
                  • Hashtable - Save (MS_Duration - 0.10) as (Key MS_DurationHandle.) of (Key MS_TempHandle.) in MS_HastTable.
                • Else - Actions
                  • -------- - --------
                  • -------- Reset MS_HashTable --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Item Energy Charge for MS_TempUnit) Greater than or equal to 1
                    • Then - Actions
                      • Item - For Item: (Item carried by MS_TempUnit of type Magic Stick), Remove Ability: Item Energy Charge
                    • Else - Actions
                  • Hashtable - Clear all child hashtables of child (Key MS_TempHandle.) in MS_HastTable.
                  • Unit Group - Remove MS_TempUnit from MS_UnitGroup_Timer.
          • -------- - --------
          • -------- Turn off MagicStickTimer --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in MS_UnitGroup_Timer) Equal to 0
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
In your Use trigger you never Set the Handle variables:
  • Hashtable - Save 10.00 as (Key MS_DurationHandle.) of (Key MS_TempHandle.) in MS_HastTable.
And it looks like MS_DurationHandle serves no real purpose besides organization? You could just save it as 0 or something.

Also, don't "Turn off MagicStickTimer" inside of the Pick every unit function. There's no reason to ask that question once for each picked unit, instead, check if the unit group is empty at the end of the trigger.
 
Level 4
Joined
Sep 25, 2018
Messages
81
In your Use trigger you never Set the Handle variables:
  • Hashtable - Save 10.00 as (Key MS_DurationHandle.) of (Key MS_TempHandle.) in MS_HastTable.
And it looks like MS_DurationHandle serves no real purpose besides organization? You could just save it as 0 or something.

Also, don't "Turn off MagicStickTimer" inside of the Pick every unit function. There's no reason to ask that question once for each picked unit, instead, check if the unit group is empty at the end of the trigger.
I believe I was right in thinking that using Hashtables for one simple item was complete overkill.

I presume that assigning custom values (integers) to items are unique to the item that the value has been assigned to.

What I have tried now is saving the number of charges as a custom value to each item that gains a charge. Then, when I activate the item, rather than checking the remaining charges the item has, I check the custom value, which does not “consume a charge” when said item is activated.

  • MagicStickCharge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • -------- - --------
      • -------- Set MS_Point --------
      • Set VariableSet MS_Point = (Position of (Triggering unit))
      • -------- - --------
      • -------- Add to MS_UnitGroup --------
      • Set VariableSet MS_UnitGroup = (Units within 800.00 of MS_Point matching (((Matching unit) has an item of type Magic Stick) Equal to True).)
      • -------- - --------
      • -------- Edit MagicStick --------
      • Unit Group - Pick every unit in MS_UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is visible to (Owner of (Picked unit)).) Equal to True
              • ((Triggering unit) belongs to an ally of (Owner of (Picked unit)).) Not equal to True
              • (Charges remaining in (Item carried by (Picked unit) of type Magic Stick)) Less than 10
              • (Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Boolean Field: Item Ability ('aite')) Not equal to True
            • Then - Actions
              • -------- - --------
              • -------- Add charge MagicStick --------
              • Item - Set charges remaining in (Item carried by (Picked unit) of type Magic Stick) to ((Charges remaining in (Item carried by (Picked unit) of type Magic Stick)) + 1)
              • Item - Set the custom value of (Item carried by (Picked unit) of type Magic Stick) to (Charges remaining in (Item carried by (Picked unit) of type Magic Stick))
            • Else - Actions
      • -------- - --------
      • -------- Clean up --------
      • Custom script: call RemoveLocation (udg_MS_Point)
      • Custom script: call DestroyGroup (udg_MS_UnitGroup)

  • MagicStickUse
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Magic Stick
    • Actions
      • -------- - --------
      • -------- Use MagicStick --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of (Item carried by (Triggering unit) of type Magic Stick)) Greater than 0
        • Then - Actions
          • -------- - --------
          • -------- HP/MP gain based on charges --------
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (15.00 x (Real((Custom value of (Item being manipulated))))))
          • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + (15.00 x (Real((Custom value of (Item being manipulated))))))
          • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Items\AIre\AIreTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • -------- - --------
          • -------- Set charges MagicStick 0 --------
          • Item - Set charges remaining in (Item being manipulated) to 0
          • Item - Set the custom value of (Item being manipulated) to 0
        • Else - Actions

Seems to be working nicely and should also work alongside an upcoming item which uses the same effect “Energy Charge” so both should go on cooldown when one is activated (which is what I want).
 
Status
Not open for further replies.
Top