• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

RoC City Capture Trigger?

Status
Not open for further replies.
function Trig_Trigger_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetAttackedUnitBJ(), UNIT_TYPE_TOWNHALL) == true ) ) then
return false
endif
if ( not ( R2I(GetUnitStateSwap(UNIT_STATE_LIFE, GetAttackedUnitBJ())) <= 500 ) ) then
return false
endif
return true
endfunction

function Trig_Trigger_Actions takes nothing returns nothing
call SetUnitOwner( GetAttackedUnitBJ(), GetOwningPlayer(GetAttacker()), true )
call SetUnitLifePercentBJ( GetAttackedUnitBJ(), 100 )
endfunction

//===========================================================================
function InitTrig_Trigger takes nothing returns nothing
set gg_trg_Trigger = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Trigger, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Trigger, Condition( function Trig_Trigger_Conditions ) )
call TriggerAddAction( gg_trg_Trigger, function Trig_Trigger_Actions )
endfunction

Just copy and paste that into a open trigger or something. This is the Gui ver turned into jass and is therefore compatable with roc. im not sure if this is leakless or not.
 
function Trig_Trigger_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetAttackedUnitBJ(), UNIT_TYPE_TOWNHALL) == true ) ) then
return false
endif
if ( not ( R2I(GetUnitStateSwap(UNIT_STATE_LIFE, GetAttackedUnitBJ())) <= 500 ) ) then
return false
endif
return true
endfunction

function Trig_Trigger_Actions takes nothing returns nothing
call SetUnitOwner( GetAttackedUnitBJ(), GetOwningPlayer(GetAttacker()), true )
call SetUnitLifePercentBJ( GetAttackedUnitBJ(), 100 )
endfunction

//===========================================================================
function InitTrig_Trigger takes nothing returns nothing
set gg_trg_Trigger = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Trigger, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Trigger, Condition( function Trig_Trigger_Conditions ) )
call TriggerAddAction( gg_trg_Trigger, function Trig_Trigger_Actions )
endfunction

Just copy and paste that into a open trigger or something. This is the Gui ver turned into jass and is therefore compatable with roc. im not sure if this is leakless or not.

THANK YOU!!! Dare I say I love you?
+rep
 
Status
Not open for further replies.
Back
Top