I try to create a "wind walk" spell that stun the target when a caster attack it from behind.
My problem is that I want to hide a floating text that come up with backstab damage (I want to use only my own custom text).
So I try to change a target allowed to "none", but the result is trigger don't even run : ((
**Note : 'B00K' is a wind walk buff.
My problem is that I want to hide a floating text that come up with backstab damage (I want to use only my own custom text).
So I try to change a target allowed to "none", but the result is trigger don't even run : ((
JASS:
library BackstabCheck
function IsUnitBehindUnit takes unit u2, unit u1 returns boolean
local real face = GetUnitFacing(u1)
local real rangle = bj_RADTODEG*Atan2(GetUnitY(u2)-GetUnitY(u1),GetUnitX(u2)-GetUnitX(u1))
return not (RAbsBJ(face-rangle) < 45 or RAbsBJ(face-rangle-360) < 90)
endfunction
endlibrary
JASS:
function Shadow_Walk_Cond takes nothing returns boolean
return UnitHasBuffBJ(GetAttacker(), 039;B00K039;) and IsUnitEnemy(GetAttacker(), GetOwningPlayer(GetTriggerUnit())) and IsUnitType(GetTriggerUnit(), UNIT_TYPE_MECHANICAL) == false
endfunction
function Shadow_Walk_Act takes nothing returns nothing
local unit a = GetAttacker()
local unit v = GetTriggerUnit()
local unit n
local real damage = GetUnitAbilityLevel(a, 039;A015039;)*50
call DisableTrigger(GetTriggeringTrigger())
call TriggerSleepAction(.05)
if IsUnitBehindUnit(a,v) and IsUnitAliveBJ(v) then
set n = CreateUnitAtLoc( GetOwningPlayer(a), 039;n00A039;, GetUnitLoc(v), bj_UNIT_FACING )
call UnitAddAbility( n, 039;ACtb039; )
call SetUnitAbilityLevel( n, 039;ACtb039;, 2 )
call IssueTargetOrder( n, "creepthunderbolt", v )
call UnitApplyTimedLife( n, 039;BTLF039;, 1 )
call UnitDamageTargetBJ( a, v, damage, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL )
call CreateTextTagLocBJ( I2S(R2I(damage)) + "!", GetUnitLoc(v), 60, 10, 100, 10, 10, 0 )
call FloatingText( GetLastCreatedTextTag(), 2, 1.5, 96, 90 )
call UnitRemoveBuffBJ(039;B00K039;, a)
endif
call EnableTrigger(GetTriggeringTrigger())
set n = null
endfunction
//===========================================================================
function InitTrig_Shadow_Walk takes nothing returns nothing
set gg_trg_Shadow_Walk = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Shadow_Walk, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Shadow_Walk, Condition( function Shadow_Walk_Cond ) )
call TriggerAddAction( gg_trg_Shadow_Walk, function Shadow_Walk_Act )
endfunction
**Note : 'B00K' is a wind walk buff.