• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Passive Help> attacking the target from behind causes double damage

Status
Not open for further replies.
To make things easier, use a Damage Engine like Bribe's, then use this function:

JASS:
function IsUnitInBackstabAngle takes unit a, unit t, real max returns boolean
    local real t_facing = GetUnitFacing(t)
    local real a_angle = Atan2(GetUnitY(t) - GetUnitY(a), GetUnitX(t) - GetUnitX(a))*bj_RADTODEG
    if t_facing >= 180 then
        set t_facing = t_facing - 360
    endif
    return RAbsBJ(a_angle - t_facing) <= max
endfunction

You can use 67.5 for real max and check that the level of the passive is greater than zero.
 
To make things easier, use a Damage Engine like Bribe's, then use this function:

JASS:
function IsUnitInBackstabAngle takes unit a, unit t, real max returns boolean
    local real t_facing = GetUnitFacing(t)
    local real a_angle = Atan2(GetUnitY(t) - GetUnitY(a), GetUnitX(t) - GetUnitX(a))*bj_RADTODEG
    if t_facing >= 180 then
        set t_facing = t_facing - 360
    endif
    return RAbsBJ(a_angle - t_facing) <= max
endfunction

You can use 67.5 for real max and check that the level of the passive is greater than zero.

GUi PLZ D:
 
To make things easier, use a Damage Engine like Bribe's, then use this function:

JASS:
function IsUnitInBackstabAngle takes unit a, unit t, real max returns boolean
    local real t_facing = GetUnitFacing(t)
    local real a_angle = Atan2(GetUnitY(t) - GetUnitY(a), GetUnitX(t) - GetUnitX(a))*bj_RADTODEG
    if t_facing >= 180 then
        set t_facing = t_facing - 360
    endif
    return RAbsBJ(a_angle - t_facing) <= max
endfunction

You can use 67.5 for real max and check that the level of the passive is greater than zero.



or less give me an example of how to check if the hero has the ability LVL 1+
 
[Solved] - Angles (how to detect a backstab attack)? post # 7 will be the GUI example.

Just replace the event with DamageModifier equal to 1 if you have the damage engine by Bribe.

or use the above function like shown.

upload_2019-3-17_20-37-40.png
 
yeah, eh, you need to put a endif under that DamageEventAmount.

Also it needs to be DamageEventAmount = DamageEventAmount x 2

setting to 2 will only give you 2 damage.
 
endif simply ends the if statement you began with the line that starts with if, which is the JASS version of this
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • Then - Actions
    • Else - Actions

so it will be like this

1. If YOURCONDITION then

----> custom script and starts the if statement.

2. DO ACTIONS

----> this can be in GUI or custom script.

3. endif

----> this is also in custom script and ends 1.

YOURCONDITION is a function that returns a boolean, or a boolean expression, such as

JASS:
f >= f
f == f
f < f

Hope this helps clear your confusion.

The bonus of doing If/then/else in JASS is that it can be more efficient.
 
Last edited:
Status
Not open for further replies.
Back
Top