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!
How to make computer unit cast spell with triger? For example i have unit that has Divine Shield, he supposed to soak some dmg and when HP is low - turn on the shield, but he cast it as soon as he he gets the first hit.
Computers have hardcoded AI that will dictate how they use abilities. You can't really control this but sometimes you can find workarounds.
Add your Paladin(s) to a Unit Group:
Paladin Group
Events
Map initialization
Conditions
Actions
Set VariableSet PaladinUnit = Paladin 0001 <gen>
Unit Group - Add PaladinUnit to PaladinGroup
Hero - Learn skill for PaladinUnit: Divine Shield
Player - Disable Divine Shield for (Owner of PaladinUnit)
Trigger - Turn on Paladin Loop <gen>
Then periodically check on these Paladins to see if they should cast Divine Shield:
Paladin Loop
Events
Time - Every 0.25 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in PaladinGroup and do (Actions)
Loop - Actions
Set VariableSet PaladinUnit = (Picked unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(PaladinUnit is alive) Equal to True
(Percentage life of PaladinUnit) Less than or equal to 25.00
(Ability Cooldown Remaining of PaladinUnit for ability Divine Shield..) Less than or equal to 0.00
Then - Actions
Player - Enable Divine Shield for (Owner of PaladinUnit)
Unit - Order PaladinUnit to Human Paladin - Activate Divine Shield.
Player - Disable Divine Shield for (Owner of PaladinUnit)
Else - Actions
Paladin Loop should be initially OFF.
You can customize this to work specifically for your map. The important thing to note is that the Paladin cannot Learn Divine Shield while it's Disabled, so you need to make sure you Enable it before doing so.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.