Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local guid = 123123
- local entry = 123123
- local waypoints = {
- {-3961.6398925781, -13931.200195313, 100.61499786377},
- {-3970.2331542969, -13918.111328125, 99.561378479004},
- {-3970.2331542969, -13918.111328125, 99.561378479004},
- {-3970.3566894531, -13903.979492188, 98.188903808594},
- {-3981.5881347656, -13891.403320313, 94.978813171387},
- {-3994.0207519531, -13869.020507813, 89.97811126709 },
- {-4008.8317871094, -13867.951171875, 88.204963684082},
- {-4013.8081054688, -13855.06640625, 88.315124511719},
- {-4012.2021484375, -13823.783203125, 80.429740905762},
- }
- local UNIT_NPC_EMOTESTATE = 83
- local function Emote(creature, emote)
- creature:SetUInt32Value(UNIT_NPC_EMOTESTATE, emote)
- end
- local function Move(creature, id)
- creature:SendUnitSay(tostring(id), 0)
- if(waypoints[id]) then
- creature:SetData("wp", id)
- creature:SetWalk(false)
- creature:RegisterEvent(function() creature:MoveTo(id, table.unpack(waypoints[id])) end, 0, 1)
- else
- creature:SetData("wp", nil)
- creature:DespawnOrUnsummon()
- end
- end
- local function EmoteAndContinue(creature, emote, delaysecs, wpid)
- Emote(creature, emote)
- creature:RegisterEvent(
- function()
- Emote(creature, 0)
- if (not creature:IsInCombat()) then
- Move(creature, wpid)
- end
- end,
- delaysecs*1000, 1)
- end
- local function OnCombat(event, creature, unit)
- creature:MoveExpire()
- end
- local function OnReachHome(event, creature)
- Move(creature, creature:GetData("wp"))
- end
- local function OnWpReach(event, creature, _type, id)
- if (_type ~= 8) then return end
- if (id == 4) then
- EmoteAndContinue(creature, 3, math.random(5, 10), id+1)
- return
- elseif (id == 7) then
- EmoteAndContinue(creature, 4, math.random(5, 10), id+1)
- return
- end
- Move(creature, id+1)
- end
- local function OnSpawn(event, creature)
- if (creature:GetGUIDLow() == guid) then
- Move(creature, 1)
- end
- end
- RegisterCreatureEvent(entry, 1, OnCombat)
- RegisterCreatureEvent(entry, 5, OnSpawn)
- RegisterCreatureEvent(entry, 6, OnWpReach)
- RegisterCreatureEvent(entry, 24, OnReachHome)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement