Ir para conteúdo
  • 0

Storage Nao Funfa


Pergunta

Eu criei um npc de quest que da um storage pro player, ai ativa a quest normalmente, só que se o player voltar e falar denovo com o npc recebe novamente o storage e reinicia a quest. Eu tentei adicionar um storage no firstitems e colocar pro npc checar se o player tem o storage, ele só vai ter quando criar uma conta nova, pq dps que ele abre o bau, o storage é setado pra -1. Só que não ta funcionando, nao sei pq, de vez em quando funciona, outras vezes não.

 

Firstitems:

 

local firstItems =

{

2460,

2465,

2531,

2554,

2120,

2643,

2478

}

 

function onLogin(cid)

if getPlayerStorageValue(cid, 30001) == -1 then

for i = 1, table.maxn(firstItems) do

doPlayerAddItem(cid, firstItems, 1)

end

 

local bag = doPlayerAddItem(cid, 1988, 1)

local voca = getPlayerVocation(cid)

if voca == 1 then

doPlayerAddItem(cid, 2190, 1)

doAddContainerItem(bag, 7620, 5)

doPlayerAddItem(cid, 2152, 10)

elseif voca == 2 then

doPlayerAddItem(cid, 2182, 1)

doAddContainerItem(bag, 7620, 5)

doPlayerAddItem(cid, 2152, 10)

elseif voca == 3 then

doPlayerAddItem(cid, 2389, 1)

doAddContainerItem(bag, 7618, 5)

doPlayerAddItem(cid, 2152, 10)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Os trainers se encontram a Nordeste na cidade.')

elseif voca == 4 then

doPlayerAddItem(cid, 8602, 1)

doPlayerAddItem(cid, 8601, 1)

doPlayerAddItem(cid, 2439, 1)

doAddContainerItem(bag, 7618, 5)

doPlayerAddItem(cid, 2152, 10)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Os trainers se encontram a Nordeste na cidade.')

end

setPlayerStorageValue(cid, 30001, 1)

setPlayerStorageValue(cid, 96745, 1)

 

 

end

return TRUE

end

 

 

 

NPC:

 

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

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

function creatureSayCallback(cid, type, msg)

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

--[[

REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!

]]--

local boromir = 4001

local boromir2 = 4002

local boromir3 = 4003

 

if (getPlayerStorageValue(cid, 96745) == 1) and msgcontains(msg, 'portao') then

npcHandler:say("Você terá que matar um guarda e abrir o portão, acha que consegue?", cid)

talkState[talkUser] = 0

elseif (getPlayerStorageValue(cid, 96745) == 1) and msgcontains(msg, 'yes') then

setPlayerStorageValue(cid, boromir, 1)

setPlayerStorageValue(cid, boromir2, 1)

setPlayerStorageValue(cid, boromir3, 1)

npcHandler:say("Quando abrir o portão, desça as escadas e vá procurar por Heller, ele lhe dará as próximas instruções.", cid)

talkState[talkUser] = 0

else

npcHandler:say("Estou muito ferido e não posso mais lutar, você terá que ir sozinho.", cid)

talkState[talkUser] = 0

end

return TRUE

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

E não da erro nenhum no console, o script ta funcionando, só parece que não ta checando corretamente. Alguem sabe o que pode ser e como arrumar? Rep +

Link para o comentário
https://xtibia.com/forum/topic/197588-storage-nao-funfa/
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...