II. Tools and knowledge needed
III. Working with the Object Editor
IV. Triggers. What are they and how do they work?
VII. Basic Actions
VIII. Basic Events and Conditions
IX. Event – Response Variables in Detail
X. Manipulating Triggers
XI. Auxiliary Functions
XII. Single-Target Spells
XIII. Area Of Effect (AOE) Spells
XIV. Passive Abilities
XV. Buff Spells
XVI. Channeling Spells
XVII. Selfcast Spells
XIX. Final Note
This tutorial is more an introduction into trigger enchancing spells, than a complete manual. It will give you a general overview upon making your own trigger enchanced spells. You can achieve better results through practice and experimenting.
II. Tools and knowledge needed
First of all you need Warcraft 3 World Editor, preferably TFT since I don’t remember if ROC had Ability Editor/Buff Editor or if it has all the functions we will need in spellmaking. And as for knowledge, you should be able to work with the World Editor and the Object Editor. You don’t have to know anything about Triggers. I shall introduce you if you don’t know how to work with them.
III. Working with the Object Editor
Before we enter triggers themselves, I would like to point some things out, extremely necessary in order to be able to enchance your spells.
First of all, you have to know that an unit cannot have two abilities based on the same root ability. What does this mean? If for example a unit has two abilities, both copies of the Flame Strike ability, the unit might not cast the spell it has been ordered to. It may cast the other Flame Strike ability, if it is not under cooldown. Be careful! There are enough abilities to copy.
Secondly, you must learn the concepts of Dummy Units. Dummy units are special units (lol, not really) meant to help you enchance the spell with better effects. For now, you must know how to create your own dummy unit in the object editor. After that, you will learn how to use them as well.
So go to the unit editor and copy-paste the footman unit. Rename it as dummy, so that you will be able to recognize it later. And now, change the following fields accordingly:
Abilities – Normal – It should include only the Locust unit ability. This will make the dummy unselectable, invulnerable and will remove its collision, allowing any unit to pass through it. By this you assure the unit cannot be detected in any way.
Art – Model File – Switch to custom and type none.mdl. This will make the unit invisible (not as invisibility, but unseen).
Art – Shadow Image – Switch the value in preset to none.
Art – Special – Delete everything there.
Combat – Attacks enabled – Switch to none.
Combat – Death Type – Switch to Can’t Raise, Does not Decay
Movement – Speed Base – Set its value to 0.
Movement – Type – Switch to Fly.
Sound – Unit Sound Set – Change its value to NONE.
Techtree – Upgrades Used – Delete all.
After you have given the unit all these values you can place one on the map and notice that ingame you won’t see it. In World Editor it will appear as a box with green/black squares. That’s because the model you assigned to the unit doesn’t exist. It will disappear ingame.
Another concept we need to study is Dummy abilities. You will give these abilities to the hero and they will practically have no effect, until we enchance them with triggers. What they will have is the mana cost, cooldown, description, eventually requirements, buffs and icons (and obviously name). Practically they should act like a normal hero ability, if you learn for example the ability should be there, with its mana cost and cooldown (when the hero casts it), the description when you put the mouse on the icon and of course it should be AoE if your enchanced spells is supposed to be AoE, or single target if your enchanced spell is supposed to be single target and so on. And this leads us to a second problem: on which spell to base your dummy ability?
Let’s say that you want to do an Area of Effect Sleep (affects all the units in a selectable area). Some of you who have absolutely no experience in spellmaking might say that you must base your dummy spell off Sleep. Wrong! The dummy spell as I mentioned before must mimic the final result spell with no effect (so in this case targets the units in an AoE but doesn’t put them to sleep when cast). However, sleep is a single target spell, not an AoE (like Silence, Blizzard, Cluster Rockets, Flame Strike and other Area of effect spells). You should base your spell off one of the example spells I gave above.
The duration of the dummy spells should be set to 0.01 if it is initially greater than 0. If for these spells you set the duration to 0, it will last forever (or for some until dispelled). And this might lead to other problems. If you want to make a dummy spell which targets a single unit and only damages it (pure example), if you base it off storm bolt, it will do a 0.01 stun, breaking channeling spells. Same thing will happen with silence if you don’t remove the spell disabling effect. Be very careful!
IV. Triggers. What are they and how do they work?
Now that we have clarified the non-trigger side of spellmaking, we are going to study a long chapter: triggers. Since some of you might have no idea about what triggers are, I’m going to make a brief (yeah right) introduction.
Triggers consist of three parts: Events, Conditions and Actions. You can have as many of these as you want, but of course it is not quantity that is important. Throwing events, conditions and actions here and there randomly won’t do it.
Events are that something that fires the trigger. They are like a spark which can burst a house into flames. You can have more just one event but only one is needed for the trigger to fire. After all, a spark is enough to start a fire, isn’t it? Events are something general, unlike conditions.
Conditions are much more accurate than events, referring to things more specific. You can have as many conditions as you want as well but in this case, all of them must be fulfilled if you want the actions to take place. After all, you may have as many sparks as you want because the fire will not start if it is raining outside.
Actions are the most interesting yet extended part. If the trigger has been fired and the conditions are true, then all the actions will take place in the order in which they are placed into the trigger, one after another. Each action will do something ingame, noticeable or non-noticeable.
So a general definition of triggers would be like this: “Triggers are a series of actions taking place one after another when a certain event takes place in certain conditions”.
As you might’ve already noticed, the trigger editor has dozens of actions, events and conditions. Don’t worry, in time you will learn most of them. But for now, you will need to learn the most important. I will try to mention the essential, the most important. You’ll need to explore the rest.
Variables are used to store information into the memory, if you may want to use them during the actions of the same or even different triggers. There are three categories of variables: Global, Local and Event-Response.
Global Variables are extremely used when making trigger enchanced spells. To declare these variables, you need to go to the variable editor and add a variable. The variable editor can be found in the trigger editor where there is an X icon. The sole advantage of Global Variables is that they can be used by anyone who has little knowledge in triggering. However, they have a big disadvantage as well: they are unique. This means that at a precise moment, the variable can store a single value. If the trigger is executed multiple times, only the value in the last execution will be stored into the variable.
In spellmaking this is a pretty big problem. Consider two units casting the same spell at the same time. If you use global variables, only the second unit casting the spell (because casting EXACTLY at the same time is pretty impossible) will succeed. The first caster’s spell will be bugged, the severity depending on how often you used global variables. As an example, imagine two sorceresses casting slow at the same time, and only the second one’s taking effect. Wouldn’t it be annoying?
The spells that allow two or more units to cast them at the same time without causing any bugs because of the global variables problem are called Multiinstanceable (or MUI). To obtain such spells you will have to use Event-Response Variables (which have their limits) or local variables, which unfortunately for now will be inaccessible to you.
Local Variables unfortunately require JASS, which is already a programming language based on which, triggers were made using a Graphic User Interface (GUI), to make it accessible to everyone. But through this, they had to limit some of the language’s possibilities. I don’t recommend learning JASS until you have considerable experience in triggers. I really found it difficult when I started to learn, and took me more than a month to learn it.
But back to the description of the local variables, they store a separate value for each execution of the actions into the memory. Of course this could cause Memory Leaks (variables are stored into the memory from where they are not disposed) if you do not properly remove them. We will discuss this later, once we finish with the basics.
Event-Response Variables are a little bit different and inflexible. Unlike Global or Local variables, these variables cannot receive a certain value. Their value varies, sole depending on the event of the trigger. Moreover, they have a life limit into the memory. After the shortest period of the time, most of them are disposed from the memory. Only a few of them remain there until the last action has been executed as well. To solve this problem, you will have to use local or global variables.
Global/Local variables must have an unique name. In the case of the Globals the Variable Editor will prevent you from giving them the same name but in the case of the Locals, the situation will change. Your own concern by now should be Globals though.
Another classification of the variables can be done by their type. I have enumerated the most important types below:
- Integer – Stores a numeric integer value (ex: 34)
- Real – Stores a numeric real value (ex: 500.32)
- Point – Stores a point on the map with specific coordinates (ex: Target Point of Ability Being Cast)
- String – Stores Multiple Character (ex: “abcd”)
- Unit – Stores an Unit (ex: Casting Unit)
- Boolean – Can Store a True or False value.
- Special Effect – Stores a Special Effect (ex: Last Created Special Effect)
- Unit Group – Stores a Group of Unit (ex: Units In (Playable Map Area))
- Player – Stores a player. There are a total of 16 players. (ex: Owner of Unit)
These are the most important variable types. Even if you don’t understand all the examples, you will soon comprehend all of them.
In the variable editor, each variable has the option of becoming an array. This option allows the variables to retain more than one value (but this doesn’t make global variables local). Each value will receive a numeric index. So if you want to get a certain value from the array, you will need the index. So arrays don’t really allow to make your spells MUI. Their advantage is that in some cases, in which you would have to create 5 global variables of the same type, you can just use a single variable as an array. However, each value stored into the array will consume as much memory as it would take to store it in a separate global.
All variables in an array are of the same type. In an unit array you can’t enter integers.
VII. Basic Actions
Its time we begin to analyze actions. There are tons of them and I don’t have enough time and patience to explain each of them. However, I will take a couple of them, very important to comprehend if you want to enchance your spells.
An extremely basic action is Wait. This action has an obvious effect: When reached, it will hold the trigger for a period of time, before going to the following actions. You can set the number of seconds during which, the trigger is hold. Keep in mind that even though it apparently seems possible, you can’t make the wait have a less value than 0.10 seconds. Also you will notice later that most of the Event – Response Variables are disposed from the memory after the smallest wait (0.10 sec). There are exceptions such as (Triggering Unit). The only solution to keep these variables into the memory is to assign them to a global variable.
A similar action is Wait for Condition. Unlike the plain Wait, this action holds the trigger until a condition is fulfilled. The checking every x section is interpreted as the frequency at which the condition is checked if it has been fulfilled, to unhold the trigger. Until it is checked, the trigger will wait, even if the condition is fulfilled.
For Loops are also extremely important actions and for those of you who have no experience in computer programming, they might sound difficult to comprehend. Loops repeat a series of actions for a limited number of times (VERY IMPORTANT, it must be limited). You will have a start value and an ending value. The first value is given to either a constant variable (Integer A, Integer B) or a global integer variable. With each loop, the variable is then incremented (its value increases by 1) until it is greater than the last value. At that point, the loop stops. It is very useful to use the variable into formulas inside the loop, thing that we will discuss later as well.
Don’t use Integer A/B constant variables for more than one spell. If you do, you might get the same problem you would get with a spell which is cast by more than one unit at the same time, and you have used global variables, but this time for the two spells.
If/Then/Else action is yet another basic programming structure (in this case action) you need to learn. The action checks a series of conditions. If all are fulfilled, then a series of actions takes place (IF actions). However, if atleast one condition isn’t fulfilled, other series of actions take place (ELSE actions).
Unit actions are also very frequently in enchancing spells because usually units are targets of spells… I think every spell uses a unit action, one way or another.
Unit – Add Expiration Timer removes a unit after a couple of seconds. Like summoned units, it will receive the blue bar, which shows when it will disappear. Use this on dummy units so that you don’t have to remove them manually.
Unit – Remove Unit simply removes a unit from the game. It doesn’t kill it, just removes it forever, with no way back.
Unit – Hide Unit hides a unit. Hidden units cannot be seen, selected or targeted but they cannot issue any order either. For hidden heroes, their icon still appears in the left corner. You will notice that in the “Storm Earth and Fire” spell, the casting hero is hidden, not just miraculously split in three units. ;)
Unit – Add Ability gives a unit a certain ability, it didn’t initially have. You can give any ability to any unit (yes, that means that you can give hero abilities to normal units) but there are some restrictions. Giving a hero ability will not allow that hero to upgrade the ability to higher level, when leveling himself.
Unit – Set Level of Ability allows you to change the level of a certain ability (to whatever you want, even if it greater or lower than the current level). Thanks to the latest patches, unit abilities can have multiple levels. Accessing those levels can be done only through this action.
Unit – Issue Order allows you to order an unit to do something. Orders can include moving, attacking, patrolling, casting a specific ability, practically everything the player could order the unit to do. There are more types of orders, each being a separate action. For example, Unit – Issue Order Targeting a Unit orders the unit to do something to another unit, such as attacking that unit or casting a certain ability at that unit.
The player can remove orders, if he or she orders the unit to do something else.
If you want to order an unit to cast an ability, you will need to order the unit to cast the root ability (ability based on which you made your dummy custom ability, doesn’t always have to be a dummy ability though). Let’s say that you based your ability off Neutral Hostile Anti-Magic Shell. You can order the unit to cast exactly the custom ability. However, you can order the unit to cast Undead – Banshee – Anti-Magic Shell. Through this, the action will order the unit to cast an Anti-Magic Shell. If the unit has more than one ability with the same root (Anti-Magic Shell in this case), the trigger will cast the first ability of that type which doesn’t have cooldown activated. That is why it is advised not to give an unit more than two abilities based off the same root ability, even if you base one off the Neutral Hostile and the other one off the race ability (in this case Undead).
Unit – Create Unit is an action which creates a certain type of unit, for a certain player, at a certain point on the map. The units appear out of nowhere, but they are not considered as being “trained” by the player, meaning that they won’t appear as trained units in the scores at the end of the map. Except that, the unit retains all its functions, from abilities to properties and to food cost.
Unit – Damage Target orders an unit to damage another unit. However, this will not be done in “Unit attacking another unit” manner. This function was introduced by Blizzard so that instead of substracting the life of an unit when you want to simulate damage, actually be able to order an unit to damage another unit. This also gives access to bounty (experience and money for the caster of the spell), thing unavailable through substraction of life. So, the damage is done instantly, and it won’t be noticeable. The damaging unit will not face, nor will it throw a projectile at the target or even show the “Attack” animation.
You will need to mention the amount of damage so no, this won’t just order the unit to do the damage in the range it is capable of. For example if an unit has 10-15 damage the unit won’t do damage between 10 and 15 to the target, instead you will need to give that amount of damage. Moreover, this trigger is capable of allowing you to choose the type of damage (Chaos, Magic, Piercing, Siege etc) and so, the damage dealt will depend on the target’s type of armor, if it is of Magic type it won’t affect Spell Immune units and so on.
Unit Group – Pick Up Every Unit in Unit Group and do Actions is one of the most important actions, used not only in spellmaking, but usually when working with groups of units. It takes each unit in an unit group and does a series of actions, for EACH of those units. The series of actions are run at the same time, making it an excellent method for some AoE spells.
If in the series of actions the picked units are not mentioned, the actions will just be a series which will occur N times (N being the number of picked units) at the same time.
Unit Group – Pick Up Every Unit in Unit Group (Matching Conditions) and do Actions does quite the same thing, except that the units for each the series of actions are executed only for those units which matches a series of conditions. This can be again used in AoE spells when, for example, you want to pick only friendly units, or enemy, or spellimune or others.
VIII. Basic Events and Conditions
I’m not going to explain all the Events and Conditions, though they are not as numerous as the actions are. However, some of them are of Great importance in spellmaking, without which spell enchancement is impossible.
Maybe the simplest event is Map Initialization. It activates the trigger just when the map starts. It is recommended not to use any conditions with this event, because it will occur only once, at the beginning of the map, regardless the circumstances. After that, it becomes completely useless. So, adding a series of conditions which may not all be fulfilled at the beginning of the map, will just make the trigger just a waste of memory.
Unit – Generic Unit Event pack of events is also very useful. These activate the trigger when ANY unit does something general, such as casting an ability (any, not a certain one), dying, being attacked and so on. Those we will need mostly are: Unit Starts the Effect of an Ability, Unit Begins Casting an Ability, Finishes Casting an Ability, Begins Channeling an Ability and Stops Casting of an Ability.
a) Begins Casting vs Starts the Effect
If you try both these events, you will say that they do the same thing, with no difference. But Blizzard is not stupid. They didn’t add both for nothing. You will notice at a closer look at the small difference if not noticed by the spellmaker can lead to severe bugs, which can be used to abuse the spell.
An Unit Begins Casting an Ability fires the trigger when the unit prepared to cast the ability, just before it wasted the mana or fired the cooldown. Players abusing the spell, by moving the caster just before the cooldown is fired (it’s not even hard to do that), will obtain the effect of the spell without firing the cooldown or losing any mana. This means that they can cast the ability an infinite number of times, with no restrictions. Quite bad eh? And then, you may wonder when should you use this event. Well, by now the sole use I found to it is to validate targets. Object Editor may not always assure the valid targets of the spell for you. In this case, you will need to validate them yourself. Make a trigger which activated by this event checks if the target is valid. If it isn’t, you just order the casting unit to stop, followed by an error message.
An Unit Starts the Effect of an Ability just when the cooldown is fired and the mana is wasted. So yeah, the main trigger which activates when the spell is cast should have this event, in most of the cases atleast.
b) Finishes Casting An Ability and Stops Casting an Ability difference ca be noticed only in the case of the channeling spells.
Finishes Casting an Ability fires the trigger when the unit has fully cast the ability, to its full effect. This means that if a Priestess casts Starfall but a damned Dreadlord casts sleep at her, the trigger will not occur in her case because her ability hasn’t finished casting. It was actually stopped! In conclusion, you may get some errors if you haven’t used the right event.
Stops Casting a Ability fires either when the unit stops casting the ability before it has reached full effect (either willingly or not) or the unit achieves full effect. I believe that this is an error for Blizzard, since normally it shouldn’t occur into the second case as well. But apparently, it does! So if you want to know when to stop the effect of a channeling spell, use this event, instead of “Finishes Casting an Ability”.
I don’t suggest you use either of them with non-channeling spells.
Event – Unit is Attacked is again a buggy event. Like “Begins Casting an Ability”, this fires the trigger only when the unit begins to attack. If, for example an archer attacks an unit but stops before the arrow is fired, this trigger still occurs. This probably cannot be solved yet until Event – An Unit is Damaged event is added by Blizzard. This event exists for now only for specific units.
Timer – Every x seconds event is also used, either for channeling spells (which we will be studying later) or to make a trick wait, lower than 0.10 (again, I will explain later). This event fires the trigger every x seconds. It is very useful if you want to repeat a certain series of actions. A great advantage is that timers can have a value down to 0.01 seconds, which is 10 times lower than the wait limit. It is important to know that this event exists, and to know what it does. Who knows when you will need it?
Event – An Unit is being Summoned can be used to track units summoned through spells, such as Inferno and Water Elemental. This doesn’t track the process of casting the spell, but it tracks the simple fact that an unit has been summoned by a spell.
There isn’t much to say about conditions. All conditions are just comparisions. The compare if two variables are equal or not or in the case of numeric variables Less than, less than or equal to, greater than, greater than or equal to comparisions also appear. You can compare only two variables of the same type, but you can replace variables with Auxiliary functions (check chapter XI).
Every related to trigger Conditions is also true for the condition of an IF.
I will stop upon some special functions, which are more like a helpful tool for applying conditions, than a comparison. These functions are the last into the conditions chart in the trigger editor. They can ALL be used in place of a condition, and you will soon understand why.
A comparison or function which return or is false, when involving conditions, is interpreted as if that condition is not fulfilled.
First is AND function. It has two fields, and into each you can place another condition. This function returns a true value (meaning that the condition is fulfilled) if both the conditions are true. If atleast one of the conditions is false, then the function returns false as well.
Second function is OR function. It again has two fields, each for a condition. If both conditions are false, then the function returns false too. So atleast one of the conditions must be fulfilled in order for the function to return true as well.
The third function is AND (All Conditions Are True). Unlike the other two functions, you can insert into it as many conditions as you want. However, keep in mind that all those conditions must be fulfilled if the function is to return true.
The last function OR (Any Condition Is True). Like the previous function, you can insert as many conditions as you want. In this case, only one of the conditions must be fulfilled if the function is to return a true value.
That’s all the philosophy for conditions. I would also like to mention that there can be conditions in conditions. There is a type of comparison called Boolean Comparison. There are situations in which certain functions can return a true or a false value (for example, Group is Empty function checks if an unit group is empty, and if it is, it returns true but if there is atleast an unit in the group, it returns false). However, conditions themselves have this property. If a condition is correct, then it returns true, but if it isn’t then it returns false.
So, Group is Empty function can also be replaced by a comparison: Number of Units in Group is equal to 0. If it is so, then the comparison will return true and the group can be considered empty, but if there is atleast a unit in the group, it will return false. The code would like this:
((Number of Units in Group) is equal to 0) is equal to false
It may sound confusing at first, but if you study this chapter a little bit more, you will realize that it truly is like this.
IX. Event – Response Variables in Detail
In this chapter, I’m going to take the most important Event – Response variables and explain when to use them.
(Attacking Unit) – Used along with the event “Unit is being Attacked”. Refers to the attacker.
(Attacked Unit) – Used along with the event “Unit is being Attacked”. Refers to the attacked unit (kinda obvious, eh?).
(Killing Unit) – Used along with the event “Unit dies”. Refers to the killer (unit whose attack killed the victim).
(Dying Unit) – Used along with the event “Unit dies”. Refers to the victim (unit killed by the Killing Unit).
(Casting Unit) – Use with casting events (read previous chapter). The variable refers to the unit which casts the ability, spell’s source.
(Target Unit of Ability Being Cast) – Use with casting events (read previous chapter). The variable refers to the the unit targeted by the spell (if the spell is meant to directly target an unit). Such spells include Soul Burn, Chain Lightning and Storm Bolt.
In the case of chain spells (Chain Lightning and Healing Wave), the variable refers only to the first unit of the chain.
(Target Point of Ability Being Cast) – Use with casting events (read previous chapter). The variable refers to the point at which the spell was cast (if it was meant to target a point). Such spells include targeted AoE spells (Blizzard, Flame Strike, Earthquake, etc) or single point spells (Shockwave, Carrion Swarm, Pocket Factory etc).
(Summoned Unit) – Use it with “An Unit is summoned” event to refer to that unit. If more than one unit is summoned by the spell (such as Seer’s Spirit Wolves), the variable may cause problems.
(Summoned Unit) – Use it with “An Unit is summoned” event to refer to the summoner (the source from which the unit is summoned). Cannot be replaced by (Casting Unit) because the event refers to the fact that an unit has been summoned, not that a spell has been cast.
(Triggering Unit) – Can be used with all unit events. It is usually the unit to which the event directly refers, so it can replace (Attacked Unit), (Casting Unit), (Dying Unit), (Summoned Unit) and others not mentioned above. I highly recommend that you use this variable because it is unaffected by waits (it can be used even after waits because it is not reset until the end of the trigger).
(Picked Unit) – Should be used along with the Pick up Every Unit or Pick up Every Unit Matching Conditions actions. You need to use this so that you can refer to the unit picked. The variable exists only inside the actions of the Pick up Every Unit/Pick Up Every Unit Matching Conditions.
(Matching Unit) – Should be used everytime you want to refer to an unit inside a “Unit Matching Conditions” condition. Yes, this involves the [i]Pick up Every Unit Matching Conditions[/u] action too.
[u](Last Created Unit)[u] – Use this right after the Unit – Create Unit action, to refer to the unit you have just created.
Do not create more than one unit at a time if you want to use this constant or it will store just one of the units you created.
X. Manipulating Triggers
There are some techniques through which you can manipulate triggers. This can mostly be done through special actions, made soley for this.
A first technique is to Turn On/Off triggers. All triggers are normally Turned On but there is a checkbox (initially unchecked) labeled Turn Off. If you check it, the trigger will be initially Turned Off. You can also turn the triggers On/Off through the function Trigger – Turn Off and Trigger – Turn On.
But what exactly is a Turned Off trigger? Usually, if an event takes place in certain conditions, the actions take place. This is the basic definition of triggers. But in the case of the Turned Off triggers, the actions never take place, no matter the conditions. A very good technique is to combine Turned On/Off triggers with Timer – Every x seconds event. Turn On the trigger so that the actions take place a number of times, and then just Turn if Off. This can be a very handy technique for channeling spells.
Another technique of manipulating triggers is by Destroying them. A destroyed trigger is simply discarded from the memory, so the actions will never take place, no matter the event or the conditions. In fact, not even those exist. The trigger is gone until you restart the map! Use it for Map Initialization triggers and destroy them at the initialization, to save some memory.
Destroying a trigger or Turning it Off prevents only further executions of the trigger. The current series of action is made to the last, no matter what, if the trigger was fired under the event with the correct conditions.
A final technique I would like to present you is not really manipulating triggers, but the actions. The action Skip Remaining Actions does what its name says it should do: it skips all actions after it. This doesn’t affect the trigger. If the event takes place in the conditions, the series of actions will start once again. Skip Remaining Actions only prevents the remaining actions (with no exceptions) to take place during the current executions.
XI. Auxiliary Functions
There are several other functions, separate from the events/conditions/actions, but which can be used inside them. These functions are used to replace variable types, like units, points, and even numbers.
In JASS, you will notice that the Event – Response variables are in form of actions. That is because they are truly Auxiliary functions. I have labeled them as variables, because in the stage they are, they act like them. They have a duration of life, depend on the event, and are extremely frequently used.
Point with Polar Offset will help you get a point on a circle, with a certain radius and a central point known. The function has three parameters (blue fields in GUI): first to determine the center of the circle (which is a location), second to get the radius of the circle and third is used to get where the point is actually on the circle, in degrees. You can use this function for example to make dummy units cast radial shockwaves.
In Warcraft 3, degrees values are as following:
 0 for east
 90 for north
 180 for west
 270 for south
Random Integer and Random Real are also very good actions. Use them to substitute an integer or a real value. What these functions do is get a random number between a value x and a value y. The value seems to be completely random, do I'm sure that at a point, the randomization series start to repeat.
Owner of Unit returns a player value. It checks to which player does a certain unit belong, and so, you can use this to replace a field which requires a player (such as the one in Unit – Create Unit).
Math - Distance Between Points calculates the distance between a point A and a point B. Distance in Warcraft 3 is calculated in pixels. This function has its own uses, which we might discover later.
Math - Angle Between Points returns a real value (in the form of an angle). To better understand this function, I’ll call the source point A and the destination point B. Now, back to Polar Offset, considering that A is the center of the circle, the radius is equal with the distance between point A and point B, and that B is the point on the circle, the angle is equal with the location of B on the circle, in degrees. For more information, check Polar Offset at the beginning of this chapter.
Arithmetic is usually the essential function when you work with numbers. It allows you to add, substract, multiply or divide two values. To do these operations with more than two values, you will have to insert an arithmetic in place of another value, since the returned value is either real or integer.
Convert to is also an essential set of auxiliary functions. They allow you to convert values from a type to another. The convert functions are: Integer to Real, Real to Integer, String To Real, Real to String, Integer to String, String to Integer, Degrees to Radians and Radians to Degrees. You will need these functions if you want to insert integer values for example into fields which allow only real values, or vice versa.
XII. Single-Target Spells
This is probably the simplest class of spells, when referring to enchancing. These spells are those which target a single, specific target. This means that the player chooses the target and only it is affected by the spell. Such spells include Cripple, Soul Burn, Storm Bolt, Entangling Roots, Rejuvenation, Possession, Holy Light, Death Coil, Life Drain, Siphon Mana, Mana Burn, Shadow Strike, Finger of Death and others.
Chain Lightning, Healing Wave or other chain spells are not single target. Even though the player selects the first target, to trigger the effect, it’s not that easy, because it affects other units, “in chain”. However, they can be used as dummy spells, if they are supposed to hit only 1 target, and do nothing to that one anyway.
For now, we shall stick to non-channeling or buff spells. Once you learn how to make spells of each category, then channeling/buff spells require separate technique, which once learned, you won’t need to struggle with each category again, theoretically of course.
So, let us begin. I’ll start with the theory and then we will make a practical spell. The idea of the Single Target spells is simple. You check whenever a unit casts the custom ability, and then you create dummy units and order them to cast various spells at the target, or damage it, or maybe something else, depending on your spell. That is for the pure effect of the spell. In this tutorial I won’t explain special effects. Maybe I’ll make a separate one later!
And now, we are getting to do a practical example. Here are the basic steps:
Step 1 – The idea of the spell
We are going to make an apparently difficult spell (especially if you haven’t trigger enchanced a spell before) called Shock Destructor (blah, probably not the best name, you can change that if you want). Its description is pretty tricky so here it is:
->The caster emits a bolt of lightning which targets an enemy unit. Depending on its nature, it does a different effect.
-Buildings take damage (50 at level 1, 75 at level 2 and 100 at level 3)
-Mechanical Units are stunned (6 seconds at level 1, 7 at level 2 and 8 at level 3)
-Organic Units are purge (3 seconds at level 1, 4 level 2 and 5 at level 3)
Step 2 – Making the dummy ability, dummy unit and other abilities
Let’s search for a dummy ability. Remember, it must be an instant, single target spell. I have already mentioned most of the spells up, though they are not all instant spells (their effect lasts a couple of seconds and can be dispelled). However, you can make those abilities instant as well. Just set their duration to 0.01 and it will appear as if they were instant.
A duration of 0.00 doesn’t mean no duration, it means that the spell will last forever, or until it is dispelled. It is a convention.
Some abilities, may leave secondary effects even if their duration is almost unnoticeable. Spells that interrupt channeling abilities (cause stun, sleep, silence etc) may be a problem if your spell is not supposed to actually break the channeling. I suggest you avoid those spells as much as possible, unless you intend to break channeling spells anyway!
Now, looking back at the description of the spell, you will notice that I mentioned that The caster emits a bolt of lightning. Hmm, don’t we already have a spell which does this? In fact, we do. Chain Lightning that’s what it does. It causes the caster to emit a bolt of lightning. However, we want this spell to affect only a single target. Make a copy of the spell, and let’s change some of its fields.
First of all, we will make the spell a dummy spell, meaning that it won’t affect the target in a real way. Set the initial damage to 0 for all the levels, number of targets equal to 1 (it would be strange to bounce but affect only the initial target)… and that’s kinda it. If you would test the spell, it would do nothing.
Now its time to make the spell look realistic. Leaving the old Chain Lightning description, name and icons would make the player think that he is casting Chain Lightning. So change its name to Shock Destructor, all descriptions accordingly, and I would even saw that you change the icon. I for one used the Dark Portal ability icon, but these stuff really don’t matter. Make it look convincing!
And now, we still have some technical things to solve. The spell has the old mana cost and cooldown of Chain Lightning. I have thought as some values, but you may change them as you like, to make the spell balanced. The mana cost I chose is 70/65/55 (level 1/level 2/level 3) and the cooldown 8/8/8. One last thing to change are the targets. Chain Lightning affects only organic targets. Here are the valid targets I gave (and you’d better follow them): Air, Ground, Enemy, Organic, Structure, Mechanical, Vulnerable. Its good to give all the values you find valid to your spell. In this case, not giving Vulnerable may not cause the spell to be cast on Invulnerable units anyway, but you shouldn’t risk. Some spells may have this field bugged.
You can now give the ability to a hero and test it. It will look extremely realistic, but if you order the hero to cast it, you will only get a unit struck by a bolt of lightning, with no consequences, but mana lost and a cooldown fired. It’s a promising start though. Let’s get back to the Object Editor, since we ain’t done.
We will have to give some abilities to the dummy units. We need a single-target ability that stuns (I suggest Storm Bolt) and Purge (the description was kinda obvious). Copy-paste both the abilities, and edit them in the following way.
-> Make them 3 level abilities, but leave them unit abilities.
-> Change their mana cost to 0/0/0, duration to 3/3/3 (usually a high value so you can assure that the dummy unit is able to cast it only when ordered and not again unwillingly), their duration to how long the spell is supposed to affect the target and you should even change their buffs.
-> Watch out for targets. Make sure that the dummy unit is able to cast the ability on the valid unit. In this case, make sure Storm Bolt can target Enemy, Mechanical units and that Purge can target Enemy, Organic units.
-> Icons and descriptions usually should be left blank, because you won’t see them anyway
-> To know for which spells you use the custom abilities, I would suggest that you add an editor suffix, with the name of the dummy spell. In this way, it will make life easier for you. In this case, I got Purge (Shock Destructor) and Storm Bolt (Shock Destructor)
And last but not least, don’t forget the dummy unit. If you don’t remember how to make a dummy unit, go back to chapter 3 and get the instructions from there.
Note: If you're reading this tutorial from the World Edit Tutorials page you should now click here to view the full version.