HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Ability Damage Help

06-20-2004, 03:27 PM#1
ZeRo_MD
i use this trigger to cause damage on a unit

Unit - Set life of Target to ((Percentage life of Target) - ((Real((Level of XXX for (Triggering unit)))) x 20.00))%

this trigger works, and after some uses, the target unit dies...
but i want the trigger to cause on lvl 1, current life of target -20%
on lvl 2, current life of target -40%, and lvl 3 current life of target -60%
06-20-2004, 03:35 PM#2
Shimrra
Try this trigger:

Code:
Melee Initialization
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to YourAbility
    Actions
        Unit - Set life of (Target unit of ability being cast) to ((0.20 x (Real((Hero level of (Casting unit))))) x (Life of (Target unit of ability being cast)))
06-20-2004, 07:57 PM#3
Rafael Br
This way will not give you bounty/ experience, i don't know if you want this, but maybe it can be helpfull.
06-20-2004, 11:29 PM#4
ZeRo_MD
yah, doesn't work, the trigger kill the unit, i dont want to kill... if the trigger kill the unit, the hero cant get the experience...
06-21-2004, 03:03 AM#5
CynicalYouth
I believe a unit is considered dead if its life becomes less then one, so if it gets to like .4 life it dies. You need to add an if statement to your trigger that reduces the units life to 1 if it would reduce it to less. So set your new life to a variable and then if the number in the variable is less then 1 set the units life to one otherwise set it to what the function gave you.
06-23-2004, 11:48 AM#6
ZeRo_MD
how i get the current life of a unit, to use in a trigger? not the total life... because my trigger get the total life...
06-23-2004, 03:16 PM#7
Anitarf
The life of a unit is a real value. It's under "unit - property of unit". Just do this:
Code:
Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) - ((Life of (Target unit of ability being cast)) x (0.20 x (Real((Level of XXX for (Casting unit)))))))

If you don't want to be able to kill a unit, do a check first to see if the new life will be less than 1, and if it is, then either do nothing or kill the unit with a dummy invisible unit that attacks it, depending on how you want your spell to function. This will happen rarely anyway, because the target unit would have to have less than 2.4 life to be killed by this spell.

And don't use "begins casting an ability", but "starts the effect of an ability"!
06-24-2004, 02:35 AM#8
ZeRo_MD
Events
Unit - A unit Begins casting an ability
Conditions
(Unit-type of (Triggering unit)) Equal to (==) UrbanSamurai
(Ability being cast) Equal to (==) ExtremeStrike
Actions
Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) - ((Life of (Target unit of ability being cast)) x (0.20 x (Real((Level of ExtremeStrike for (Casting unit)))))))

okay... i use this trigger... and now... if i target a unit with life 300, the life change to 280...
06-24-2004, 07:31 PM#9
Shimrra
You're using a passive spell. Use my actions, but look in the FAQ Top Nine and download the 'Bash Map' to see how Linkmaster detected these abilities. Then use his events and my actions to make your trigger.
06-24-2004, 09:22 PM#10
orcmasta
Make an if statement to set hero's xp.
06-25-2004, 12:00 AM#11
Vexorian
You can use a dummy caster to kill the unit if the damage would end in giving it 1 or less hp
06-25-2004, 08:09 AM#12
Anitarf
The unit is dead if it has 1 or less, or is it less than 1? Ok, it's probably unlikely that a unit will have exactly 1 HP, but still, is 1hp dead or alive?
06-25-2004, 12:36 PM#13
Vexorian
I am not sure