• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Trigger Auto-cast

Status
Not open for further replies.

kj_

kj_

Level 5
Joined
Aug 1, 2008
Messages
134
Introduction
Many spells in Warcraft can be cast automatically. This function is called autocast. It is not possible to just tick an option and the selected ability will be able to autocast. You will have to go deeper. You will have to use triggers and maybe an ability that also can autocast, to launch the selected.
There are many ways of making spells autocast. But I will primary be focusing on a mixture of triggers and dummy abilities. This way, when wanting to make a spell autocast, you activate a dummy spell that each time it runs/attacks it orders the unit to cast the real spell. This way when turning on/off autocast, will be like normal, however you will have two ability-icons counting as one.

Types
All spells/abilities can be divided into 3 groups of how their target: Unit, Point, No-Target. Listed below are one of each type:
Unit - Order (Triggering unit) to Orc Raider - Ensnare (Target unit of ability being cast)
Unit - Order (Triggering unit) to Orc Witch Doctor - Sentry Ward (Center of (Playable map area))
Unit - Order (Triggering unit) to Orc Tauren Chieftain - War Stomp
The first is targetting a unit. This is spells like Ensnare, Heal and Shadow Strike.
The second is targetting ground. This is spells like Sentry Ward, Far Sight and Earth Quake.
The third doesn't have a target. This is spells like War Stomp, Roar and Feral Spirit.

So now we know that there are three kinds of spells. But now is the problem, what autocasting spells are there? Well.. The only spells I know that have autocast are target-unit spells. But it's still possible to make the others autocast aswell. Because you can make the spell target the point of the unit you want to hit.

In all my examples I will be using the same method for doing the autocast. I will be using a dummy spell which will be based of Searing Arrow.

Custom Spells
To make a trigger launch with a custom spell you will have to look at the 'Order String - Use/Turn On' and make sure it is the only occurence on that unit, else more spells will be launched at the same time. When selecting the ability / action, instead of choosing preset you choose function, then Conversion - Convert String to Order and write the Order String in that field.
Unit - Order (Some Unit) to (Order(Some_Spell_Name)) (Target unit of ability being cast)

Making the DummySpell
For each autocasting spell, I will recommend you having a dummy spell. I based my dummy spells off Searing Arrow which is the 'Priestess of the Moon' ability. I have removed ALL models, damages, levels and anything that makes it be like a normal spell. Also removed mana cost and set cooldown to 5 just for standard.
Normally I set the range of the dummy spell to the same value of the spell to be casted. But you have to do it another way with abilities like War Stomp which is a No-Target spell. You have to set the range of the dummy spell to maximum the area of effect of the spell to run.

Example One - Targetting a Unit
Always remember to set the cooldown of the dummy ability to the cooldown of the ability it should start or less than it. Also remember to set the range to the same.
Uses Dummy
Events
Unit - A unit Begins channeling an ability
Conditions
(Ability being cast) Equal to Dummy
Actions
Unit - Order (Triggering unit) to Orc Raider - Ensnare (Target unit of ability being cast)
The trigger runs each time an ability has been started, then it checks that the ability is the Dummy Spell, if it is, it will order the unit to use Ensnare.

Example Two - Targetting Ground
This one is a bit more tricky since you can't just make the unit hit the unit which the Dummy Spell will hit, you will have to localize the targetted unit and hit it. Remember to set the cooldown of the dummy ability to the cooldown of the ability it should start or less than it.
Uses Dummy2
Events
Unit - A unit Begins channeling an ability
Conditions
(Ability being cast) Equal to Dummy2
Actions
Unit - Order (Triggering unit) to Human Blood Mage - Flame Strike (Position of (Target unit of ability being cast))
The trigger runs each time an ability has been started, then it checks that the ability is the Dummy Spell, if it is, it will order the unit to use Flame Strike.

Example Three - No Target
This is the one that could cause most problems because the dummy is a ranged ability while this is not ranged, however it is not that hard.
Always remember to set the range of the Dummy Spell to ½ of the range the standard ability has, else it can cause problems:
Let's say the Dummy Spell has 2000 range and the unit has War Stomp, the range of it is 1000. So when the Dummy Spell hits some unit, it will do War Stomp, but the unit won't be harmed because it's too far away. Also remember to set the cooldown to atleast the same of the original ability.
Uses Dummy3
Events
Unit - A unit Begins channeling an ability
Conditions
(Ability being cast) Equal to Dummy3
Actions
Unit - Order (Triggering unit) to Orc Tauren Chieftain - War Stomp

Bonus Example - Autocasting without double icons
Ofcourse it would be cooler with just one icon for a spell but then it would be hard to make it so you can choose autocast or not. This following example will order a unit to keep on doing Flame Strike, Ensnare and War Stomp on the units it attacks or is being attacked by:
No Dummy
Events
Unit - A unit Is attacked
Conditions
Actions
Unit - Order (Attacking unit) to Human Blood Mage - Flame Strike (Position of (Target unit of ability being cast))
Unit - Order (Attacking unit) to Orc Raider - Ensnare (Target unit of ability being cast)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Attacking unit) is in (Units within 1000.00 of (Position of (Attacked unit)))) Equal to True
Then - Actions
Unit - Order (Attacking unit) to Orc Tauren Chieftain - War Stomp
Else - Actions
If you don't understand it with out the trigger boxes here is the direct link
http://www.hiveworkshop.com/forums/f279/making-any-spell-autocasting-6255/
 
Status
Not open for further replies.
Top