hi friends do you know guys how make a spell with charge system like Explosion Rune.
thanks a lot.On version 1.31+ you can manually start the cooldown of an ability as well as modify it's tooltip at runtime. So by setting the ability cooldown to 0 in the Object Editor, relying on a Timer for the "charge interval", and managing the charges (+1, -1) as needed, you can create this effect for any ability.
Here's an example using Holy Light as the base ability.
Note that this only works for ONE hero with the Holy Light ability at a time:
Holy Light Learn
Events
Unit - A unit Learns a skill
Conditions
(Learned Hero Skill) Equal to Holy Light
Actions
-------- Track the hero, starting charges, max charges, and interval between gaining charges: --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Learned skill level) Equal to 1
Then - Actions
Set VariableSet Holy_Light_Hero = (Triggering unit)
Set VariableSet Holy_Light_Charges = 1
Set VariableSet Holy_Light_Charges_Max = 3
Set VariableSet Holy_Light_Charges_Interval = 6.00
Countdown Timer - Start Holy_Light_Timer as a Repeating timer that will expire in Holy_Light_Charges_Interval seconds
Else - Actions
-------- --------
-------- Update the extended tooltip of the ability to show the charges: --------
Trigger - Run Holy Light Update Tooltip <gen> (ignoring conditions)
Holy Light Gain Charge
Events
Time - Holy_Light_Timer expires
Conditions
Actions
-------- Add a charge every X seconds if not already at max: --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Holy_Light_Charges Less than Holy_Light_Charges_Max
Then - Actions
Set VariableSet Holy_Light_Charges = (Holy_Light_Charges + 1)
-------- --------
-------- Update the extended tooltip of the ability to show the charges: --------
Trigger - Run Holy Light Update Tooltip <gen> (ignoring conditions)
-------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Holy_Light_Charges Equal to Holy_Light_Charges_Max
Then - Actions
Countdown Timer - Pause Holy_Light_Timer
Else - Actions
Else - Actions
Holy Light Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Holy Light
Actions
-------- Subtract a charge and start the cooldown if you run out: --------
Set VariableSet Holy_Light_Charges = (Holy_Light_Charges - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Holy_Light_Charges Equal to 0
Then - Actions
Unit - For Unit Holy_Light_Hero, start cooldown of ability (Ability being cast) " over "(Remaining time for Holy_Light_Timer) seconds.
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Holy_Light_Charges Equal to (Holy_Light_Charges_Max - 1)
Then - Actions
Countdown Timer - Start Holy_Light_Timer as a Repeating timer that will expire in Holy_Light_Charges_Interval seconds
Else - Actions
-------- --------
-------- Update the extended tooltip of the ability to show the charges: --------
Trigger - Run Holy Light Update Tooltip <gen> (ignoring conditions)
Holy Light Update Tooltip
Events
Conditions
Actions
-------- Apply the tooltip to the ability: --------
Set VariableSet Holy_Light_Tooltip = (A holy light that can heal a friendly living unit for + ((String((200 x (Level of Holy Light for Holy_Light_Hero)))) + ( or deal half damage to an enemy Undead unit. + (|n|nCharges: + ((String(Holy_Light_Charges)) + (/ + (String(Holy_Light_Charges_Max)))))
Ability - Set Extended Tooltip of Holy Light to Holy_Light_Tooltip for level ((Level of Holy Light for Holy_Light_Hero) - 1)
another question do you know how can i add small number count to ability icon with trigger?On version 1.31+ you can manually start the cooldown of an ability as well as modify it's tooltip at runtime. So by setting the ability cooldown to 0 in the Object Editor, relying on a Timer for the "charge interval", and managing the charges (+1, -1) as needed, you can create this effect for any ability.
Here's an example using Holy Light as the base ability.
Note that this only works for ONE hero with the Holy Light ability at a time:
Holy Light Learn
Events
Unit - A unit Learns a skill
Conditions
(Learned Hero Skill) Equal to Holy Light
Actions
-------- Track the hero, starting charges, max charges, and interval between gaining charges: --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Learned skill level) Equal to 1
Then - Actions
Set VariableSet Holy_Light_Hero = (Triggering unit)
Set VariableSet Holy_Light_Charges = 1
Set VariableSet Holy_Light_Charges_Max = 3
Set VariableSet Holy_Light_Charges_Interval = 6.00
Countdown Timer - Start Holy_Light_Timer as a Repeating timer that will expire in Holy_Light_Charges_Interval seconds
Else - Actions
-------- --------
-------- Update the extended tooltip of the ability to show the charges: --------
Trigger - Run Holy Light Update Tooltip <gen> (ignoring conditions)
Holy Light Gain Charge
Events
Time - Holy_Light_Timer expires
Conditions
Actions
-------- Add a charge every X seconds if not already at max: --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Holy_Light_Charges Less than Holy_Light_Charges_Max
Then - Actions
Set VariableSet Holy_Light_Charges = (Holy_Light_Charges + 1)
-------- --------
-------- Update the extended tooltip of the ability to show the charges: --------
Trigger - Run Holy Light Update Tooltip <gen> (ignoring conditions)
-------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Holy_Light_Charges Equal to Holy_Light_Charges_Max
Then - Actions
Countdown Timer - Pause Holy_Light_Timer
Else - Actions
Else - Actions
Holy Light Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Holy Light
Actions
-------- Subtract a charge and start the cooldown if you run out: --------
Set VariableSet Holy_Light_Charges = (Holy_Light_Charges - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Holy_Light_Charges Equal to 0
Then - Actions
Unit - For Unit Holy_Light_Hero, start cooldown of ability (Ability being cast) " over "(Remaining time for Holy_Light_Timer) seconds.
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Holy_Light_Charges Equal to (Holy_Light_Charges_Max - 1)
Then - Actions
Countdown Timer - Start Holy_Light_Timer as a Repeating timer that will expire in Holy_Light_Charges_Interval seconds
Else - Actions
-------- --------
-------- Update the extended tooltip of the ability to show the charges: --------
Trigger - Run Holy Light Update Tooltip <gen> (ignoring conditions)
Holy Light Update Tooltip
Events
Conditions
Actions
-------- Apply the tooltip to the ability: --------
Set VariableSet Holy_Light_Tooltip = (A holy light that can heal a friendly living unit for + ((String((200 x (Level of Holy Light for Holy_Light_Hero)))) + ( or deal half damage to an enemy Undead unit. + (|n|nCharges: + ((String(Holy_Light_Charges)) + (/ + (String(Holy_Light_Charges_Max)))))
Ability - Set Extended Tooltip of Holy Light to Holy_Light_Tooltip for level ((Level of Holy Light for Holy_Light_Hero) - 1)
I think the best solution would be to create a series of custom icons that display the different number of charges. This is surprisingly easy to do with a little copy and paste in GIMP, Paint, Photoshop, etc. There's plenty of tutorials on Hive that help explain the process of creating your own icons.another question do you know how can i add small number count to ability icon with trigger?
Thanks alot.I think the best solution would be to create a series of custom icons that display the different number of charges. This is surprisingly easy to do with a little copy and paste in GIMP, Paint, Photoshop, etc. There's plenty of tutorials on Hive that help explain the process of creating your own icons.
Then you can use a String array variable to track the file paths of these newly imported icons:
And update the icon using this Action in combination with your String array:
Set Variable Holy_Light_Icon[0] = ReplaceableTextures\CommandButtons\BTNHolyBolt.blp
Set Variable Holy_Light_Icon[1] = ReplaceableTextures\CommandButtons\BTNHolyBolt1.blp
Set Variable Holy_Light_Icon[2] = ReplaceableTextures\CommandButtons\BTNHolyBolt2.blp
Set Variable Holy_Light_Icon[3] = ReplaceableTextures\CommandButtons\BTNHolyBolt3.blp
This could take place in the Holy Light Update Tooltip trigger.
Ability - Set Icon of Holy Light to Holy_Light_Icon[Holy_Light_Charges]
So in this example I have 3 new icons that represent Charges 1 to 3. When you run out of Charges it will use the default icon.
Note that this "Set Icon" Action is a global change and will affect every single Holy Light ability. I believe you can get around this by using GetLocalPlayer() but it'd still be limited to one Holy Light per Player.