Skip to content

Instantly share code, notes, and snippets.

@TeoTwawki
Created July 28, 2016 07:43
Show Gist options
  • Save TeoTwawki/b492662d0859f6db558bac3ae4d0a6dd to your computer and use it in GitHub Desktop.
Save TeoTwawki/b492662d0859f6db558bac3ae4d0a6dd to your computer and use it in GitHub Desktop.
-----------------------------------
-- Roam Path
-----------------------------------
local path =
{
-13, 28, 305,
180, 23, 333,
293, 24, 332,
360, 33, 383,
417, 24, 370,
443, 26, 219,
372, 18, 104,
219, 23, 111,
20, 27, 219,
-27, 20, 291
};
-----------------------------------
-- onMobInitialize
-----------------------------------
function onMobInitialize(mob)
end;
-----------------------------------
-- onMobSpawn
-----------------------------------
function onMobSpawn(mob)
-- Start Pathing
mob:AnimationSub(1);
onPath(mob);
end;
-----------------------------------
-- onPath
-----------------------------------
function onPath(mob)
local FT = mob:getLocalVar("flyingTime");
if (os.time() - FT > 40) then
-- Anything other than 1 or 0 is the animation state from Wind Wall
if (mob:AnimationSub() == 0) then
mob:AnimationSub(1);
mob:setLocalVar("flyingTime", os.time());
elseif (mob:AnimationSub() == 1) then
mob:AnimationSub(0);
mob:setLocalVar("flyingTime", os.time());
end
end
if (mob:AnimationSub() == 1) then
mob:hideName(true);
mob:untargetable(true);
pathfind.patrol(mob, path);
else
mob:hideName(false);
mob:untargetable(false);
end
end;
-----------------------------------
-- OnMobRoam
-----------------------------------
function onMobRoam(mob)
local FT = mob:getLocalVar("flyingTime");
if (os.time() - FT > 40) then
-- Anything other than 1 or 0 is the animation state from Wind Wall
if (mob:AnimationSub() == 0) then
mob:AnimationSub(1);
mob:setLocalVar("flyingTime", os.time());
elseif (mob:AnimationSub() == 1) then
mob:AnimationSub(0);
mob:setLocalVar("flyingTime", os.time());
end
end
if (mob:AnimationSub() == 1) then
mob:hideName(true);
mob:untargetable(true);
-- Move to start position if not moving
if (mob:isFollowingPath() == false) then
mob:pathThrough(pathfind.first(path));
end
else
mob:hideName(false);
mob:untargetable(false);
end
end;
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
mob:AnimationSub(0);
mob:hideName(false);
mob:untargetable(false);
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment