WarLuvr3393
Hmmm...too many things to play (WoW, COD4, WC3)
- Reaction score
- 54
JASS:
function checkone takes nothing returns boolean
return IsUnitAlly(GetAttacker(), GetOwningPlayer(GetOrderTargetUnit()))
endfunction
function checktwo takes nothing returns boolean
return IsUnitType(GetOrderTargetUnit(), UNIT_TYPE_GROUND)
endfunction
function allycheck takes nothing returns boolean
if GetBooleanAnd(checkone(),checktwo()) then
return true
endif
return false
endfunction
function Trig_Prevent_Attack_Actions takes nothing returns nothing
call IssueImmediateOrder(GetAttacker(), "stop")
endfunction
//===========================================================================
function InitTrig_Prevent_Attack takes nothing returns nothing
local integer i
set gg_trg_Prevent_Attack = CreateTrigger( )
set i=0
loop
exitwhen i>13
call TriggerRegisterPlayerUnitEventSimple(gg_trg_Prevent_Attack, Player(i), EVENT_PLAYER_UNIT_ATTACKED)
set i=i+1
endloop
call TriggerAddCondition(gg_trg_Prevent_Attack, Condition(function allycheck))
call TriggerAddAction( gg_trg_Prevent_Attack, function Trig_Prevent_Attack_Actions )
endfunction
I've been trying to fix this script for about an hour now. I still couldn't do this. Please help.
EDIT: This is supposed to prevent players from attacking any units but they're allowed to attack buildings. This is for my Tauren Tag.