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

Creating a Custom Spell

Level 13
Joined
Jun 10, 2007
Messages
780
Creating a Custom Spell!

Test
Requirements

[x]World Editor
[x]General Trigger knowledge
[x]Object Editor knowledge
[x]Some Variable knowledge
[x]Wc3 The Frozen Throne
Test
Definitions

[x]Dummy unit, a unit that serves a purpose when making a spell. It may just be used for the spell damage, or for things like special effects.
[x]Variable, can store data.
[x]AOE, Area of effect spells, ex: War stomp.
[x]Passive,Unclickable spells ex:Bash
Will add more if needed.
Test
Font
Size 2, a note
Size 4,a section of the tutorial
Bold is important

After you have all the requirements and you know the definitions, you are ready to start this tutorial!


Introduction

Sometimes while creating a map, you want to have great things to impress the players and make them want to replay the map. People use models, sounds, icons, and more to make there map stand out. An example is Dota. With models, sometimes you wont find spells in the normal ability editor that would "match" your hero appearence. In this tutorial, I will teach you the basic of spell making through triggers!

Spell types

You may be saying "What are spell types?". Well, spell types are spells that have different ways of being casted. An example is warstomp from the Tauren Chieftain and shock wave from the Tauren Chieftain. War stomp is a simple click spell, clicking the icon will activate it. Shockwave is a little different, after clicking you will have a small little cross hair (I like to call it) and it will ask you to choose a point. After choosing the point, the spell will activate at that point. Choosing the right spell to make your custom ability off of is a key factor.
*Note: A hero can't have the same base ability twice. doing this will cause casting errors. An example is having two warstomp abilities, even if you change the entire spell, this error will still occur. Use other base abilities like thunderclap if you needed another warstomp-type ability.

Some Spell types are

AoE: Area of effect/Example:War stomp
No Target: Spells that activate on click or hotkey press/Example:Thunder Clap
Target (Single):Spells that require you to click an ability and then choose a target/Example:Storm bolt
No Target Casts: Spells that require a click, then choosing a point or unit/Example:Shockwave
Passive: The spell is unclickable and does the work automatically/Example:Bash

Dummy's

Dummies are things that have affects but usually arent supposed to be noticed. For example, if you wanted to cast two shockwaves you would use a dummy. You could cast one and you could make a dummy that would cast one. These are basically supposed to be unknown objects that help in special effects, spell effects, contributing to the spell, or even make the entire spell.

The Trigger Editor

The Trigger Editor is very good for custom spells because you can do beyond the normal warcraft spells by adding effects, spawning dummy's and such. The Trigger Editor is very easy to use when making custom spells and can be leak less (if you do it right, which can often be difficult.)

Variables

Another important part that deals with the trigger editor. Variables can store LOTS of information and can be used for spells. Variables are easy to learn. Just remember them as a copycat, they can store or "copy" data for later use. An example is if you spawn a unit and you have a wait action, then after the wait the unit will cast an ability. This ability will not work right if someone else uses the same ability because the 'last created unit' action will overlap, causing the spell to be VERY buggy. Variables, however, defeat this problem very easily. Check out this trigger below

  • Spell
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees
      • Wait 5.00 seconds
      • Unit - Order (Last created unit) to Human Archmage - Blizzard (Position of (Triggering unit))
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
As you see, if any unit casted an ability within those 5 wait seconds that also used a dummy, the experation timer would go to the unit created within those 5 seconds, removing 1 dummy too soon and not removing the other dummy. After you see that, check out this trigger below
  • Spell 2
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees
      • Set StoreUnit = (Last created unit)
      • Wait 5.00 seconds
      • Unit - Order StoreUnit to Human Archmage - Blizzard (Position of (Triggering unit))
      • Unit - Add a 5.00 second Generic expiration timer to StoreUnit
As you see, we set the unit as a variable, if a unit casted an ability in those 5 wait seconds now, it wouldn't be a problem at all. The variable "copycats" or remembers the unit and knows which unit to cast blizzard and add an expiration timer to. You MUST have at least SOME Variable knowledge or else you'r spells will NOT function correctly.

Creating a Simple Triggered Spell

After reading that, you may have a headache because you were bombarded with information but dont worry, it is easy after you make a few spells in the editor.
Suppose I want to make a simple spell that when its clicked, rocks will fly out of the ground and hit units and damage them. That may sound hard to make but it is actually pretty easy. First I will need a dummy unit, I will use the demolisher because he can already shoot rocks.

ScreenShotNum1.png
ScreenShotNum2.png

Notice the unit has the locust ability, has no "real" model file, has 0 collision, and has 0 shadow. Locust makes it unclickable, no model file makes it blank, 0 collision makes it unable to be stopped if a unit is close to it, and 0 shadow makes it look like its not even there. Our dummy unit is now impossible to be seen. Also, make the unit have alot of range so that it doesn't have to move while it is about to attack. Shall we continue?
Next, we will need to make a dummy ability. What I mean by dummy is that it does nothing, it is just there to click and activate the spell.

ScreenShotNum3.png

I made all the damage properties 0 because as I said it is a dummy spell. All you need to keep is the mana, the cooldown, and the spell description.
After making the spell and the dummy unit, we can now trigger the spell.

  • Events
    • Unit - A unit Begins casting an ability
You will probably use this the most when making nonpassive spells, you need to make sure you have this

  • Conditions
    • (Ability being cast) Equal to TheSpellWeAreMaking
Without that condition, the spell would activate when ANY unit casted an ability. Always use conditions when triggering abilities. Now to the actions, I said I wanted rocks to fly out of the ground. This is the time we create the dummy units.

  • Unit - Create 1Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees)
  • Unit - Create 1Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees)
  • Unit - Create 1Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees)
  • Unit - Create 1Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees)
This will create the units right in the same spot the hero is at, it is important that if the spell has more then one level to instead make this action. Go to Actions<All<If/Then/Else<Integer<Unit<Level of ability for unit.
Note*If you were to create 4 at once instead of 1 at a time, the action will be 10x more buggy and sometimes the dummies may not do there thing.
See screen shot below if you need help

ScreenShotNum4.png

Heres what it would look like if it had more then one level

  • If ((Level of SpellWeAREMaking for (Triggering unit)) Equal to 1) then do (Unit - Create 1Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees) else do (Do nothing)
Now lets finish the ability.
Since the units were just created, we need to make then shoot the rocks, but how? All you have to do is this.

  • Unit - Order (Last created unit) to Attack Ground ((Position of (Triggering unit)) offset by (Random real number between 250.00 and 360.00) towards (Random angle) degrees)
Notice how in the upper part of the tutorial I say store the created dummies as integers BUT if you create the unit and make it lets say attack the ground directly WITHOUT ONE wait action then you may use last created unit, as it won't screw up. Heres what I mean

  • Unit - Create 1 Footman for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees
  • Unit - Order (Last created unit) to Attack Ground ((Position of (Triggering unit)) offset by (Random real number between 250.00 and 360.00) towards (Random angle) degrees)
See, no wait action. The method above IS ok for last created unit
:thumbs_up:



The random real number makes the rocks shoot in random locations and not at a certain location. The number 300-650 is range, so the farthest it could go is 650 and the shortest is 300. The random angle makes it shoot in any position.

You may also want to secure that all the units have died and were removed from the game so you may want to add an experation timer to them.

  • Unit Group - Pick every unit in (Units of type Dummy) and do (Unit - Add a 4.00 second Generic expiration timer to (Triggering unit))
Now the units are sure to be removed when used.

The spell is complete but I am not quite happy with it, it needs more effects. Luckly, we can do that with a simple action!

  • Environment - Create a 0.50 second Temporary crater deformation at (Position of (Casting unit)) with radius 1000.00 and depth 64.00
Now the spell has effects, works properly and looks great This is what it looks like when it is done.

  • TheSpellWeAreMaking
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to SpellBeingMade
    • Actions
      • Environment - Create a 0.50 second Temporary crater deformation at (Position of (Casting unit)) with radius 1000.00 and depth 64.00
      • If ((Level of Spellbeingmade for (Triggering unit)) Equal to 1) then do (Unit - Create 4 Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees) else do (Do nothing)
  • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • If ((Level of Spellbeingmade for (Triggering unit)) Equal to 2) then do (Unit - Create 6 Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees) else do (Do nothing)
  • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • If ((Level of Spellbeingmade for (Triggering unit)) Equal to 3) then do (Unit - Create 8 Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees) else do (Do nothing)
  • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • Unit Group - Pick every unit in (Units of type Dummy) and do (Unit - Order (Picked unit) to Attack Ground ((Position of (Triggering unit)) offset by (Random real number between 300.00 and 650.00) towards (Random angle) degrees))
A simple but effective spell we have just completed. It should be stuck in your head that you CAN ONLY use 'Last Created Unit' whenever the created unit is right before the action containing 'Last Created Unit' and ONLY THEN!
EarthRock.png
Demo Of The Spell View attachment Demo Spell.w3x


Section 2

Dummy Casting Units

In section one you learned about dummy units and now know how to make a simple spell with dummy units. This time, instead of the dummy being an attacking demolisher, we will make the dummy cast. Making dummy units casting spells can be tricky, though, so I will give you some basics.
First, to allow a dummy to cast an ability, you will need to make the ability itself. This is pretty easy and all. Remember to base the ability off of the type of spell it is (if its a simple click base it off of war stomp etc..). Here are some things to keep in mind:

You cant have 2 abilities both based off of the same ability.
(Example, a unit may not have two spells based off of war stomp, if you do, it will cause the spell to glitch or not work).

If the ability will be casted once, make the cooldown very long (like 9999) to prevent the ability from being casted twice. You may want to do the same with manacost.

If the ability involves multi-casting, make the cooldown short and make the manacost 0. If the unit should only cast like say 5 times, make the spell cost 1 mana, make the unit have 5 mana, give the unit no mana regain.

Doing these will help your ability leak ALOT less!

Part B

Now this tutorial will teach you the basics of triggering the ability. If you did not read the above "Section 2" then do so now or risk having a poorly made spell. As I said earlier, "a unit may not have 2 of the same ability or based ability on them", this is important.
Side note: Remember what you based the spell off of.

Lets say we wanted a entangling root spell just like the one that Keeper of the Grove has exept we want it to root a random target and make it a simple click spell. You may be thinking that its hard, but rest assure, if you can do the first spell I made, this will be cake. The thing is, the click root spell that your hero has (assuming you made one and you based it off of warstomp or something by that means) is just a dummy itself. Your dummy spell triggers a dummy unit whom activates the real spell. Confusing? You wont be for long.

Creating a Simple Dummy Casting Spell

First off, make a dummy spell based off of warstomp (I always use it as a base). Name is Root or something by that means, remove the damage and everything exept the cooldown (keep it at 8 seconds). Make desired tooltips and such.

Second, make a dummy unit (something like a shaman) and make sure it has no shadow, has the locust ability, has invulnerable and remove the model file. This is simaller to the dummy demolisher unit. Remove its attack and movespeed as well. This will make the dummy not move and not screw up the spell. Once your dummy unit is finished, move onto the next paragraph.

Third, make another spell but this time, base it off of entangling roots, make it unit, and modify whatever you want the spell to do (damage, seconds rooted etc..). All that really matters is the damage and seconds rooted, the rest like the cooldown wont work because the dummy will be removed in a few seconds. It is important for this to be a unit spell and not hero.

Forth, Now that your dummy spell, your dummy unit, and your real spell that does all the work are set, its time for the obvious triggering part.

All triggers (unless activated by another) require an action, so lets just use this one.

  • Events
    • Unit - A unit Begins casting an ability
Short and to the point. Now to the condition

  • Conditions
    • (Ability being cast) Equal to Roots
Roots is the spell the hero has (assuming you named it roots). This spell is just to trigger the actions as you see. It serves no other purpose.

Now we must create the dummy unit.

  • Unit - Create 1 Dummy For Roots Spell for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees
  • Set StoreUnit = (Last created unit)
This creates the dummy at the triggering unit so that it looks like the hero is casting it.
I like to have a small wait function in all my triggers to make sure the thing registers.

  • Wait .20 seconds
For this part of the trigger, you must know what you based the spell the unit has. Not the hero but the unit. In this case, if you followed the guide directly, we based it off of entangling roots. If you dont know, just right click the abilities name and revert it back to its original name. Once you find out, continue.
Now, we must make the unit that we just created (the dummy) cast the ability. Now do this:

  • Unit - Order StoreUnit to Night Elf Keeper Of The Grove - Entangling Roots (Random unit from (Units within 900.00 of (Position of (Last created unit))))
This as you see says "Night Elf Keeper Of The Grove - Entangling Roots", this spell is what the original spell was. This is very important. Now it will trigger the dummy unit to cast the entangling roots spell on a random unsuspecting unit within 900 range at the position of the dummy unit. This is the reason why I said a dummy unit can only have 1 spell based off of the ability because as you see by the trigger, if it was 2 spells, it would glitch.
Well, there you go, a completed spell that took lower then 8 actions to make. If you want to make sure that dummy unit goes away then add this at the bottom of the trigger

  • Unit - Add a 5.00 second Generic expiration timer to StoreUnit
(Last created unit is the dummy unit). We have just successfully made the entangling roots spell a simple, casting spell.
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
  • You should use [list] tags under Requirements and Defininitions.
  • For the love of god, don't use Begins casting an ability
  • Clean up leaks or at least acknowledge them
  • To make this MUI and more efficient, use Unit - Apply Timed Life
  • Use simple math instead of if-statements for level differences
  • Either consistently use Casting Unit or Triggering Unit, don't switch between them (for confusion's sake) - Triggering Unit is preferable.
 
Level 8
Joined
Sep 9, 2007
Messages
395
Please use a global point variable (ex: CasterPoint, Point type global variable) so you can clean it suing custom text "call RemoveLocation(udg_CasterPoint)"
This will fix some leaks and it is still GUI.

I have a great GUI leak fixing tutorial, but I cannot remeber where I got it, so I cannot upload it. I will email a copy of it to you Parrothead if you want it. You can PM me your email address, or send me an email.
 
For pasive spells use condition:(im not in WE so ill write it, mby wont be totaly correct)

  • Conditions
  • Random integer between 1 and 100 less or equal to 4 x Level of <based pasive aura> for triggering unit
Condition is AND (random integer and level of ability)

now if the level of pasive spell is 1 there is 4% chance to create a dummy
for level 2 spell is 8% to create a dummy, you can make a nother value like 5/6
and the do the math lvl 1x5=5% lvl 2x5=10% etc.
 
Last edited:
Top