• 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.

Ability Help (Buffs)

Status
Not open for further replies.
Level 6
Joined
Nov 3, 2005
Messages
103
I'm trying to create a custom ability, a replicate of the Tinker's Robo-Goblin spell. I want the caster to take 25% or so more damage when he's the new unit, similar to the Berserker ability. I've tried creating the effect through triggers, but I can't find a "unit takes damage" event that isn't the "specific unit takes damage" event. I can't use this one since I can't create variables for it, unless there is some sort of way to use it that I don't know about. I've even tried giving the new unit the berserker buff hoping that would do anything.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Well, the best way to do it may be by giving the new summoned unit modified berserk ability, order it to cast it and immediately remove it.

Else there are ways to add new units to the "Unit takes damage" event, but in case of dynamic units (as in they come for a moment and then go) it may not be the best approach. You could, however, use damage detection system and just modify damage taken.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
I tihnk the idea with berserk is good. However if you could find a passive ability that does the same it would be even easier.
I dont know such an ability, but there are different abilities that reduce damage taken, maybe you can use one of those with negative reduction values.
You might have to play around with different abilities, like the Archers passive dmg reduction, the Mountaingiants passive, etc.

If you want to trigger it then you dont need a full damage detection system which registers a "damage taken" event for ALL units (like Nichilus wrote), its enough to create the event when the caster uses your spell (Register Event <Triggering Unit> takes damage).
 
Level 24
Joined
Oct 12, 2008
Messages
1,783
Yes

158564-albums6670-picture77838.jpg
 
Level 6
Joined
Nov 3, 2005
Messages
103
I'm not that experience in the world editor as far as triggers go, so I'm not sure if I'm ready for a damage system, although I do like the sound of it. I'm guessing it's a script or code or something like that right?

If it's too complex for me right now, how would I make the unit perform the berserk ability through triggers specifically?

If I try to use Unit - Issue order, it doesn't give me the choice of my custom ability. I'm also guessing he has to have it in the first place.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
I'm not that experience in the world editor as far as triggers go, so I'm not sure if I'm ready for a damage system, although I do like the sound of it. I'm guessing it's a script or code or something like that right?

If it's too complex for me right now, how would I make the unit perform the berserk ability through triggers specifically?

If I try to use Unit - Issue order, it doesn't give me the choice of my custom ability. I'm also guessing he has to have it in the first place.

Robo-goblin is a morphing ability. All stat differences it has are done through switching the stats and abilities of the 2 unit types around.
Make the alternate form have less armor and it takes more damage (except from spells).
To find out the appropriate amount of -armor you can set a unit's armor to something below 0, then check the damage reduction ingame. I think it should be something around 5-6.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
Armor doesnt scale properly. Here is an example:
Code:
function [armor, dmg_bonus,hp] = reduc(armor, dmg_bonus)
    hp = 1000;
    dmg = 100;
    dmg_reduction = (armor*0.06)/(1+armor*0.06);
    hp = hp - dmg*dmg_bonus * (1-dmg_reduction);
end

A unit with 1000 hp is attacked with 100 damage.

1. armor=10, dmg_bonus=1.5, hp left is 906.25
10.0000 1.5000 906.2500
2. armor=1.11, damage_bonus=1.0, hp left is 906.2441
1.1100 1.0000 906.2441
(-> so reducing armor by 8.89 results in similar hp left)

3. armor=100, dmg_bonus=1.5, hp left is 987.5714
100.0000 1.5000 978.5714
4. armor=91.11, dmg_bonus=1.0
91.1100 1.0000 984.5359, hp left is 984.5359
(-> same armor difference, larger difference in hp left)

Or did i make a mistake?
 
Level 10
Joined
Apr 18, 2009
Messages
601
If it's too complex for me right now, how would I make the unit perform the berserk ability through triggers specifically?

If I try to use Unit - Issue order, it doesn't give me the choice of my custom ability. I'm also guessing he has to have it in the first place.

Give the custom Berserk to your unit. The action "Order (Your unit) to Orc Troll Berserker - Berserk" will cause the unit to cast any custom ability based on Berserk.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Armor doesnt scale properly. Here is an example:
Code:
hp = 1000;
dmg = 100;
armor = ...;
dmg_bonus = ...;
dmg_reduction = (armor*0.06)/(1+armor*0.06);
hp = hp - dmg*dmg_bonus * (1-dmg_reduction);
disp([armor dmg_bonus hp]);

A unit with 1000 hp is attacked with 100 damage.

1. armor=10, dmg_bonus=1.5, hp left is 906.25
10.0000 1.5000 906.2500
2. armor=1.11, damage_bonus=1.0, hp left is 906.2441
1.1100 1.0000 906.2441
(-> so reducing armor by 8.89 results in similar hp left)

3. armor=100, dmg_bonus=1.5, hp left is 987.5714
100.0000 1.5000 978.5714
4. armor=91.11, dmg_bonus=1.0
91.1100 1.0000 984.5359, hp left is 984.5359
(-> same armor difference, larger difference in hp left)

Or did i make a mistake?

If you googled the formula, then it's wrong.
It was surprising to me too at first, but I figured it out when making a spreadsheet.

The defense multiplier is (by excel) - POWER(1.06;armor)*1/Hits taken*(1+Damage Reduction)

This is a bit bloated. The damage reduction part should be omitted, as it was only for my own map.
Hits taken is about evasion.
So the formula is much shorter. For armor you have POWER(1.06;Armor)
This gives the defense multiplier.
100 / Multiplier = Damage reduction
Multiplier * Health = Effective health
Multiplier * Health reg = Effective health reg

I have tested this with armor up to 50 and it works right.
 
Level 6
Joined
Nov 3, 2005
Messages
103
Lol, thanks guys for the help. I think I'll try to go with the Berserk method. The only problem is is that now when I try to give my hero the ability, it appears on the HUD. I've heard something about making it an item ability, I'll try to figure it out.
 
Status
Not open for further replies.
Top