function CreepMovement_Conditions takes nothing returns boolean
return GetOwningPlayer(GetTriggerUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE)
endfunction
function CreepMovement_Actions takes nothing returns nothing
// Locals
local region Reg = GetTriggeringRegion() // Triggering Region
local integer RegID = GetHandleId(Reg) // Region Handle ID
local integer Roads = LoadInteger(udg_Hash, RegID, 0) // Available Roads (For Random Int)
local unit Creep = GetTriggerUnit() // Triggering Unit
local integer CreepID = GetHandleId(Creep) // Unit Handle ID
local integer Steps = (LoadInteger(udg_Hash, CreepID, 1) + 1) // Number of Creep Steps + 1
local integer i = GetRandomInt(1,Roads) // Random Choices
local integer CBoolean = LoadInteger(udg_Hash, CreepID, 2) // Unit is in Region C1, C2, C3 or C4.
local real rx
local real ry
// Functions
call SaveInteger(udg_Hash, CreepID, 1, Steps) // Steps Update
if Steps > 11 and CBoolean == 1 then
set i = GetRandomInt(3,5)
endif
set rx = LoadReal(udg_Hash, RegID, i)
set ry = LoadReal(udg_Hash, RegID, (i+5))
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, "----------------")
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, " ")
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, " ")
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, ("Region ID: " + I2S(RegID)))
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, ("Roads: " + I2S(Roads)))
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, ("Unit Name: " + GetUnitName(Creep)))
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, ("Unit ID: " + I2S(CreepID)))
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, ("Unit Steps: " + I2S(Steps)))
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, ("Random Int: " + I2S(i)))
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, ("CBoolean: " + I2S(CBoolean)))
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, ("Real X: " + R2S(rx)))
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, ("Real Y: " + R2S(ry)))
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, " ")
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, " ")
call DisplayTimedTextToForce(GetPlayersAll(), 100.00, "----------------")
call IssuePointOrder(Creep, "attack", rx, ry) // Unit attack-move
set Creep = null
set Reg = null
endfunction
//===========================================================================
function InitTrig_CreepMovement takes nothing returns nothing
set gg_trg_CreepMovement = CreateTrigger( )
set udg_Hash = InitHashtable()
local integer i
// X
local real xM1 = GetRectCenterX(gg_rct_M1)
local real xM2 = GetRectCenterX(gg_rct_M2)
local real xM3 = GetRectCenterX(gg_rct_M3)
local real xM4 = GetRectCenterX(gg_rct_M4)
local real xM5 = GetRectCenterX(gg_rct_M5)
local real xM6 = GetRectCenterX(gg_rct_M6)
local real xM7 = GetRectCenterX(gg_rct_M7)
local real xM8 = GetRectCenterX(gg_rct_M8)
local real xM9 = GetRectCenterX(gg_rct_M9)
local real xM10 = GetRectCenterX(gg_rct_M10)
local real xM11 = GetRectCenterX(gg_rct_M11)
local real xM12 = GetRectCenterX(gg_rct_M12)
local real xC1 = GetRectCenterX(gg_rct_C1)
local real xC2 = GetRectCenterX(gg_rct_C2)
local real xC3 = GetRectCenterX(gg_rct_C3)
local real xC4 = GetRectCenterX(gg_rct_C4)
local real xGoal = GetRectCenterX(gg_rct_Goal)
// Y
local real yM1 = GetRectCenterY(gg_rct_M1)
local real yM2 = GetRectCenterY(gg_rct_M2)
local real yM3 = GetRectCenterY(gg_rct_M3)
local real yM4 = GetRectCenterY(gg_rct_M4)
local real yM5 = GetRectCenterY(gg_rct_M5)
local real yM6 = GetRectCenterY(gg_rct_M6)
local real yM7 = GetRectCenterY(gg_rct_M7)
local real yM8 = GetRectCenterY(gg_rct_M8)
local real yM9 = GetRectCenterY(gg_rct_M9)
local real yM10 = GetRectCenterY(gg_rct_M10)
local real yM11 = GetRectCenterY(gg_rct_M11)
local real yM12 = GetRectCenterY(gg_rct_M12)
local real yC1 = GetRectCenterY(gg_rct_C1)
local real yC2 = GetRectCenterY(gg_rct_C2)
local real yC3 = GetRectCenterY(gg_rct_C3)
local real yC4 = GetRectCenterY(gg_rct_C4)
local real yGoal = GetRectCenterY(gg_rct_Goal)
local region RegR1 = CreateRegion()
call RegionAddRect(RegR1, gg_rct_R1)
set i = GetHandleId(RegR1)
call SaveInteger(udg_Hash, i, 0, 1)
call SaveReal(udg_Hash, i, 1, xM1)
call SaveReal(udg_Hash, i, 6, yM1)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegR1, null)
local region RegR2 = CreateRegion()
call RegionAddRect(RegR2, gg_rct_R2)
set i = GetHandleId(RegR2)
call SaveInteger(udg_Hash, i, 0, 1)
call SaveReal(udg_Hash, i, 1, xM1)
call SaveReal(udg_Hash, i, 6, yM1)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegR2, null)
local region RegR3 = CreateRegion()
call RegionAddRect(RegR3, gg_rct_R3)
set i = GetHandleId(RegR3)
call SaveInteger(udg_Hash, i, 0, 1)
call SaveReal(udg_Hash, i, 1, xM4)
call SaveReal(udg_Hash, i, 6, yM4)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegR3, null)
local region RegR4 = CreateRegion()
call RegionAddRect(RegR4, gg_rct_R4)
set i = GetHandleId(RegR4)
call SaveInteger(udg_Hash, i, 0, 1)
call SaveReal(udg_Hash, i, 1, xM4)
call SaveReal(udg_Hash, i, 6, yM4)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegR4, null)
local region RegR5 = CreateRegion()
call RegionAddRect(RegR5, gg_rct_R5)
set i = GetHandleId(RegR5)
call SaveInteger(udg_Hash, i, 0, 1)
call SaveReal(udg_Hash, i, 1, xM7)
call SaveReal(udg_Hash, i, 6, yM7)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegR5, null)
local region RegR6 = CreateRegion()
call RegionAddRect(RegR6, gg_rct_R6)
set i = GetHandleId(RegR6)
call SaveInteger(udg_Hash, i, 0, 1)
call SaveReal(udg_Hash, i, 1, xM7)
call SaveReal(udg_Hash, i, 6, yM7)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegR6, null)
local region RegR7 = CreateRegion()
call RegionAddRect(RegR7, gg_rct_R7)
set i = GetHandleId(RegR7)
call SaveInteger(udg_Hash, i, 0, 1)
call SaveReal(udg_Hash, i, 1, xM10)
call SaveReal(udg_Hash, i, 6, yM10)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegR7, null)
local region RegR8 = CreateRegion()
call RegionAddRect(RegR8, gg_rct_R8)
set i = GetHandleId(RegR8)
call SaveInteger(udg_Hash, i, 0, 1)
call SaveReal(udg_Hash, i, 1, xM10)
call SaveReal(udg_Hash, i, 6, yM10)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegR8, null)
local region RegM1 = CreateRegion()
call RegionAddRect(RegM1, gg_rct_M1)
set i = GetHandleId(RegM1)
call SaveInteger(udg_Hash, i, 0, 2)
call SaveReal(udg_Hash, i, 1, xM2)
call SaveReal(udg_Hash, i, 2, xM12)
call SaveReal(udg_Hash, i, 6, yM2)
call SaveReal(udg_Hash, i, 7, yM12)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegM1, null)
local region RegM2 = CreateRegion()
call RegionAddRect(RegM2, gg_rct_M2)
set i = GetHandleId(RegM2)
call SaveInteger(udg_Hash, i, 0, 3)
call SaveReal(udg_Hash, i, 1, xM1)
call SaveReal(udg_Hash, i, 2, xM3)
call SaveReal(udg_Hash, i, 3, xC1)
call SaveReal(udg_Hash, i, 6, yM1)
call SaveReal(udg_Hash, i, 7, yM3)
call SaveReal(udg_Hash, i, 8, yC1)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegM2, null)
local region RegM3 = CreateRegion()
call RegionAddRect(RegM3, gg_rct_M3)
set i = GetHandleId(RegM3)
call SaveInteger(udg_Hash, i, 0, 3)
call SaveReal(udg_Hash, i, 1, xM2)
call SaveReal(udg_Hash, i, 2, xM4)
call SaveReal(udg_Hash, i, 3, xC2)
call SaveReal(udg_Hash, i, 6, yM2)
call SaveReal(udg_Hash, i, 7, yM4)
call SaveReal(udg_Hash, i, 8, yC2)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegM3, null)
local region RegM4 = CreateRegion()
call RegionAddRect(RegM4, gg_rct_M4)
set i = GetHandleId(RegM4)
call SaveInteger(udg_Hash, i, 0, 2)
call SaveReal(udg_Hash, i, 1, xM3)
call SaveReal(udg_Hash, i, 2, xM5)
call SaveReal(udg_Hash, i, 6, yM3)
call SaveReal(udg_Hash, i, 7, yM5)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegM4, null)
local region RegM5 = CreateRegion()
call RegionAddRect(RegM5, gg_rct_M5)
set i = GetHandleId(RegM5)
call SaveInteger(udg_Hash, i, 0, 3)
call SaveReal(udg_Hash, i, 1, xM4)
call SaveReal(udg_Hash, i, 2, xC2)
call SaveReal(udg_Hash, i, 3, xM6)
call SaveReal(udg_Hash, i, 6, yM4)
call SaveReal(udg_Hash, i, 7, yC2)
call SaveReal(udg_Hash, i, 8, yM4)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegM5, null)
local region RegM6 = CreateRegion()
call RegionAddRect(RegM6, gg_rct_M6)
set i = GetHandleId(RegM6)
call SaveInteger(udg_Hash, i, 0, 3)
call SaveReal(udg_Hash, i, 1, xM5)
call SaveReal(udg_Hash, i, 2, xC3)
call SaveReal(udg_Hash, i, 3, xM7)
call SaveReal(udg_Hash, i, 6, yM5)
call SaveReal(udg_Hash, i, 7, yC3)
call SaveReal(udg_Hash, i, 8, yM7)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegM6, null)
local region RegM7 = CreateRegion()
call RegionAddRect(RegM7, gg_rct_M7)
set i = GetHandleId(RegM7)
call SaveInteger(udg_Hash, i, 0, 2)
call SaveReal(udg_Hash, i, 1, xM6)
call SaveReal(udg_Hash, i, 2, xM8)
call SaveReal(udg_Hash, i, 6, yM6)
call SaveReal(udg_Hash, i, 7, yM8)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegM7, null)
local region RegM8 = CreateRegion()
call RegionAddRect(RegM8, gg_rct_M8)
set i = GetHandleId(RegM8)
call SaveInteger(udg_Hash, i, 0, 3)
call SaveReal(udg_Hash, i, 1, xM7)
call SaveReal(udg_Hash, i, 2, xC3)
call SaveReal(udg_Hash, i, 3, xM9)
call SaveReal(udg_Hash, i, 6, yM7)
call SaveReal(udg_Hash, i, 7, yC3)
call SaveReal(udg_Hash, i, 8, yM9)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegM8, null)
local region RegM9 = CreateRegion()
call RegionAddRect(RegM9, gg_rct_M9)
set i = GetHandleId(RegM9)
call SaveInteger(udg_Hash, i, 0, 3)
call SaveReal(udg_Hash, i, 1, xM10)
call SaveReal(udg_Hash, i, 2, xC4)
call SaveReal(udg_Hash, i, 3, xM8)
call SaveReal(udg_Hash, i, 6, yM10)
call SaveReal(udg_Hash, i, 7, yC4)
call SaveReal(udg_Hash, i, 8, yM8)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegM9, null)
local region RegM10 = CreateRegion()
call RegionAddRect(RegM10, gg_rct_M10)
set i = GetHandleId(RegM10)
call SaveInteger(udg_Hash, i, 0, 2)
call SaveReal(udg_Hash, i, 1, xM9)
call SaveReal(udg_Hash, i, 2, xM11)
call SaveReal(udg_Hash, i, 6, yM9)
call SaveReal(udg_Hash, i, 7, yM11)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegM10, null)
local region RegM11 = CreateRegion()
call RegionAddRect(RegM11, gg_rct_M11)
set i = GetHandleId(RegM11)
call SaveInteger(udg_Hash, i, 0, 3)
call SaveReal(udg_Hash, i, 1, xM10)
call SaveReal(udg_Hash, i, 2, xM12)
call SaveReal(udg_Hash, i, 3, xC4)
call SaveReal(udg_Hash, i, 6, yM10)
call SaveReal(udg_Hash, i, 7, yM12)
call SaveReal(udg_Hash, i, 8, yC4)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegM11, null)
local region RegM12 = CreateRegion()
call RegionAddRect(RegM12, gg_rct_M12)
set i = GetHandleId(RegM12)
call SaveInteger(udg_Hash, i, 0, 3)
call SaveReal(udg_Hash, i, 1, xM11)
call SaveReal(udg_Hash, i, 2, xM1)
call SaveReal(udg_Hash, i, 3, xC1)
call SaveReal(udg_Hash, i, 6, yM11)
call SaveReal(udg_Hash, i, 7, yM1)
call SaveReal(udg_Hash, i, 8, yC1)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegM12, null)
local region RegC1 = CreateRegion()
call RegionAddRect(RegC1, gg_rct_C1)
set i = GetHandleId(RegC1)
call SaveInteger(udg_Hash, i, 0, 5)
call SaveReal(udg_Hash, i, 1, xM12)
call SaveReal(udg_Hash, i, 2, xM2)
call SaveReal(udg_Hash, i, 3, xC2)
call SaveReal(udg_Hash, i, 4, xC4)
call SaveReal(udg_Hash, i, 5, xGoal)
call SaveReal(udg_Hash, i, 6, yM12)
call SaveReal(udg_Hash, i, 7, yM2)
call SaveReal(udg_Hash, i, 8, yC2)
call SaveReal(udg_Hash, i, 9, yC4)
call SaveReal(udg_Hash, i, 10, yGoal)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegC1, null)
local region RegC2 = CreateRegion()
call RegionAddRect(RegC2, gg_rct_C2)
set i = GetHandleId(RegC2)
call SaveInteger(udg_Hash, i, 0, 5)
call SaveReal(udg_Hash, i, 1, xC1)
call SaveReal(udg_Hash, i, 2, xM3)
call SaveReal(udg_Hash, i, 3, xM5)
call SaveReal(udg_Hash, i, 4, xC3)
call SaveReal(udg_Hash, i, 5, xGoal)
call SaveReal(udg_Hash, i, 6, yC1)
call SaveReal(udg_Hash, i, 7, yM3)
call SaveReal(udg_Hash, i, 8, yM5)
call SaveReal(udg_Hash, i, 9, yC3)
call SaveReal(udg_Hash, i, 10, yGoal)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegC2, null)
local region RegC3 = CreateRegion()
call RegionAddRect(RegC3, gg_rct_C3)
set i = GetHandleId(RegC3)
call SaveInteger(udg_Hash, i, 0, 5)
call SaveReal(udg_Hash, i, 1, xC2)
call SaveReal(udg_Hash, i, 2, xM6)
call SaveReal(udg_Hash, i, 3, xM8)
call SaveReal(udg_Hash, i, 4, xC4)
call SaveReal(udg_Hash, i, 5, xGoal)
call SaveReal(udg_Hash, i, 6, yC2)
call SaveReal(udg_Hash, i, 7, yM6)
call SaveReal(udg_Hash, i, 8, yM8)
call SaveReal(udg_Hash, i, 9, yC4)
call SaveReal(udg_Hash, i, 10, yGoal)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegC3, null)
local region RegC4 = CreateRegion()
call RegionAddRect(RegC4, gg_rct_C4)
set i = GetHandleId(RegC4)
call SaveInteger(udg_Hash, i, 0, 5)
call SaveReal(udg_Hash, i, 1, xM11)
call SaveReal(udg_Hash, i, 2, xC1)
call SaveReal(udg_Hash, i, 3, xC3)
call SaveReal(udg_Hash, i, 4, xM9)
call SaveReal(udg_Hash, i, 5, xGoal)
call SaveReal(udg_Hash, i, 6, yM11)
call SaveReal(udg_Hash, i, 7, yC1)
call SaveReal(udg_Hash, i, 8, yC3)
call SaveReal(udg_Hash, i, 9, yM9)
call SaveReal(udg_Hash, i, 10, yGoal)
TriggerRegisterEnterRegion(gg_trg_CreepMovement, RegC4, null)
call TriggerAddCondition(gg_trg_CreepMovement, function CreepMovement_Conditions)
call TriggerAddAction(gg_trg_CreepMovement, function CreepMovement_Actions)
endfunction