• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Reverse Backstab

Status
Not open for further replies.
Hell no, jass isn't necessary here.
I guess u mean a backstab trigger.
  • Backstab
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of CUSTOMSPELL for (Attacking unit)) Greater than 0
      • Or - Any (Conditions) are true
        • Conditions
          • (Angle from (Position of (Attacking unit)) to (Position of (Attacked unit))) Greater than or equal to ((Facing of (Attacked unit)) - 160.00)
          • (Angle from (Position of (Attacking unit)) to (Position of (Attacked unit))) Less than or equal to ((Facing of (Attacked unit)) - 200.00)
    • Actions
      • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing ((1.00 x (Real((Level of CUSTOMSPELL for (Attacking unit))))) x (Real((Agility of (Attacking unit) (Include bonuses))))) damage of attack type Normal and damage type Normal
Edit it to your choise.

This trigger is not 100% perfect working, since the attack detection is wrong, but that is normal.
 
You cannot use " Unit - A unit Is attacked" because you wont be able to get the damage (at the moment the unit attacks no damage is dealt )
I think the easiest way of creating this is adding a event with your hero to another trigger (may when learning the spell) " call TriggerRegisterUnitEvent( <trigger> , <unit>, EVENT_UNIT_DAMAGED )"
Then to get the Angle difference you could use this function (copy into mapscript):
JASS:
function AngleDifference takes real angle1, real angle2 returns real
 local real x
    set angle1=ModuloReal(angle1,360)
    set angle2=ModuloReal(angle2,360)
    if angle1>angle2 then
        set x=angle1
        set angle1=angle2
        set angle2=x
    endif
    set x=angle2-360
    if angle2-angle1 > angle1-x then
        set angle2=x
    endif
 return RAbsBJ(angle1-angle2)
endfunction
Then in the Trigger with the added event ( No event in the editor!) You could get the angle difference and if it has the difference u want do this :
JASS:
    call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) + GetEventDamage() ) )
I hope this helps
 
Status
Not open for further replies.
Back
Top