MasterRofl
New Member
- Reaction score
- 8
I have this:but my trigger isn't working correctly, so I'm assuming that's wrong.
But just in case, here's the entire trigger:
JASS:
private function Conds takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) == 039;u002039;
return GetUnitTypeId(GetAttacker()) == 039;u003039;
return GetUnitTypeId(GetAttacker()) == 039;u000039;
endfunction
But just in case, here's the entire trigger:
JASS:
library Entangle initializer Init
private struct Entangle
unit a
unit d
unit t
real x
real y
method onDestroy takes nothing returns nothing
set.a = null
set.d = null
set.t = null
endmethod
endstruct
private function Actions takes nothing returns nothing
local Entangle e = Entangle.create()
set e.a = GetAttacker()
set e.t = GetTriggerUnit()
set e.x = GetUnitX(e.t)
set e.y = GetUnitY(e.t)
if GetRandomInt(1, 100) < 81 then
set e.d = CreateUnit( GetOwningPlayer(e.a), 039;n000039;, e.x, e.y, 0. )
call UnitAddAbility(e.d, 039;A02R039;)
call SetUnitAbilityLevel(e.d, 039;A02R039;, 1)
call IssueTargetOrder(e.d, "entanglingroots", e.t)
//call RemoveUnit(e.d)
call UnitApplyTimedLife(e.d, 039;BTLF039;, 1.)
endif
call e.destroy()
endfunction
private function Conds takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) == 039;u002039;
return GetUnitTypeId(GetAttacker()) == 039;u003039;
return GetUnitTypeId(GetAttacker()) == 039;u000039;
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function Actions)
set t = null
endfunction
endlibrary