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

[Spell] How to create a custom buff effect

Status
Not open for further replies.
Level 4
Joined
Jan 2, 2016
Messages
66
I'm learning the World Editor, and I'm having trouble making a custom spell. My spell is called Armor of Thorns; it temporarily provides an armor boost and causes a percentage of melee damage to be returned to the attackers (basically Thorns Aura effect).

I've created a custom spell based on Frost Armor (the non-autocast version, if that matters), and set the duration of the frost slowing effect to 0.01 seconds in order to get rid of it, and created a custom buff. But I'm not sure how to make the damage be returned to melee units that attack the Armored units.

Can anyone help on this?
 
Level 13
Joined
Jan 2, 2016
Messages
973
Get the GDD system (Damage Detection) and it will be really simple :p
http://www.thehelper.net/threads/gui-friendly-damage-detection.123417/
  • Trigger
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamagedUnit has buff Frost Armor) Equal to True
    • Actions
      • Unit - Cause GDD_DamagedUnit to damage GDD_DamageSource, dealing (0.50 x GDD_Damage) damage of attack type Chaos and damage type Universal
EDIT: If you don't wanna get the GDD, you can still do it, but you need 2 triggers:
  • Trigger2
    • Events
    • Conditions
      • (Triggering Unit has buff Frost Armor) Equal to True
    • Actions
      • Unit - Cause Triggering Unit to damage DamageSource, dealing (0.50 x Event Response Damage Taken) damage of attack type Chaos and damage type Universal
  • Trigger1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Frost Armor
    • Actions
      • Trigger - Add to Trigger2 <gen> the event (Unit - (Target unit of ability being cast) Takes damage)
Or another way would be:
Create an item ability, based on Thorns Aura (with 0 AoE), and simply add it to the Target of ability being cast when you cast the Frost Armor. Also put that unit in a unit group. Then make another trigger that checks every (1) second: loop - picks all the units in the unit group and if they don't have the buff - it removes the thorns aura ability from them, if they have it (the buff) - it does nothing.

If your unit gets an extra icon of a thorns aura this way, you can make a spellbook ability, add the aura there, disable the ability in the map initialization, and you can add/remove the spellbook with the described trigger :p
 
Level 4
Joined
Jan 2, 2016
Messages
66
Thanks for the reply.

It looks like I'll have to use the third system you mentioned (with the item version of Thorns Aura), since the others don't appear to check if it was a melee attack. Plus, giving a zero-range version of Thorns Aura was an idea I already had, I just wasn't sure exactly how to implement it.
 
Level 23
Joined
Feb 6, 2014
Messages
2,466
Thanks for the reply.

It looks like I'll have to use the third system you mentioned (with the item version of Thorns Aura), since the others don't appear to check if it was a melee attack. Plus, giving a zero-range version of Thorns Aura was an idea I already had, I just wasn't sure exactly how to implement it.

Good thing you didn't follow his 2nd suggestion because it leaks a Trigger Event.
 
Level 4
Joined
Jan 2, 2016
Messages
66
I've gotten this working, by adding a Thorns Aura in a disabled spellbook. The only minor problem is that two Thorns Aura buff icons appear on the affected unit, even though I've gone into the dummy Thorns Aura and removed everything from the "Stats - Buffs" field. How could I get rid of this?
 
There is no way to remove buff icons from auras.

Instead, you should use this aura buff as the buff for your ability in general. If you want easy reflective damage, I think there is a passive (with no buff icon) that does reflective damage. Check how orc burrows and towers are made; they get a reflect damage passive after upgrading.

So in this case you can just combine this passive with a devotion aura (to get a buff icon and apply the armor bonus).


But I really suggest to trigger the reflect damage by using a damage detection system like DDS.
 
Level 4
Joined
Jan 2, 2016
Messages
66
Check how orc burrows and towers are made; they get a reflect damage passive after upgrading.

By this you mean the Spiked Barricades ability? That's an idea, but the problem I see with this is that it only allows a fixed damage amount, rather than a percentage of incoming damage, to be reflected. I guess I could redesign my custom spell, but I'd much rather have it return a percentage.

The DDS seems like the way to go, except that I don't know how to make it check that the damage was from a melee attack, or if it even can do that.
 
Level 12
Joined
May 22, 2015
Messages
1,051
By this you mean the Spiked Barricades ability? That's an idea, but the problem I see with this is that it only allows a fixed damage amount, rather than a percentage of incoming damage, to be reflected. I guess I could redesign my custom spell, but I'd much rather have it return a percentage.

The DDS seems like the way to go, except that I don't know how to make it check that the damage was from a melee attack, or if it even can do that.

DDS detects:
damage amount
victim of the damage (triggering unit)
source of the damage (damage source)
... maybe some other things

Anyway, you can definitely access the unit that dealt the damage and see if they are melee or not. You might need a more fancy one to make sure the damage isn't from a spell, though.

You could use thorns aura on a spell book. It should do what you are trying to do. I know thorns aura also has a checkbox to deal flat damage or % damage. I don't know if spiked barricades has that checkbox, but it's worth a check.
 
Level 4
Joined
Jan 2, 2016
Messages
66
Could you not use Spiked Carapace? (From Crypt Lord or Sea Turtles)

You could then periodically check all units with the ability and if they don't have your buff then remove it.

Wow, nice catch. Spiked Carapace doesn't show a buff icon. I really should have thought of that.

DDS detects:
damage amount
victim of the damage (triggering unit)
source of the damage (damage source)
... maybe some other things

Anyway, you can definitely access the unit that dealt the damage and see if they are melee or not. You might need a more fancy one to make sure the damage isn't from a spell, though.

The DDS might be a better way to go, but what I have now works. If I need to I'll change it later.

This is the system I have:

  • Armor of Thorns 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Armor of Thorns
    • Actions
      • Unit - Add Dummy Spellbook (Armor of Thorns) to (Target unit of ability being cast)
      • Unit Group - Add (Target unit of ability being cast) to ArmorOfThornsGroup
  • Armor of Thorns 2
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ArmorOfThornsGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Armor of Thorns ) Equal to False
            • Then - Actions
              • Unit - Remove Dummy Spellbook (Armor of Thorns) from (Picked unit)
              • Unit Group - Remove (Picked unit) from ArmorOfThornsGroup
            • Else - Actions
The Dummy Spellbook contains a modified version of Spiked Carapace, and the spellbook is disabled in the Map Initialization.

The only weird thing is that if I cast Armor of Thorns on Crypt Lord who hasn't learned Spiked Carapace yet, it will add the spikes to his back. That situation isn't likely to come up in my campaign though.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Wow, nice catch. Spiked Carapace doesn't show a buff icon. I really should have thought of that.



The DDS might be a better way to go, but what I have now works. If I need to I'll change it later.

This is the system I have:

  • Armor of Thorns 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Armor of Thorns
    • Actions
      • Unit - Add Dummy Spellbook (Armor of Thorns) to (Target unit of ability being cast)
      • Unit Group - Add (Target unit of ability being cast) to ArmorOfThornsGroup
  • Armor of Thorns 2
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ArmorOfThornsGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Armor of Thorns ) Equal to False
            • Then - Actions
              • Unit - Remove Dummy Spellbook (Armor of Thorns) from (Picked unit)
              • Unit Group - Remove (Picked unit) from ArmorOfThornsGroup
            • Else - Actions
The Dummy Spellbook contains a modified version of Spiked Carapace, and the spellbook is disabled in the Map Initialization.

The only weird thing is that if I cast Armor of Thorns on Crypt Lord who hasn't learned Spiked Carapace yet, it will add the spikes to his back. That situation isn't likely to come up in my campaign though.

This bug can be fixed. It happens when a unit has a certain checkbox or something in the OE data. It is something like "Animation Names - Large" or something funky like that. You will notice it also does this on the archmage hero and basically all mounted units. Taking it off may cause bugs with other animations and attachment points, though.

I know I solved this on my map, but forget the exact solution. All I know is that I originally removed the buff from spiked carapace ability completely. I later put the buff back and removed the animation from the buff itself. That fixed it.

It's been a while since I've worked in the editor, so forgive me for being so vague with this information. I can look it up if you want to know the exact steps.
 
Status
Not open for further replies.
Top