Ir para conteúdo

Criar npc que leve apenas 1 vez


Lebrao

Posts Recomendados


como fazer um npc levar para um lugar apenas 1 vez tibia/wodbodbo, depois ele nao aceita mais levar a mesma pessoa?

Alguém pode me mandar o script de um como base pra mim?

Link para o comentário
Compartilhar em outros sites

Sou novo amigo, mas estou tentando aprender, só que não acho recursos pra isso. Poderia me ajudar aonde mecho? Vejo em outros npcs que tem esse talk_star=0, acredito que isso seja também oque eu precisaria certo? mas dessa vez... poderia me ajudar com esse?, pois com isso posso usar como exemplo. Vou mandar um script de um npc no qual queria que ele levasse apenas 1 vez. O ruim é que nem sei aonde colocar. Mas eu quero realmente aprender.

 

 

 

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
 
 
-- OTServ event handling functions start
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
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end
 
 
 
 
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'central'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer viajar para central por 0 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 1, cost = 0, destination = {x=611, y=192, z=7} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})

 
 
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())

 

Link para o comentário
Compartilhar em outros sites

local key = 9956 -- registro que vai verificar.local go = {x=611, y=192, z=7} -- posição que vai levar. local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid)         npcHandler:onCreatureAppear(cid)         endfunction onCreatureDisappear(cid)      npcHandler:onCreatureDisappear(cid)         endfunction onCreatureSay(cid, type, msg)   npcHandler:onCreatureSay(cid, type, msg:lower())   endfunction onThink()                  npcHandler:onThink()                  endlocal 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, "central") then      selfSay("Are you willing to go to the central one?", cid)      talkState[talkUser] = 1   elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then      if getPlayerStorageValue(cid, key) <= 0 then -- verifica se possui o registro         selfSay("good luck!", cid) -- msg após viajar.         npcHandler:releaseFocus(cid)         doTeleportThing(cid, go) -- teleporta para local		 setPlayerStorageValue(cid, key, 1) -- após viagem adicione registro      else         selfSay("Sorry, but you already made this trip.", cid) -- msg caso nao possa viajar.      end      talkState[talkUser] = 0   end    return trueend  npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new()) 

 

Link para o comentário
Compartilhar em outros sites

  • 4 months later...
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...