Single Target Spell for Multiple Units

Level 21
Joined
Aug 27, 2013
Messages
3,963
I just want to share my experience and knowledge with the others and i don't think everyone knows about this, right? Especially those who've just joined modding.
Be aware that I don't recommend this tutorial to you if you are still new to triggering.


Things You May Need

  • You must understand English
  • You have Warcraft III and World Editor
  • Knowledge about Triggers/Trigger Editor
  • Knowledge about Object Editor

Introduction

Have you ever been wondering how to use single target ability against multiple units?
For example: Sleep, you can only use Sleep against single unit/target but you want to use it against multiple units, like units within range or something.
Therefore we will use trigger to do this.
Maybe you think triggering is hard to understand, but i will explain it to you as simple as i can.

Lets get this started

Without further ado, let's get down to the business. We will start with Object Editor then we will use trigger. We will make a Sleep ability with instant cast which will put units within range to sleep.

Object Editor

Because You already know about world editor I think you're also already familiar with Object Editor, to be honest Object Editor was the next place i visited after world editor.

  • Create a New Ability based on Roar (You may use any other instant cast abilities such as; Thunder Clap, War Stomp, Battle Roar/Roar, etc)
    • Art - Caster, change it to your desired special effect, this special effect will appeared when you cast the spell.
    • Data - Damage Increase (%), change it to 0.00, because we don't want the damage increase effect from this ability.
    • Stats - Buff, delete the available value. Buff is status effect which will appeared at Unit's status bar. Note that even if we delete the buff the buff will still appear at unit's status.
    • Stats - Duration - Hero
      Stats - Duration - Unit
      , change both of them to 0.00.
    • Stats - Target Allowed, change it to none

    This will be our unit's ability. This is the ability which will we click in the game, You may change its description to whatever you like.

  • Create a New Ability based on Sleep (Because we will need Sleep buff to put units to sleep, same to stun. You could use Storm Bolt/Fire Bolt to stun your target)
    • Data - Stun Duration, i'm not sure what is this for. But i will change it to 0.00
    • Stats - Cast Range, change it to 99999 to make sure our Dummy Unit could reach the target, but this still has a problem because of visibility
    • Stats - Duration - Hero
      Stats - Duration - Unit
      , change these to your desired duration. I will change it to 2 second.
    • Stats - Mana Cost, change it to 0, so our Dummy Unit can use the ability without mana.

    This will be our dummy's ability. It's an ability where you can't see it in the game. In order to do this we will need a help from a unit to cast the ability to the enemies. This unit is what the so called Dummy.)

  • Create a New Unit, i will base it on Footman. You may use any other unit, though.
    • Abilities - Normal, Add the sleep ability and Locust ability to the list. Locust ability allows our Dummy's Hit Points and Mana bar to be hidden
    • Art - Animation - Cast Backswing, change this to 0.000 otherwise this method won't work properly
    • Art - Animation - Cast Point, change this to 0.000 otherwise this method won't work properly
    • Art - Model File, use custom path and write "Dummy" on it. Because there is no Model File with "Dummy" as a name, if you put this inside the world editor it will appear as Green Box. But in the game it will appear without any model file.
    • Art - Shadow Image (Unit), change it to none. So Dummy will have no shadow beneath it.
    • Damage, we will make the Dummy has no damage. So it won't attack enemy unit.
      • Combat - Attack 1 - Damage Base, change it to 0
      • Combat - Attack 1 - Damage Number of Dice, change it to 0
      • Combat - Attack 1 - Damage Sides per Die, change it to 0
    • Movement - Type, change it to Fly. So Dummy won't collide with other units in battlefield.
    • Movement - Speed, change it to 0

understand now? it's pretty easy actually.
now, we'll begin with the triggering part, is it hard? no, of course not.

Trigger

  • Trigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sleep
    • Actions-
      • -------- This is a guy who use the ability --------
      • Set Caster = (Triggering unit)
      • -------- The Owner of Caster --------
      • Set Owner = (Triggering Player)
      • -------- Store Caster's position into a variable --------
      • Set TempPoint = (Position of Caster)
      • -------- We create our dummy --------
      • Unit - Create 1 Dummy for Owner at TempPoint facing Default building facing degrees
      • -------- Store him into a variable --------
      • Set DummyUnit = (Last created unit)
      • -------- We gives him the dummy's sleep ability --------
      • Unit - Add Sleep (Dummy) to DummyUnit
      • -------- We gives him an expiration timer, he won't stay forever --------
      • Unit - Add a 1.00 second Generic expiration timer to DummyUnit
      • -------- Pick units within 500 range of position of the caster --------
      • Set Group = (Units within 500.00 of TempPoint)
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • -------- Store the picked unit into a variable first, because we'll use them more than once --------
          • Set TempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempUnit belongs to an enemy of Owner) Equal to True
              • ((TempUnit is alive) Equal to True)
            • Then - Actions
              • -------- Order him to use it against all units within 500 range of Position of the caster --------
              • Unit - Order DummyUnit to Undead Dreadlord - Sleep TempUnit
              • Else - Actions
      • -------- We remove the leaks --------
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call DestroyGroup(udg_Group)

Useful Links


So how was it?
Easy and simple right?
I hope this can be useful for anyone who read this
and you can use the test map if you want to make sure of it or learn it directly from the test map. You can download it - here

Credits

I'd like to thank these guys, for help me improving this tutorial.

And Thank you for reading all of this ^^
My thanks doesn't apply to those who just skip the tutorial and read this part
 

Attachments

  • Sleep Test.w3x
    18.4 KB · Views: 621
Last edited:
Level 23
Joined
Oct 20, 2012
Messages
3,088
The images aren't showing onii-san. They need some fixin'

Anyway, this is a pretty nice and simple tutorial you have. You could add some more details to what you're doing and why though.
Tutorials should be retarded proof.
Oh and Maybe add some other examples too? Like AoE Sleep, AoE Roots. They use the same process but it would still be pretty nice to add here (imo).

Still a T-up from me. This could be useful to beginners in triggering/ the WE. :)
 
  • Like
Reactions: ILH
Level 29
Joined
Oct 24, 2012
Messages
6,545
change color. That green is horrible i can't even read the tutorial lol.

In your triggers however you should show them how to do it with only 1 dummy unit even if the spell is cast 1k times.

For this
  • Set Group = (Units within 200.00 of TempPoint matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Caster)) Equal to True)))
You should get rid of the conditions and just put an ITE in your group loop.
Also you should show them how to remove dead units.
And anything used twice or more should be stored into a variable. Example: Owner of Caster.
 
  • Like
Reactions: ILH
Level 22
Joined
Sep 24, 2005
Messages
4,820
Don't forget to set the dummy's art fields Cast Backswing and Cast Point to 0.
 
Last edited:
Level 19
Joined
Aug 13, 2013
Messages
1,680
It is hurting my eyes to read the trigger, must do make spaces from comments and don't use condition icon in comments, use a comment icon like adding a ---- ----.

EDIT: Fix the table of contents, some links are bringing me in forums.
 
Level 19
Joined
Aug 13, 2013
Messages
1,680
@Rheiko
You may want to link knowledge about variables ^^.

EDIT:

Also, the red text and the body of the tutorial hurts my eyes, seperate them by space or enter. Don't make it all Italic letters maybe bold lettters can give attention.
 
Level 37
Joined
Mar 6, 2006
Messages
9,242
You could mention that the Death type should be set to Can't raise, does not decay so the dummy won't decay there for 90 seconds, it is removed after after the expiration timer and Art - death time.

You could also state that Locust makes the unit invulnerable and unclickable and not collide with other units.
 
Level 37
Joined
Mar 6, 2006
Messages
9,242
  • I would base the ability on Channel. It is best that new users learn to use that ability
  • The dummy's death type should be can't raise, does not decay so it does not decay there for 90 seconds
  • Tell people the Locust makes the dummy invulnerable. Often I see Locust paired with invulnerability ability in spells.
    The separate invulnerability ability is not needed
  • You could set the level of the dummy ability to the ability level of the caster
  • Affected units become invulnerable briefly in the test map
  • Rather than setting three values to 0 for the dummy to disable its attack, set attacks enabled to none
  • The dummy gives a huge amount of vision. Usually it is not a problem since the hero is close and give even more vision.
    Still, you could set the dummys vision to a much lesser value
  • Locust disables collision so there is no need to set the movement type to fly
 
Level 29
Joined
Oct 24, 2012
Messages
6,545
My thanks doesn't apply to those who just skip the tutorial and read this part

Oops.


Anyways. One thing i see is that you should add in a notation and an example of how to do this type of spell using only one dummy unit for the whole game.
On any spell that you think will get used more than a few times you should consider creating only one dummy unit at the beginning of the map. You should then move that dummy unit when you need it and order it to cast the spell onto the units. ( It is not needed but it is a good suggestion for people reading your tutorial)
 
Level 19
Joined
Aug 13, 2013
Messages
1,680
Oops.


Anyways. One thing i see is that you should add in a notation and an example of how to do this type of spell using only one dummy unit for the whole game.
On any spell that you think will get used more than a few times you should consider creating only one dummy unit at the beginning of the map. You should then move that dummy unit when you need it and order it to cast the spell onto the units. ( It is not needed but it is a good suggestion for people reading your tutorial)

It is optional ^^, but i prefer creating 1 dummy in every spell per cast in group enumeration and killing the dummy.
 
Top