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

Percentage Skill

Status
Not open for further replies.
Level 3
Joined
Aug 11, 2004
Messages
45
i wish to make a spell that would kill the unit if the unit has less than x% of life....giving all ''credits'' (gold and kill) to the caster got it? where can i find the condition like '' if unit has equal or less than x%.." ? btw i tried with life quantity but the spell didnt work the unit wasnt dieng...got it?
 
Level 7
Joined
Nov 12, 2005
Messages
299
> giving all ''credits'' (gold and kill) to the caster got it?
That might be messed up...the most accurate event for this would be takes damage which only works on specific units.
Apart from that the condition is easy
Real Comparison -> Unit - Percentage Life
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,207
You use the caster as the damage source obviously. . .
It is recomended that if you want to kill a unit with "credits" you set its hp to 1 and then deal 999999999 damage to it since otherwise if it has MEGA armor (100% reduction) no amount of damage will deal little more than 1 damage but since it would only have 1 hp it would trigger a death with "credits".
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
Code:
Melee Initialization
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Axe-Wannabe Ultimate
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
               [b][i]Real Comparison, Unit Percentage Life[/i][/b]: (Percentage life of (Target unit of ability being cast)) Less than 10.00
            Then - Actions
                [b][i]Unit - Damage Target[/i][/b]: Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing 99999.00 damage of attack type Spells and damage type Normal
                [B][I]Player - Add Property[/I][/B]: Player - [COLOR="Red"]Add (((Hero level of (Target unit of ability being cast)) x 25) + 100)[/COLOR] to (Owner of (Casting unit)) Current gold
            Else - Actions
                Do nothing

NOTE: The code marked in Red are Arithmetics.

This trigger will kill a target if it's under 10% of it's HP, and give you 100 gold + 25 gold per each level the enemy hero has. (25x1 = 25, 25x2 = 50, etc)
I've written the Comparisons and names of the functions so it becomes easier for you to find them.

EDIT: Oh and by the way, I don't know if this leaks. If you see the map gets laggy after an amount of time, then it leaks. I can write a new code using locals, so say if you need help.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,207
Rui I do not believe that is what he is after.
He just wants it to kill the unit so that it counts towards the score at the end of them map which Damage Target does automaticly. . .

SFlip are you having trouble finding the action that returns a caster? LOL!
Learn BASIC triggers since that is so simple and YES I can post a 100+ line jass spell that uses it, that I made, but it is probably above your mental capabilites to understand jass. . .

For you Gui users. . .
With the event a unit starts the effect of a spell or something you can use the action to GET the caster that triggered the event!
I do not know why your having trouble finding it but it is obvious to 99% of people and is even called what it does. . .
 
Also if you want a guaranteed kill of the unit and you want it to add gold but not work on heros do this:
Event - Unit casts ability
Conditions - Ability Being cast equal to Kill the almost dead guy.
Real Comparison - Unit Percentage Life: (Percentage life of (Target unit of ability being cast)) Less than 10.00
Events:
Create One Dummy unit for [Owner of casting unit]
Teach Transmute to tirggering unit.
Make [last created unit] Transmute Targettted Unit.


Thatll kill the bitch and give you gold. You can also mess around with the Transmute ability so it can target heros and creeps over level 5

Hope this helps

:infl_thumbs_up:
 
Status
Not open for further replies.
Top