ok Emergancy did not help you much so i will...
AntiAttack
Events
Unit - A unit Is attacked
Conditions
((Triggering player) Current lumber) Less than or equal to 0
(Unit-type of (Triggering unit)) Equal to Rpger (Ranger)
(Item-type of (Item being manipulated)) Equal to Bow
Actions
Unit - Order (Attacking unit) to Stop
Player - Make (Triggering player) treat Player 12 (Brown) as an Ally
__________________________________________
And heres a simple jass thing for the attacking
__________________________________________
function Trig_Attacking_Conditions takes nothing returns boolean
if ( not ( GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER) >= 1 ) ) then
return false
endif
if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'E005' ) ) then
return false
endif
return true
endfunction
function Trig_Attacking_Actions takes nothing returns nothing
call SetPlayerStateBJ( GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER, -1 )
endfunction
//===========================================================================
function InitTrig_Attacking takes nothing returns nothing
set gg_trg_Attacking = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Attacking, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Attacking, Condition( function Trig_Attacking_Conditions ) )
call TriggerAddAction( gg_trg_Attacking, function Trig_Attacking_Actions )
endfunction
nuthin to it
[/img]