function Trig_Give_Defence_to_creeps_Conditions takes nothing returns boolean
if ( not ( udg_UDexUnits[udg_UDex] != udg_Hero[GetConvertedPlayerId(GetOwningPlayer(udg_UDexUnits[udg_UDex]))] ) ) then
return false
endif
return true
endfunction
function Trig_Give_Defence_to_creeps_Actions takes nothing returns nothing
local unit u = udg_UDexUnits[udg_UDex]
local location l = GetUnitLoc(u)
set udg_Creep_X[udg_UDex] = GetLocationX(l)
set udg_Creep_Y[udg_UDex] = GetLocationY(l)
if ( IsUnitType(u, UNIT_TYPE_HERO) == true ) then
set udg_Creep_Pdef[udg_UDex] = ( ( GetHeroLevel(u) * GetHeroLevel(u) ) * 4 )
set udg_Creep_Mdef[udg_UDex] = ( ( GetHeroLevel(u) * GetHeroLevel(u) ) * 4 )
else
set udg_Creep_Pdef[udg_UDex] = ( ( GetUnitLevel(u) * GetUnitLevel(u) ) * (10 + GetRandomInt(1, 3) * 5) / 10 )
set udg_Creep_Mdef[udg_UDex] = ( ( GetUnitLevel(u) * GetUnitLevel(u) ) * (10 + GetRandomInt(1, 3) * 5) / 10 )
endif
set u = null
set l = null
endfunction
//===========================================================================
function InitTrig_Indexer_event takes nothing returns nothing
set gg_trg_Indexer_event = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Indexer_event, "udg_UnitIndexEvent", EQUAL, 1.00 )
call TriggerAddCondition( gg_trg_Indexer_event, Condition( function Trig_Give_Defence_to_creeps_Conditions ) )
call TriggerAddAction( gg_trg_Indexer_event, function Trig_Give_Defence_to_creeps_Actions )
endfunction