- Joined
- Mar 19, 2010
- Messages
- 870
hey hivers,
just a question. I wrote some lines of code to prevent friendly attack - It works but did I forget something or taken into account?
Here's the code:
just a question. I wrote some lines of code to prevent friendly attack - It works but did I forget something or taken into account?
Here's the code:
JASS:
scope FriendlyAttackSystem initializer init
private function Actions takes nothing returns nothing
call IssueImmediateOrder(GetAttacker(), "stop")
endfunction
private function Conditions takes nothing returns boolean
return IsUnitAlly(GetAttacker(), GetOwningPlayer(GetTriggerUnit()))
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(t, Condition( function Conditions ))
call TriggerAddAction(t, function Actions )
set t = null
endfunction
endscope