• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Creating some basic abilities

Level 1
Joined
Jul 29, 2017
Messages
1
guys i made are damaging spell with "Deal damage based on hero’s attribute points" part of the code but then it damages my units in the area too any idea what condition i need to add for preventing allied units taking damage from that spell ?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
guys i made are damaging spell with "Deal damage based on hero’s attribute points" part of the code but then it damages my units in the area too any idea what condition i need to add for preventing allied units taking damage from that spell ?
Add to either the unit search filter or the for group loop a test to check if the filter/picked unit owner is an ally of the casting/triggering unit owner.

If you use the damage unit in area action then it is not possible, it will damage all units in the area.
 
Level 2
Joined
Mar 9, 2019
Messages
21
III. Custom auras

What about making an aura that gives a special skill for nearby friendly/enemy units? In this example we’ll make an aura that gives 4%/8%/12% chance for nearby friendly units to regenerate 15/30/45 hit points on each attack. The trigger is simple but it has a problem:
  • RegenAura
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has buff <aura’s buff>) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • <chance> Greater than or equal to (Random integer number between 1 and 100)
        • Then - Actions
          • Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) + <regen bonus>)
        • Else - Actions
Maybe you already see the problem: we cannot detect the level of the aura! There’s no such an action to do so. This is the main issue why I included this type of ability in this tutorial. We have to make a trick.
Make separate buffs for each level!! That’s the key. This way, we can detect which buff the affected unit has, so we can get the exact level of the aura. Example:
Level 1 – Stats – Buffs Regen Aura (level 1)
Level 2 – Stats – Buffs Regen Aura (level 2)
Level 3 – Stats – Buffs Regen Aura (level 3)

The trigger must be modified this way:
  • RegenAura
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • ((Attacking unit) has buff Regen Aura (level 1)) Equal to True
          • ((Attacking unit) has buff Regen Aura (level 2)) Equal to True
          • ((Attacking unit) has buff Regen Aura (level 3)) Equal to True
    • Actions
      • If (((Attacking unit) has buff Regen Aura (level 1)) Equal to True) then do (Set Level = 1) else do (Do nothing)
      • If (((Attacking unit) has buff Regen Aura (level 2)) Equal to True) then do (Set Level = 2) else do (Do nothing)
      • If (((Attacking unit) has buff Regen Aura (level 3)) Equal to True) then do (Set Level = 3) else do (Do nothing)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level x 4) Greater than or equal to (Random integer number between 1 and 100)
        • Then - Actions
          • Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) + ((Real(Level)) x 15.00))
          • Else - Actions
After detecting which buff the unit has, we set the variable (Level) to the appropriate value, and we can use it to calculate other values like the chance and the regen value to fit level-stats. And there you go!

What I am trying to do is 20% chance on hit, attacking hero casts chain lightning on attacked unit, doing this without a dummy unit.
So far I have this...
CArnf2I.png


In the regen aura, it uses arithmetic to reach the health gained.
If I am trying to have the multiple ranks, would I be better off making 3 different chain lightnings and adding a new buff for each rank of the aura? The chance would always be 20%, but each rank increases in damage and targets to chain.
If attacking unit has <buff(rank)> then casting unit casts chain lightning(rank) to attacked unit
Would this work?
____________________________________
Edit: I solved my problem and here's how I did it.
kQgRqqa.png


Silly me didn't know that you could just set the level of the ability, which makes me curious why the author did arithmetic when they could have just sorted that in the ability?
As for Chain Lightning, there is no one I could find to trigger a unit to open a spellbook, and what I want to do is to try to keep Chain Lightning hidden since it costs 0 mana and no cd (very op!)
To do this I just added the ability, waited some time, found that if I did not put a wait sometimes it would not cast, not sure why.
Added a 1s before removing the ability because it took about 1s for the unit to cast the ability once it was added.

Plus a player could try to cast it before the unit did, but it would not cast twice, so it didn't matter if this player cast it or the trigger did.

I am worried if this will lead to a data leak, but so far it works!
 
Last edited:
Level 1
Joined
Jan 17, 2021
Messages
1
Hey guys! I know this is an old post but I just got back into editing again after a very long break and saw an unanswered question in the comments that I was experiencing too.

The Blink Strike will trigger the effect of blinking, damage, and whatever effects you may put in, but the cooldown wouldn't go off. Essentially you could cast it as much as you wanted without a cooldown as long as you had the mana.
I believe the issue behind this was that there are a lot of wind up animations for certain abilities and on certain models. For example, the Mountain King winds his arm back before he throws a Storm Bolt. However (continuing with the Mountain King & Storm Bolt example) the "A unit Starts the effect of an ability" begins its Event Trigger as he starts his cast animation, and the cooldown of Storm Bolt does not begin until the hammer leaves his hand. This means the ability technically isn't used, doesn't go on cooldown, but the trigger registers it as an ability cast so it does the remainder of the trigger as if you had.

This is a short fix I used for it, it may not be the cleanest way of doing it but it did the job.

fcie9dn.png


I did 3 changes here compared to the original that made the difference.

1. I changed the "A unit Starts the effect of an ability" to "A unit Begins channeling an ability". This ties in with the second change I made.
2. I made the base ability a channeling ability. Since the ability I wanted to Blink Strike with needed to be a target-lock on, I used Siphon Mana. It's a channel that targets a specific unit, perfect for the uses.
3. I put a wait timer of 0.25 seconds. This gives the model a chance to go through the cast animation before the trigger kicks in. Since 0.25 seconds is a very short time, not even one tick of the Siphon Mana goes off on the enemy, but since you started the channel the cooldown of Siphon Mana will begin. When your trigger kicks in 0.25 seconds later, the "Unit - Order (Triggering unit) to Attack (Target unit of ability being cast)" action will instantly cancel the channel of Siphon Mana, giving you the Blink Strike ability you desire *with* a cooldown.

If you want to do this as a free target ability (*Not* for a single target lock-on) then I recommend Blizzard as a base spell.
Also the other change I made (Not Necessary!) is that I turned the single target damage into an AoE damage upon landing. That has nothing to do with the changes needed whatsoever to make the Blink Strike work with a cooldown.

Final note, just remove your "Stats - Buffs", "Sound - Effect Sound (Looping)" and "Art - Lighting Effects" from your Siphon Mana ability so there's no chance of visuals or audios from your Siphon Mana apprearing, and re-do the numbers on your Siphon Mana so that you're draining health instead of mana. This allows you to target enemies who don't have mana bars.
 
Last edited:
Level 2
Joined
Aug 22, 2020
Messages
18
Hello guys, I have a question regarding the spell description in the object editor - if I base the spell damage on attribute + bonus, is there any way of showing this amount of data (the damage it does, which is varied by the value of attribute) in the description of the spell?
 
Last edited:
Level 12
Joined
Mar 13, 2020
Messages
421
Hello guys, I have a question regarding the spell description in the object editor - if I base the spell damage on attribute + bonus, is there any way of showing this amount of data (the damage it does, which is varied by the value of attribute) in the description of the spell?

you can change the damage / tooltip / other stuff like Cooldown and much more while infame with set ability real level field
so if you cast for example Schockwave it changes the amount of damage done before the spell happens this method shown in this tutorial is old and the dmg is done with triggers
Now days you can set the ability stuff before the spell effect starts

for example I can change the stun duration of thunderclap for each level +1 sec or based on my strength

without leveling the ability or changing anything...

i recommend to not use this old method

and yes you can do it

EDIT: or use it only if your spell is fully Triggered and not based on an normal Ability

Example:

  • Firebolt
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Firebolt
    • Actions
      • Ability - Set Ability: (Unit: (Casting unit)'s Ability with Ability Code: Firebolt )'s Real Level Field: Damage ('Htb1') of Level: ((Level of Firebolt for (Casting unit)) - 1) to (((Real((Level of Firebolt for (Casting unit)))) x 10.00) + ((Real((Intelligence of (Casting unit) (Include bonuses)))) x (3.00 + Spellpower[(Player number of (Owner of (Casting unit)))])))
here you can see an example
the hero fires a firebolt (based on normal firebolt)
and before he even fire the firebolt it changes the value of the damage of the spell
based on

10 x Level of Ability (lets say lvl 3) = 30
Intelligence of the Hero (Casting Unit) lets say = 20 x 3 (because i want the 3 time amount of his Intelligence)
+ Spellpower a Real Variable i did for Items to incrase the output of spells in % but we dont take this now

30 + (20 x 3) = 90 Damage at the end that seems not much but i wanted it like that :p
 
Last edited:
Level 2
Joined
Aug 22, 2020
Messages
18
Thanks for the reply! I guess it will take me some time to proccess it all as I just started with trigger enhanced spells :pgrin: but so far it makes sense. Cheers!

EDIT: @Pwnica Where I can find the Ability - Set Ability action which is in your trigger? Maybe I'm using different version of editor? I'm not seeing it in the Actions anywhere, even when I search for it...
 
Last edited:
Level 7
Joined
Mar 10, 2005
Messages
55
Hey,
first of all thanks for those nice examples!
I'm struggeling myself getting a kind of blink spell to work. My hero teleports behind the enemy and does his damage but then he has a high probability to wander off and attack another enemy even if the trigger tells him otherwise. Could you please help me?
I'll include the map if possible.
I'm also interested in some skills like shockwave stampede or healing spell (based on channel) which are attribute based. Could you help me there too?
Thanks in advance!
 

Attachments

  • Unit-Skill-Testmap2.w3x
    7.3 MB · Views: 41
Level 25
Joined
Mar 29, 2020
Messages
1,465
Hey,
first of all thanks for those nice examples!
I'm struggeling myself getting a kind of blink spell to work. My hero teleports behind the enemy and does his damage but then he has a high probability to wander off and attack another enemy even if the trigger tells him otherwise. Could you please help me?
I'll include the map if possible.
I'm also interested in some skills like shockwave stampede or healing spell (based on channel) which are attribute based. Could you help me there too?
Thanks in advance!
I suggest you open a thread in the WEHZ (World Editor Help Zone) and include your triggers in the post. that is probably a better way to get help than posting in the comment section of a tutorial from 2007 :wink:
 
Level 25
Joined
Mar 29, 2020
Messages
1,465
Hello everyone,

What if I want to make a unit type (in my case: Sapphiron(living), able to be built from the Boneyard) to exist only one at a time (like the Mothership in SCII)?

P/s: Pardon my English if there is any mistake.
I suggest you open a thread in the WEHZ (World Editor Help Zone) and include your triggers in the post. that is probably a better way to get help than posting in the comment section of a tutorial from 2007 :wink:
 
Top