Amigo, O Que Custa procurar antes de Criar um Tópico?!
local DESTINO = {x = 160, y = 54, z = 7} -- POSIÇÃO DE DESTINO
local SAFFRON = {x = 160, y = 54, z = 7} -- POSIÇÃO DE Saffron
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg:lower()) end
function onThink() npcHandler:onThink() end
local talkState = {}
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "sim") or msgcontains(msg, "yes") then
selfSay("Aí está!", cid)
doSendMagicEffect(getThingPos(cid), 10)
npcHandler:releaseFocus(cid)
doTeleportThing(cid, DESTINO)
doSendMagicEffect(DESTINO, 10)
elseif msgcontains(msg, "nao") or msgcontains(msg, "no") then
selfSay("Aí está!", cid)
doSendMagicEffect(getThingPos(cid), 10)
npcHandler:releaseFocus(cid)
doTeleportThing(cid, SAFFRON)
doSendMagicEffect(SAFFRON, 10)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Bob" script="Bob.lua" walkinterval="2000">
<health now="100" max="100" />
<look type="131" head="58" body="43" legs="38" feet="76" addons="0" />
<parameters>
<parameter key="message_greet" value="Ola |PLAYERNAME| voce deseja fazer o guia iniciante?" />
<parameter key="message_farewell" value="So I am alone again." />
<parameter key="message_walkaway" value="So I am alone again." />
</parameters>
</npc>
Créditos: MaXwEllDeN