Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Dont save variables that are only used in a function here.
- math.randomseed(os.time())
- local function randomed(unit)
- local x = math.random(1,7) -- get a random number
- -- move the unit according to the random number
- if(x == 1) then
- unit:MoveTo(2979.748535, -715.599365, 199.985168, 4.919563)
- elseif(x == 2) then
- unit:MoveTo(2987.003418, -713.099976, 200.049011, 3.668829)
- elseif(x == 3) then
- unit:MoveTo(2994.281250, -738.047302, 199.494217, 2.432610)
- elseif(x == 4) then
- unit:MoveTo(2985.814941, -740.546997, 199.494217, 1.363672)
- elseif(x == 5) then
- unit:MoveTo(2987.078125, -727.422546, 198.364029, 3.47735)
- elseif(x == 6) then
- unit:MoveTo(2984.369873, -717.506409, 199.514359, 5.063842)
- elseif(x == 7) then
- unit:MoveTo(2993.147949, -725.345764, 198.382935, 5.574349)
- end
- end
- local function RunningCitizens(unit, event)
- -- On spawn add aura and move to a random point every 3 seconds.
- unit:AddAura(15661, 99999999999999) -- use 0 for infinite
- randomed(unit) -- Since the timed event runs the first time after 3 seconds from spawning, the function should be ran instantly on spawn once
- CreateLuaEvent(function() randomed(unit) end, 3000, 0) -- 0 instead of 1. This way they will do it every 3 seconds forever. When the water spell hits the NPC, use unit:RemoveEvents() to stop the running.
- end
- RegisterUnitEvent(63007, 18, RunningCitizens)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement