Triggered Spells Tutorial

Has this tutorial helped you?

  • Yes

    Votes: 1 100.0%
  • Too long to read

    Votes: 0 0.0%
  • No

    Votes: 0 0.0%

  • Total voters
    1

Cres

New Member
Reaction score
25
A basic tutorial on triggered spells.

Events to know

Unit - Generic Unit Event
-A unit starts channeling an ability
-A unit starts casting an ability
-A unit finishes casting an ability

These are the most commonly used commands for triggered spells

What each of them do:

-A unit starts channeling an ability
This is for spells like starfall, usually used if you want another event to occur

-A unit starts casting an ability
This is the one i use the most, many spells are purely triggered effects and the "casting" ability doesnt do anything

-A unit finishes casting an ability
This is you want the unit to die or become invulnerable after casting an ability, mostly this is used for climactics (like when illidain finishes casting his "channel")

Condition to know

Abilty being cast equal to <XXXXX>
This basically just makes sure the trigger only runs for this ability

Actions to know

-Wait
-Wait (Game-Time)
-Set variable
-If/Then/Else (Multiple Functions)
-For Integer A, do multiple actions
-Create Special effect at point
Most of the unit commands are useful, here are just a few popular ones
-Unit - Kill
-Unit - Damage Target
-Unit - Damage Area
-Move Unit (Instantly)

What these do:
Wait- Waits for a specified duration, i usually use Wait (Game-Time)
Wait (Game-Time)- a more "accurate" wait
Set variable- sets a chosen variable
If/Then/Else (Multiple Functions)- a very important action, 3 part (like a mini trigger)
For Integer A, Do multiple fuctions- a handy trigger, very good for mass special effects
-Create Special effect at point- creates a temporary special effect


Now, some sample spells using some of these thingys...

Simple Blink Strike
I'm pretty sure everyone has heard of a blink stirke, if not this is what it does, you blink to a target and you hit it for damage, very self-explanitory.

First,
Find an ability to base it off of, I will choose channel for this purpose. (see Conan's excellent channeling tutorial for finer points on using it)
Now, edit it around and make sure to check Options- Visible and change the animation follow through to 0 or something and have unit target enabled

Second,
Its trigger time!
First, you will want to use the event a unit begins casting an ability

Code:
Unit - A unit Begins casting an ability

Now, for conditions.

Code:
(Ability being cast) Equal to Blink Strike
This is rather obvious, so this trigger doesnt go off for every spell cast

The hard part, Actions...

1. You will need 2 variables, Casting_Unit and Targeted_Unit both will be type "unit"
2. Set these two variables like this, this is to make sure you dont lose your casting or targeted unit sometime later in the code.

Code:
Set Casting_Unit = (Casting unit) 
Set Targeted_Unit = (Target unit of ability being cast)

3. Changing turn rate, so the casting unit will face the targeted unit instantly later

Code:
Animation - Change Casting_Unit turn speed to 1.00

4. This is pausing the casting unit, so he doesnt run away after blinking.

Code:
Unit - Pause Casting_Unit

5. Moving the casting unit, this uses unit move instantly and face point

Code:
Unit - Move Casting_Unit instantly to (Position of Targeted_Unit), facing (Position of Targeted_Unit)

6. Dealing Damage, i will make the ability deal damage equal to the casting unit's agility and intellegence attributes multiplied by 3. The attributes are found by "Convert Real to Integer"

Code:
Unit - Order Casting_Unit to damage Targeted_Unit for (((Real((Agility of Casting_Unit (Exclude bonuses)))) + (Real((Intelligence of Casting_Unit (Exclude bonuses))))) x 3.00) using attack type Spells and damage type Normal.

7. Any special effects you want to show, this is just for eye candy, I will make the targeted unit spew blood and the casting unit do its attack animation.

Code:
Animation - Play Casting_Unit's Slam animation
Special Effect - Create a special effect attached to the overhead of Targeted_Unit using Objects\Spawnmodels\Orc\Orcblood\BattrollBlood.mdl

8. Fixing, this is to reset all the things we modified

Code:
Animation - Change Casting_Unit turn speed to (Default turn speed of Casting_Unit)
Unit - Unpause Casting_Unit
Special Effect - Destroy (Last created special effect)

Full Code:
Code:
Events-
     Unit - A unit Begins casting an ability
Conditions
    (Ability being cast) Equal to Blink Strike
Actions
    Set Casting_Unit = (Casting unit)
    Set Targeted_Unit = (Target unit of ability being cast)
    Unit - Pause Casting_Unit
    Unit - Move Casting_Unit instantly to (Position of Targeted_Unit), facing (Position of Targeted_Unit)
    Unit - Order Casting_Unit to damage Targeted_Unit for (((Real((Agility of Casting_Unit (Exclude bonuses)))) + (Real((Intelligence of Casting_Unit (Exclude bonuses))))) x 3.00) using attack type Spells and damage type Normal.
    Animation - Play Casting_Unit's Slam animation
    Special Effect - Create a special effect attached to the overhead of Targeted_Unit using Objects\Spawnmodels\Orc\Orcblood\BattrollBlood.mdl
    Animation - Change Casting_Unit turn speed to (Default turn speed of Casting_Unit)
    Unit - Unpause Casting_Unit
    Special Effect - Destroy (Last created special effect)




Another Spell, Freezing Field
This spell is a bit harder, it involves dummy units
Dummy units are- units that are created to do things like cast spells but making it look like the casting unit is really casting it.

First,
Find an ability to base it off of, i will use channel again because it is simply easier, and channeling ability will do.

Second, Edit the Frost Nova ability so it has Targets allowed- Self and Nova damage- 100 (or w/e) and its mana cost is 0

Third, triggers

1. The event is a unit begins CHANNELING an ability, much different from last time

Code:
Events
Unit - A unit Begins channeling an ability

2. The condition is the same as last time, but different name

Code:
Conditions
(Ability being cast) Equal to Freezing Field

3. Actions, we will use loops and dummy units

Code:
For each (Integer A) from 1 to 10, do (Actions)
    Loop - Actions
        Unit - Create 1 Footman for Player 1 (Red) at (Random point in (Region centered at (Position of (Triggering unit)) with size (600.00, 600.00))) facing Default building facing degrees

This is only the first part of the loop, the 1 to 10 part means how many novas we will see. The create footman part is the unit i gave the frost nova ability to.

part 2
Code:
For each (Integer A) from 1 to 10, do (Actions)
    Loop - Actions
        Unit - Create 1 Footman for Player 1 (Red) at (Random point in (Region centered at (Position of (Triggering unit)) with size (600.00, 600.00))) facing Default building facing degrees
        Set Dummy_Unit = (Last created unit)
        Animation - Change Dummy_Unit's size to (0.01%, 0.01%, 0.01%) of its original size
        Unit - Add Frost Nova to Dummy_Unit
        Unit - Order Dummy_Unit to Undead Lich - Frost Nova Dummy_Unit
        Wait 0.20 seconds
        Unit - Remove Dummy_Unit from the game

I have just set the footman to a variable, and then i changed its size so that it is not noticed. Also, i ordered it to frost mova itself which means the nova damage to carry on to nearby units. In the end i removed it so it does not show blood or leave a corpse and the loop runs again. It is best for the dummy unit to have no shadow as well (in object editor)
 

Rad

...
Reaction score
228
Its nice I guess, you shouldnt call it Spell Tutorial when its ONLY for triggered spells. Also, you dont explain the condition - Integer - Level of <Ability> for <Unit> which could help alot of people with multi-level triggered spells. There is also alot of spell information not included, such as using buffs. This is basically a Blink-Strike tutorial ;)

EDIT: Why is it a poll? You have no real option for me (I know everything I need in terms of triggering) :p
 

UnknowVector

I come from the net ... My format, Vector.
Reaction score
144
You need to add in "a unit starts the effects of an ablility" its keeps out the explotion of quikly cancleing a spell and some things only work with it.
 
S

salempc

Guest
A way to not be creationg a lot of variables is to use the custom scripts:

Code:
local unit CASTER
local unit TARGET

This creates the Unit type Varibles in the instant, so you should put yur actions like this:
Code:
local unit CASTER
local unit TARGET
Set CASTER = (Casting unit) 
Set TTARGET = (Target unit of ability being cast)
 

Cres

New Member
Reaction score
25
Thanks for feedback, im not really into JASS and stuff, it was just used to help introduce people into triggered spells, i will rename if possible.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top