Ir para conteúdo

Featured Replies

Postado

olá, estou com um pequeno problema pra primeira missao da postman, o npc manda eu viajar de barco e dps retornar nele. bom esse script após viajar e retornar ao npc ele nao reconhece o storage, ele manda eu fazer a missao, então o que acontece é, se eu mudar a palavra carlin por carlim, ele entende, mas se eu falar carlin ele me faz viajar e nao me da a storage. alguem sabe solucionar isso?
 

Spoiler

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic = {}
local storage = 100167
local storage2 = 100168
 
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


        
        -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
        
    local travelNode = keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to {Carlin} for 110 gold coins?'})
            travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 110, destination = {x=32387, y=31820, z=7} })
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
        
    local travelNode = keywordHandler:addKeyword({'ab\'dendriel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to {Ab\'dendriel} for 130 gold coins?'})
            travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 130, destination = {x=32734, y=31668, z=7} })
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
        
    local travelNode = keywordHandler:addKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to {Edron} for 160 gold coins?'})
            travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 160, destination = {x=33178, y=31766, z=7} })
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
            
            local travelNode = keywordHandler:addKeyword({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to {Venore} for 170 gold coins?'})
            travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 170, destination = {x=32959, y=32021, z=7} })
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
        
    local travelNode = keywordHandler:addKeyword({'port hope'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to {Port Hope} for 160 gold coins?'})
            travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 160, destination = {x=32532, y=32783, z=7} })
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
       
        keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore} or {Port Hope}.'})
        keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the {captain} of this ship.'})
        keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})

function greetCallback(cid)
    Topic[cid] = 0
    return true
end

local carlin_cost = 110

function creatureSayCallback(cid, type, msg)
        if (not npcHandler:isFocused(cid)) then return false end
    if (msgcontains(msg, 'no') and Topic[cid] >= 1) then
        npcHandler:say("We would like to serve you some time.",cid)
        Topic[cid] = 0
    end             
            
    if (msgcontains(msg, "carlin") and getPlayerStorageValue(cid,storage) == 1 and getPlayerStorageValue(cid,storage2) == -1) then
           npcHandler:say("Do you want to sail to Carlin for 110 gold coins?",cid)
        Topic[cid] = 1
    elseif (Topic[cid] == 1) then
    if (msgcontains(msg, 'yes') and doPlayerRemoveMoney(cid,carlin_cost) and Topic[cid] == 1) then
        doTeleportThing(cid,{x=32387, y=31820, z=7})
        doSendMagicEffect({x=32387, y=31820, z=7},CONST_ME_TELEPORT)
        setPlayerStorageValue(cid,storage2, 1)
        setPlayerStorageValue(cid,100171,3)
    else
        npcHandler:say("You dont have enough of gold.",cid)
        end
    end
    if (msgcontains(msg, "carlin")) and (getPlayerStorageValue(cid,storage) == -1) then
           npcHandler:say("Do you want to sail to Carlin for 110 gold coins?",cid)
        Topic[cid] = 2
      elseif (Topic[cid] == 2) then
    if (msgcontains(msg, 'yes') and doPlayerRemoveMoney(cid,carlin_cost) and Topic[cid] == 2) then
        doTeleportThing(cid,{x=32387, y=31820, z=7})
        doSendMagicEffect({x=32387, y=31820, z=7},CONST_ME_TELEPORT)
    else
        npcHandler:say("You dont have enough of gold.",cid)
        end
    end
    if (msgcontains(msg, "carlin")) and (getPlayerStorageValue(cid,storage) >= 1 and getPlayerStorageValue(cid,storage2) >= 1) then
           npcHandler:say("Do you want to sail to Carlin for 110 gold coins?",cid)
        Topic[cid] = 3
      elseif (Topic[cid] == 3) then
    if (msgcontains(msg, 'yes') and doPlayerRemoveMoney(cid,carlin_cost) and Topic[cid] == 3) then
        doTeleportThing(cid,{x=32387, y=31820, z=7})
        doSendMagicEffect({x=32387, y=31820, z=7},CONST_ME_TELEPORT)
    else
        npcHandler:say("You dont have enough of gold.",cid)
        end
    end    
    return true    
end
       

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 520k

Informação Importante

Confirmação de Termo