--[[ Script Name : SpawnScripts/classic_caves/apaleadder.lua Script Author : LordPazuzu Script Date : 2022.09.02 04:09:35 Script Purpose : : --]] function spawn(NPC) AddTimer(NPC,math.random(2500,6000), "ChooseMovement") end function ChooseMovement(NPC) if GetSpawnLocationID(NPC)== 133776947 or GetSpawnLocationID(NPC)== 133776948 or GetSpawnLocationID(NPC)== 133776949 then local route = math.random(1,4) if route == 1 then RouteOne(NPC, Spawn) elseif route == 2 then RouteTwo(NPC, Spawn) elseif route == 3 then RouteThree(NPC, Spawn) elseif route == 4 then RouteFour(NPC, Spawn) end end end function RouteOne(NPC, Spawn) local X = GetX(NPC) local Y = GetY(NPC) local Z = GetZ(NPC) MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(2,10)) MovementLoopAddLocation(NPC, X + 4, Y, Z, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X + 4, Y, Z + 4, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X + 7, Y, Z, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X + 4, Y, Z + 4, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(20,45)) end function RouteTwo(NPC, Spawn) local X = GetX(NPC) local Y = GetY(NPC) local Z = GetZ(NPC) MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(2,10)) MovementLoopAddLocation(NPC, X - 4, Y, Z, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X - 4, Y, Z - 4, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X - 7, Y, Z, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X - 4, Y, Z - 4, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X, Y, Z, 1, math.random(20,45)) end function RouteThree(NPC, Spawn) local X = GetX(NPC) local Y = GetY(NPC) local Z = GetZ(NPC) MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(2,10)) MovementLoopAddLocation(NPC, X + 4, Y, Z, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X + 4, Y, Z - 4, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X + 7, Y, Z, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X + 4, Y, Z - 4, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(20,45)) end function RouteFour(NPC, Spawn) local X = GetX(NPC) local Y = GetY(NPC) local Z = GetZ(NPC) MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(2,10)) MovementLoopAddLocation(NPC, X - 4, Y, Z, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X - 4, Y, Z + 4, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X - 7, Y, Z, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X - 4, Y, Z + 4, 2, math.random(20,45)) MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(20,45)) end