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

Sort of like a critical strike ability...

Status
Not open for further replies.
Level 4
Joined
Jun 5, 2007
Messages
65
I want it to be like critical strike, but instead of a percentage chance to deal x times normal damage, i want it to be a percentage chance to reduce the target's hp to 50% of what it is atm. Any ideas? Tyvm.
-Z
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
in the Ability Editor, Create a new passive ability (based on critical strike for example) and make sure it doesn't do anything, by setting critical factor to 0 etc.
Next, make a buff called "Critical Strike" and add it to the ability

Go to trigger editor and make a new trigger

[Trigger=Critical Strike Ability]Events
Unit - A unit Is attacked
Conditions
((Attacking unit) has buff Critical Strike) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 100) Less than or equal to 10
Then - Actions
Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) / 2.00)
Else - Actions
Do nothing
[/trigger]

Note that the number "10" in the if - conditions is the % chance of the critical strike to occur. Change this to anything you want below 100
 
Level 4
Joined
Jun 5, 2007
Messages
65
i am having a bit of a problem though, see the 'unit is attacked' trigger event is fired when the unit being attacked picks up a unit in range. therefore, sometimes the trigger fires before or after the arrow (this is for a ranged hero btw) hits its target. also, not necessary but is there a way to keep the damage from the critical strike ability and the heroes normal damage from stacking, or to have it so when the trigger fires it cancels out the heroes damage alltogether? thx in advance.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Use the following action instead of the
Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) / 2.00)
action.

Unit - Set life of (Triggering Unit) to ((Convert real to integer: Damage Taken) + (Life of (Triggering unit) / 2)).

There are 2 notes however: the "Damage Taken" real value can only be used when responding to a "Unit takes damage" event. Strangely enough, I can't find this event right now... Tell me if you did. Also note that if you're using the new event, you'll have to change "attacked unit" into "triggering unit". Besides, with the new event, it's possible that this trigger will also run when the attacking hero is casting a damage spell..

Second note: I don't exactly know what will happen if the damage done by the hero is larger than the actual HP of the attacked unit. However, I believe the attacked unit would still die.

I'm going to sleep now so I'm too tired to open world edit
 
Level 4
Joined
Jun 5, 2007
Messages
65
is it possible to make it into two seperate triggers so that it works better?
1st one fires when a unit takes damage or is attacked or targeted or something > which leads to the second one being activated?
 
Status
Not open for further replies.
Top