I've posted a topic with a waypointer system NPC, with video.
But I want to simplify the script:
Look this post:
https://otland.net/threads/rpg-royal-fufu.242256/#post-2345653
But I want to simplify the script:
Code:
-- [[ Feito por Anderson (BomBa)]]
waypoint_royalFufu = 971714008
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local msgs = {
"Que meus inimigos sejam fortes e bravos para que eu nao sinta remorsos ao derrota-los",
"Voce deve se fazer uma pergunta: 'Estou com sorte?",
"Nunca se ouviu dizer que filho valente tivera nascido de pai temeroso.",
"Nunca comece uma briga, mas sempre a termine.",
"Eu me pergunto qual seria melhor, ser temido ou respeitado? Seria de mais pedir os dois. ",
}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
local function greet(cid)
return false
end
function onThink()
local pos = getCreaturePosition(getNpcCid())
-- indo
if getGlobalStorageValue(waypoint_royalFufu) <= 0 then
doTeleportThing(getNpcCid(), {x=1011, y=1357, z=6}, true)
setGlobalStorageValue(waypoint_royalFufu, 1)
elseif getGlobalStorageValue(waypoint_royalFufu) == 1 then
doTeleportThing(getNpcCid(), {x=1010, y=1357, z=6}, true)
setGlobalStorageValue(waypoint_royalFufu, 2)
elseif getGlobalStorageValue(waypoint_royalFufu) == 2 then
doTeleportThing(getNpcCid(), {x=1009, y=1357, z=6}, true)
setGlobalStorageValue(waypoint_royalFufu, 3)
elseif getGlobalStorageValue(waypoint_royalFufu) == 3 then
doTeleportThing(getNpcCid(), {x=1008, y=1357, z=6}, true)
setGlobalStorageValue(waypoint_royalFufu, 4)
elseif getGlobalStorageValue(waypoint_royalFufu) == 4 then
doTeleportThing(getNpcCid(), {x=1007, y=1357, z=6}, true)
setGlobalStorageValue(waypoint_royalFufu, 5)
elseif getGlobalStorageValue(waypoint_royalFufu) == 5 then
doTeleportThing(getNpcCid(), {x=1006, y=1357, z=6}, true)
setGlobalStorageValue(waypoint_royalFufu, 6)
elseif getGlobalStorageValue(waypoint_royalFufu) == 6 then
doTeleportThing(getNpcCid(), {x=1005, y=1357, z=6}, true)
setGlobalStorageValue(waypoint_royalFufu, 7)
elseif getGlobalStorageValue(waypoint_royalFufu) == 7 then
doTeleportThing(getNpcCid(), {x=1005, y=1358, z=6}, true)
setGlobalStorageValue(waypoint_royalFufu, 8)
elseif getGlobalStorageValue(waypoint_royalFufu) == 8 then
doTeleportThing(getNpcCid(), {x=1005, y=1360, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 9)
elseif getGlobalStorageValue(waypoint_royalFufu) == 9 then
doTeleportThing(getNpcCid(), {x=1005, y=1361, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 10)
elseif getGlobalStorageValue(waypoint_royalFufu) == 10 then
doTeleportThing(getNpcCid(), {x=1005, y=1362, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 11)
elseif getGlobalStorageValue(waypoint_royalFufu) == 11 then
doTeleportThing(getNpcCid(), {x=1005, y=1363, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 12)
elseif getGlobalStorageValue(waypoint_royalFufu) == 12 then
doTeleportThing(getNpcCid(), {x=1005, y=1364, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 13)
elseif getGlobalStorageValue(waypoint_royalFufu) == 13 then
doTeleportThing(getNpcCid(), {x=1005, y=1365, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 14)
elseif getGlobalStorageValue(waypoint_royalFufu) == 14 then
doTeleportThing(getNpcCid(), {x=1005, y=1366, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 15)
elseif getGlobalStorageValue(waypoint_royalFufu) == 15 then
doTeleportThing(getNpcCid(), {x=1005, y=1367, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 16)
elseif getGlobalStorageValue(waypoint_royalFufu) == 16 then
doTeleportThing(getNpcCid(), {x=1006, y=1367, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 17)
elseif getGlobalStorageValue(waypoint_royalFufu) == 17 then
doTeleportThing(getNpcCid(), {x=1007, y=1367, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 18)
elseif getGlobalStorageValue(waypoint_royalFufu) == 18 then
doTeleportThing(getNpcCid(), {x=1008, y=1367, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 19)
elseif getGlobalStorageValue(waypoint_royalFufu) == 19 then
doTeleportThing(getNpcCid(), {x=1008, y=1366, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 20)
elseif getGlobalStorageValue(waypoint_royalFufu) == 20 then
doTeleportThing(getNpcCid(), {x=1008, y=1365, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 21)
elseif getGlobalStorageValue(waypoint_royalFufu) == 21 then
doTeleportThing(getNpcCid(), {x=1008, y=1364, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 22)
elseif getGlobalStorageValue(waypoint_royalFufu) == 22 then
doTeleportThing(getNpcCid(), {x=1008, y=1363, z=7}, true)
doCreatureSetLookDir(getNpcCid(), WEST)
addEvent(setGlobalStorageValue, 20000, waypoint_royalFufu, 23)
-- voltando
elseif getGlobalStorageValue(waypoint_royalFufu) == 23 then
doTeleportThing(getNpcCid(), {x=1008, y=1364, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 24)
elseif getGlobalStorageValue(waypoint_royalFufu) == 24 then
doTeleportThing(getNpcCid(), {x=1008, y=1365, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 25)
elseif getGlobalStorageValue(waypoint_royalFufu) == 25 then
doTeleportThing(getNpcCid(), {x=1008, y=1366, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 26)
elseif getGlobalStorageValue(waypoint_royalFufu) == 26 then
doTeleportThing(getNpcCid(), {x=1008, y=1367, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 27)
elseif getGlobalStorageValue(waypoint_royalFufu) == 27 then
doTeleportThing(getNpcCid(), {x=1007, y=1367, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 28)
elseif getGlobalStorageValue(waypoint_royalFufu) == 28 then
doTeleportThing(getNpcCid(), {x=1006, y=1367, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 29)
elseif getGlobalStorageValue(waypoint_royalFufu) == 29 then
doTeleportThing(getNpcCid(), {x=1005, y=1367, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 30)
elseif getGlobalStorageValue(waypoint_royalFufu) == 30 then
doTeleportThing(getNpcCid(), {x=1005, y=1366, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 31)
elseif getGlobalStorageValue(waypoint_royalFufu) == 31 then
doTeleportThing(getNpcCid(), {x=1005, y=1365, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 32)
elseif getGlobalStorageValue(waypoint_royalFufu) == 32 then
doTeleportThing(getNpcCid(), {x=1005, y=1364, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 33)
elseif getGlobalStorageValue(waypoint_royalFufu) == 33 then
doTeleportThing(getNpcCid(), {x=1005, y=1363, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 34)
elseif getGlobalStorageValue(waypoint_royalFufu) == 34 then
doTeleportThing(getNpcCid(), {x=1005, y=1362, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 35)
elseif getGlobalStorageValue(waypoint_royalFufu) == 35 then
doTeleportThing(getNpcCid(), {x=1005, y=1361, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 36)
elseif getGlobalStorageValue(waypoint_royalFufu) == 36 then
doTeleportThing(getNpcCid(), {x=1005, y=1360, z=7}, true)
setGlobalStorageValue(waypoint_royalFufu, 37)
elseif getGlobalStorageValue(waypoint_royalFufu) == 37 then
doTeleportThing(getNpcCid(), {x=1005, y=1358, z=6}, true)
setGlobalStorageValue(waypoint_royalFufu, 38)
elseif getGlobalStorageValue(waypoint_royalFufu) == 38 then
doTeleportThing(getNpcCid(), {x=1006, y=1358, z=6}, true)
setGlobalStorageValue(waypoint_royalFufu, 39)
elseif getGlobalStorageValue(waypoint_royalFufu) == 39 then
doTeleportThing(getNpcCid(), {x=1007, y=1358, z=6}, true)
setGlobalStorageValue(waypoint_royalFufu, 40)
elseif getGlobalStorageValue(waypoint_royalFufu) == 40 then
doTeleportThing(getNpcCid(), {x=1008, y=1358, z=6}, true)
setGlobalStorageValue(waypoint_royalFufu, 41)
elseif getGlobalStorageValue(waypoint_royalFufu) == 41 then
doTeleportThing(getNpcCid(), {x=1009, y=1358, z=6}, true)
setGlobalStorageValue(waypoint_royalFufu, 42)
elseif getGlobalStorageValue(waypoint_royalFufu) == 42 then
doTeleportThing(getNpcCid(), {x=1010, y=1357, z=6}, true)
doCreatureSetLookDir(getNpcCid(), SOUTH)
addEvent(setGlobalStorageValue, 20000, waypoint_royalFufu, 0)
end
-- falas
local falarA = math.random(1, 100000)
if falarA <= 500 then
doCreatureSay(getNpcCid(), msgs[math.random(#msgs)], TALKTYPE_SAY)
end
return true
end
npcHandler:addModule(FocusModule:new())
npcHandler:setCallback(CALLBACK_GREET, greet)
Look this post:
https://otland.net/threads/rpg-royal-fufu.242256/#post-2345653