EQ2EMu/server/SpawnScripts/Generic/random_pattern_small.lua
Image 548007ea96 Base
Starting point..!
2020-02-28 09:17:24 -05:00

79 lines
No EOL
2.6 KiB
Lua

--[[
Script Name : SpawnScripts/Generic/random_pattern_small.lua
Script Purpose : chooses a random route of a particular pattern
Script Author : theFoof
Script Date : 2013.5.16
Script Notes : If the coords are out of bounds then the spawn will still go there.
--]]
function spawn(NPC)
ChooseMovement(NPC)
end
function ChooseMovement(NPC)
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
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
function respawn(NPC, Spawn)
spawn(NPC)
end
function hailed(NPC, Spawn)
FaceTarget(NPC, Spawn)
end