Warcraft III resources & community, 2003–2006 · archived

enchancing bash/ critical skills

18 posts
#16
post your problem. at me it worked perfectly...
#17
o.. i placed 1 second instead of 0.10 seconds..
and the duration of the bash.. since i wanted to hide the stun thing..
so i made it .? somthing..
so i think when it tried to checked.. it didnt find the buff..
haha..
well.. thxn very much.. =p
#18
That's kinda sloppy. Checking for unit being attacked is the way of the past. I've found a way to detect on when a unit takes damage, factoring in misses and anims and such. Actually it's quite simple to do i'll post the actions.

Now in GUI it takes at least 2 triggers but i'm sure jass can do this with 2 functions within the same tirggerds (i dunno exactly how you guys work it but this is what i've figured out)

i'll explain it ass i go through and this one works with global vairables so you can easily customize.

Intiate attack
    Events
        Unit - A unit Is attacked
    Conditions
        (Attacking unit) Equal to [Attacking unit VAR]
        ((Attacked unit) belongs to an enemy of (Owner of [Attacking unit VAR]))Equal to True
    Actions
        Set ADattackedUnit = (Attacked unit)
        Trigger - Add to Unit takes Damage <gen> the event (Unit - ADattackedUnit Takes damage)
        Trigger - Turn on Unit takes Damage <gen>

//This trigger just detects who is attacked and if they are firendly or enemies.  I took out the % chance but that's easy to put in, it's just another condition that checks for a random numbers being less or equal than the value for % that you want).  Make sure that the unit is stored as a global otherwise this will not work

Unit takes Damage
    Events
    Conditions
        (Damage source) Equal to [Attacking unit VAR]
    Actions
        Unit - Cause PlayerDamager[(Player number of (Owner of [Attacking unit VAR]))] to damage (ADattackedUnit), dealing [crit value] damage of attack type Hero and damage type Normal
        Floating Text - Create floating text that reads (Smashed + !) at (Position of (Picked unit)) with Z offset 100.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 15.00% transparency
        Floating Text - Set the velocity of Last created floating text to 64.00 towards 90.00 degrees
        Floating Text - Change Last rcreated floatign text: Disable permanence
        Floating Text - Change the lifespan of Last created floating text to 1.30 seconds
        Floating Text - Change the fading age of Last created floating text to 0.70 seconds
        Trigger - Turn off (This trigger)

//This checks that the attacked unit took damage first before applying the crit damage (sometimes when ur gonna crit you do miss).  Don't worry about turning this on and off as if refreshes each time you attack so it never screws up. 


Extra stuff you need to know

One last thing that you need is to have a damage source other than the attacking unit as the way it's set up, he's currently dealing the damage so it will crash if he's also told to damage them. What i did was made a unit for each hero (it's written as PlayerDamager) that would do the damage. This way yuor heroe is not directly dealing the damage, so it won't crash. I also added a floating text in there too. The only issued would be creating a point variable instead and removing it after the floating text was created to remove any leaks you would have. If you want to get a precise ctril based on a percentage increase, all you have to do is first make it display the integer of (damage taken * (1.00 = (your bonus percentage) with a +! for the true look. The same goes for delaing the damage but instead you get it to deal (damage taken * (your percentage bonus)) that should be it. BTW this works perfectly and will always incorporate missing also so you don't have to worry about unfair hits based on poor triggering. One last last thing, firing the anims is based on the unit attacking, just play the anim then if the % chance is reached and reset their anim if they deal the damage) Hope this helps out, please post any questiosn you have here.