[ Resolvido ]Storagevalue

Brody Dalle
em Lixeira Pública

Brody Dalle

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/08/07Posts: 15

to com um problema, eu to criando um servidor e a maioria das quests são missões pegas em npcs, a cada parte da missão eu adiciono um sotagevalue no player pra ele continuar de onde parou, o problema eh que eu quero fazer missões longas e qnd o player loga parece que da um problema nos storages que faz com que o player não consiga completar a quest e nem recomeçar, o npc simplesmente não responde a nenhuma msg programada.

alguem conhece esse problema e sabe se tem como resolver?

joaohd

Neox Boy
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 03/02/09Posts: 361Char no Tibia: Fearless Man

Storage values não somem quando loga... A não ser que exista algum creaturescripts fazendo isso ou as storages usadas sejam as mesmas da arena (alguns servidores vem configurados para resetar a arena quando loga-se). Talvez você esteja usando alguma função errada... A sintaxe do storage value pode ser:

 

 setPlayerStorageValue(cid, storage, value) 

 

ou

 

 getPlayerStorageValue(cid, storage) 

 

flw

Brody Dalle

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/08/07Posts: 15

o script é esse:

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local storage = 80150



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)
   if(not npcHandler:isFocused(cid)) then
       return false
   end

   local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid


   if msgcontains(msg, 'quest')  then
if getPlayerStorageValue(cid, storage) == -1 then
	npcHandler:say("Hello, I am a fisherman, now my work is stopped because someone stole my {worms}", cid)
	talkState[talkUser] = 1
       end

   elseif talkState[talkUser] == 1 then
       if msgcontains(msg, 'worms') then
               npcHandler:say("Some days ago I went out to buy a new fishing rod, when I returned someone had taken all my worms, I have no money to buy more worms because I spent all the new rod, you can get some for me?", cid)
			talkState[talkUser] = 2
	end



   elseif talkState[talkUser] == 2 then
       if msgcontains(msg, 'yes') then
	npcHandler:say("Thank you young man, this task should not be difficult for you, I see that you carry weapons and shield, is an adventurer, killing rats is easy for you, I will reward you, I promise. Bring {200 worms} for me", cid)
       setPlayerStorageValue(cid,storage,1)
	talkState[talkUser] = 3
       end

   elseif talkState[talkUser] == 3 then
       if msgcontains(msg, "worms") or msgcontains (msg, "itens") then
		if getPlayerItemCount(cid,3976)  >= 200 then
				doPlayerRemoveItem(cid,3976,200)
				local cclub = doPlayerAddItem(cid,2448,1)
				doItemSetAttribute(cclub,"name","Studded Club of Sea")
				doItemSetAttribute(cclub,"attack",10)
				doItemSetAttribute(cclub,"defense",10)
				doItemSetAttribute(cclub,"description","A club forged by ancient pirates")
				doPlayerAddExp(cid,200)
			npcHandler:say("Thank you young man, now I can go back to my work, take this club that I found on the seabed... {you received 300xp and a Studded club}")
			setPlayerStorageValue(cid,storage,2)
			talkState[talkUser] = 4
		else
               npcHandler:say("You don't have the {worms} yet. come back when you have",cid)
           end
           end
           end
   return true
end

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

 

no caso se eu quiser logar e pegar os itens e entregar depois, eu não consigo.. o npc não fala mais com o char se ele logar, soh fala a msg

satan666

Antichrist Superstar
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 07/05/08Posts: 612Char no Tibia: leviana luciferiana
if getPlayerStorageValue(cid, storage) == -1 then npcHandler:say("Hello, I am a fisherman, now my work is stopped because someone stole my {worms}", cid) talkState[talkUser] = 1 end

 

elseif talkState[talkUser] == 2 then if msgcontains(msg, 'yes') then npcHandler:say("Thank you young man, this task should not be difficult for you, I see that you carry weapons and shield, is an adventurer, killing rats is easy for you, I will reward you, I promise. Bring {200 worms} for me", cid) setPlayerStorageValue(cid,storage,1) talkState[talkUser] = 3 end

 

por causa disso.

setPlayerStorageValue(cid,storage,1)

 

creio que isso esteja errado.

local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid

creationb.jpg

"Um Deus que usasse seu poder para criar seres humanos que de antemão sabia que seriam atormentados eternamente, e que os predestinasse a isso,



não poderia ser sábio, nem justo e tampouco amoroso.

Além de nos submeter a isso vim a nos julgar e condenar por nossos atos aos tormentos do inferno.

pra minha pessoa isso não é um Deus Pai amoroso e bondoso como o chaman, seu padrão seria muito mais inferior do que o de muitos homens."

joaohd

Neox Boy
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 03/02/09Posts: 361Char no Tibia: Fearless Man

@Marcryzius

O erro não é somente este. Note que no primeiro status da conversação, ele checa se há storage ou não... Este é o erro maior.

 

@Topic

Estou tentando refazer seu npc. Caso consiga, postarei.

 

 

@Edited

Aqui está seu 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)
   if(not npcHandler:isFocused(cid)) then
       return false
   end

   local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

--------------------------------------------------------------------------------

local storage = 80150

     if msgcontains(msg, 'quest') and getPlayerStorageValue(cid, storage) == -1 then
        selfSay("Hello, I am a fisherman, now my work is stopped because someone stole my {worms}", cid)
        talk_state = 1

     elseif msgcontains(msg, 'worms') and talk_state == 1 then
        selfSay("Some days ago I went out to buy a new fishing rod, when I returned someone had taken all my worms, I have no money to buy more worms because I spent all the new rod, you can get some for me?", cid)
        talk_state = 2

     elseif msgcontains(msg, 'yes') and talk_state == 3 then         
        selfSay("Thank you young man, this task should not be difficult for you, I see that you carry weapons and shield, is an adventurer, killing rats is easy for you, I will reward you, I promise. Bring {200 worms} for me", cid)
        setPlayerStorageValue(cid,storage,1)
        talk_state = 0      

     elseif msgcontains(msg,'quest') and getPlayerStorageValue(cid, storage) == 1 then
        selfSay("Did you bring my worms?", cid)
        talk_state = 3

     elseif msgcontains(msg, 'yes') and talk_state == 3 then   
         if getPlayerItemCount(cid,3976)  >= 200 then
                                       doPlayerRemoveItem(cid,3976,200)
                                       local cclub = doPlayerAddItem(cid,2448,1)
                                       doItemSetAttribute(cclub,"name","Studded Club of Sea")
                                       doItemSetAttribute(cclub,"attack",10)
                                       doItemSetAttribute(cclub,"defense",10)
                                       doItemSetAttribute(cclub,"description","A club forged by ancient pirates")
                                       doPlayerAddExp(cid,200)
                               selfSay("Thank you young man, now I can go back to my work, take this club that I found on the seabed... {you received 300xp and a Studded club}")
                               setPlayerStorageValue(cid,storage,2)
                               talk_state = 0
                       else
                               selfSay("You don't have the {worms} yet. come back when you have",cid)
                               talk_state = 0
                       end   


     elseif msgcontains(msg, 'quest') and getPlayerStorageValue(cid, storage) == 2 then
        selfSay("Oh, i am thankful, but i have no missions now.", cid)
        talk_state = 0


     elseif msg == "no" and talk_state == 2 or msg == "no" and talk_state == 3 then
        selfSay("I will find someone who can help me.", cid)
        talk_state = 0 
        end   
   return true
end

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

 

Não testei, porém acho que funciona.

 

 

flw

Brody Dalle

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/08/07Posts: 15

Funcionou, ta perfeito agora, da pra logar e continuar a quest depois, tinha um errinho basico na parte dos talk_states, na parte que falava "yes" ele n ia pra proxima parte, mas isso eh só um detalhe comparado ao problema anterior, vlw mesmo, me ajudou muito =)

satan666

Antichrist Superstar
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 07/05/08Posts: 612Char no Tibia: leviana luciferiana

apocarai:

 

issó não é um error, e sim uma forma dele não responder caso sua storage seja diferente.

creationb.jpg

"Um Deus que usasse seu poder para criar seres humanos que de antemão sabia que seriam atormentados eternamente, e que os predestinasse a isso,



não poderia ser sábio, nem justo e tampouco amoroso.

Além de nos submeter a isso vim a nos julgar e condenar por nossos atos aos tormentos do inferno.

pra minha pessoa isso não é um Deus Pai amoroso e bondoso como o chaman, seu padrão seria muito mais inferior do que o de muitos homens."

Henrique Moura

Ex-administrador
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 17/02/08Posts: 2541

Aparentemente a dúvida foi sanada. Agradeço aos membros que puderam ajudá-lo.

Marcryzius ganha ponto de reputação.

Apocarai ganha ponto de reputação.

 

Grato,

Tópico fechado.

KaKilo ~
 


Lom14fD.png