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

How to make a Sword/Slash Ability (No Target)

sPy

sPy

Level 21
Joined
Apr 10, 2009
Messages
268
~How to make a Sword/Slash Ability~

Introduction
In this tutorial, I will teach you how to make a slash ability. It is pretty simple, so no worries!

The slash ability is a no target type spell. For example, if you presses the ability, the units that is in front of you will automatically takes damage.

All we need is some abilities and triggers.Now, let's get started, shall we?

Unit:
A Dummy
(I based the dummy from the chicken, and then I replaced the Wander ability to Locust. I removed the model of the chicken, replaced the path of the model into something like ".mdl" and then I removed the shadow of the chicken. Also, change the movement type from foot to fly to prevent collision bugs.)

Variables:
MeleeCaster (Unit Variable)
MeleeDummy (Unit Variable)
MeleePoints (Point Array Variable)



Abilities
Firstly, let us make the abilities first. Without the abilities, the triggers can't be done.

Let's set up the spells now, we'll go step by step.

Make a custom Summon Bear first, I'll name it "Melee". I'll show you by pictures:
SummonBear.jpg SummonBear2.jpg

In this picture, I'm not making the ability as a hero spell because it looks kinda weird in my opinion.

I'm making the Summon Bear as "low profile" as possible by changing the summoned unit into a dummy, set it's duration to 0.01 second, and then I removed it's summoning effects.

Also, you'll need to make a custom buff for this ability. To do that, simply go to the Buff section and then create a custom buff based on "Bear". All you got to do at the buff is only removing it's effect so our "tricks" won't be "noticed".


This one we'll use Fan of Knives spell as base, here's the picture of the ability's data:
MeleeDmg Part 1.jpg MeleeDmg Part 2.jpg

For this one, I'll add 100 damage as the description of the Melee ability says.

I'm putting "Number of targets field" to 0 because it means infinite, which I can hurt as many opponent I want. So basically, if you want to hurt 1 unit only, you should put it to 1.

You might be noticing why I'm putting the projectile missile speed to 99999, it is because I wanted it to become instant damage, and I set the blood as it's missile to make it looked more interesting.

For the "Maximum Damage" I put it 999999 so the ability can handle as many opponent as you want.


Trigger
It time for the final part now :)
For some of you, you might be thinking, "Oh no this will be my worst nightmare". Relax, it's pretty easy.

Let's get started! Here's the trigger:
  • Melee
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Melee
    • Actions
      • -------- I'll create some variables at first to make things easier. --------
      • Set MeleeCaster = (Triggering unit)
      • Set MeleePoints[1] = (Position of MeleeCaster)
      • Set MeleePoints[2] = (MeleePoints[1] offset by 50.00 towards (Facing of MeleeCaster) degrees)
      • -------- Now let's create a dummy to cast the damage that we has just created. --------
      • Unit - Create 1 Dummy for (Owner of MeleeCaster) at MeleePoints[2] facing Default building facing degrees
      • Set MeleeDummy = (Last created unit)
      • -------- I'm adding expiration time to make it disappear after 0.5 second, and give it an ability. --------
      • Unit - Add a 0.50 second Generic expiration timer to MeleeDummy
      • Unit - Add Melee Damage to MeleeDummy
      • -------- It's time to cast them! So let's add this action. --------
      • Unit - Order MeleeDummy to Night Elf Warden - Fan Of Knives
      • -------- Time to remove leaks in order to prevent ingame lags. --------
      • Custom script: call RemoveLocation(udg_MeleePoints[1])
      • Custom script: call RemoveLocation(udg_MeleePoints[2])
      • -------- You're done! --------
      • -------- Q: Why do create dummy unit at MeleePoints[2] but not [1]? --------
      • -------- A: Because hero attacks are facing front, so we're going create it a little in front--------
      • -------- Q: What is "Facing of MeleeCaster"? --------
      • -------- A: It means the facing direction of the caster, so it means if you want your dummy face your caster's left side, it should be "Facing of MeleeCaster + 90.00" and "Facing of MeleeCaster - 90.00" for right side.--------
      • -------- Q: Why do you use Warden - Fan of Knives ability to order dummy cast spells? --------
      • -------- A: Because we the melee damage spell was based from Fan of Knives. --------
See? Pretty simple right?
That's all for now, good luck in triggering! Here, I added a sample map in case you wanted to see how it works.
 

Attachments

  • Melee.w3x
    20 KB · Views: 1,163
Last edited:
Level 20
Joined
Feb 24, 2009
Messages
2,999
Not bad, seems ok (I don't think it leaks etc).
A tad basic atm though, perhaps you could add an explanation or some variant examples.
Like limiting it to hurting one unit at a time or having multiple abilities on one unit (swipe arc, jab, right, left?).

Otherwise good job, some newer members (maybe older to =?) could find this useful.
 
  • Like
Reactions: sPy
Level 5
Joined
Sep 29, 2008
Messages
171
Another thing almost exactly like this is a non-targettable slam using only 1 dummy spell like Thunderclap and placing the dummy unit slightly in front of the caster unit then cast the damaging Thunderclap spell for an instant cast slam or multiple slams that slow directly in front of the caster. This would make positioning more important for RPGs and AoSes than with a plain old large area ground stomp and would look good with most heroe's attack slam animations.

Of course, the popular way to do this is to use thunderclap for a non-targettable (or storm bolt to aim the spell) and making a complex system of coordinates just to overcomplicate things. :]
 
  • Like
Reactions: sPy
Doesn't mean the summoned dummy unit (from the spell, not trigger) a leak? because it's a lot more efficient to use "Channel" as the spell that initiates the trigger. It can be more real if you set the "disable other spells" to true in the channel spell, because you can't cast spells while you are attacking.

It's duration is set to 0.01 so it will be removed quickly (there may be other memory leaked related to creating a unit, but I won't go into that). I think he just wanted it there to display an effect, or something similar. But yes, generally we base it off Channel, and I can encourage you to do so. :)
 
Top