• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

How do you make a spell based on unit's damage

Status
Not open for further replies.
Level 2
Joined
Dec 26, 2004
Messages
7
I wish to make a spell for a hero, which does damage based on his attack damage. ie.
If hero has attack damage 50, warstomp does 50. If he get +10 to attack damage, warstomp then does 60 (50 + 10)

I would like to be able to do this without triggers, but failing that, how can I do it with trigs? I can't seem to find any function that lets me retrieve what a unit's current damage is.
 
Level 2
Joined
Dec 30, 2006
Messages
11
theres a complicated way to trigger that spell. you make the damage based on:
heroes primary attribute + average BASE damage + check benefits form items and buffs

heres an example:
(50 Strength + 5 (2 to 8) average base damage) * 1.1 (inner fire gives 10% bonus damage) + 15 (claws +15) = 75 damage

i know its complicated, but theres no other way as far as i know.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Simply make the hero attack a dummy unit which you know has 0 damage reduction (takes full damage) and then using the "unit is damaged" trigger event, detect the damage and then use it to run your spell.

Only flaw is that it requires handle vars and has a casting delay time (can be interupted or abused) but if you create and illusion and get that to attack the dummy far away from where the hero is, then it should be ok.
 
Level 2
Joined
Dec 26, 2004
Messages
7
ok, got that working, using the method woodfolk described. Having simple control over it in the scripting seemed the simplest way instead of doing dummy units every time my unit uses its ability. My next problem is this: I have a wind-walk ability on a different unit. Wind-walk traditionally does a flat damage bonus for the first attack while stealthed. I wish to have an ability that does a damage multiplier (ie. x2 of normal damage). I would use the same method for it as the previous ability, however i am unsure as to how i would check for a unit making an attack from wind-walk. (If you simply go by the effect ending, then how do you know it was ended because the unit made a physical attack, as opposed to being broken from spotters or abilities).
 
Level 11
Joined
Jul 12, 2005
Messages
764
The attack can be detected, but the damage... Only with JASS.
Anyway the attack can be detected by setting a boolean variable to true when the unit casts WW, and create a trigger with the 'Unit is attacked' event and with the condition 'BooleanVar is equal to true', 'Attacking unit has <Ability>', and other checks can be included...
  • Event:
  • Unit is attacked
  • Conditions:
  • UnitIsInWW is equal to true //This is the boolean variable
  • (Level of Wind Walk for Attacking unit) is greater than 0
  • Actions:
  • Set UnitIsInWW = false
  • //WW attack is detected now...
 
Status
Not open for further replies.
Top