Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Eai, galera do TK!

 

Então, eu to com um egg system aqui e parece que ele está incompleto...  Quando eu falo "care" para o npc cuidar do ovo, ele pega meu dinheiro e não pega nenhum ovo para "cuidar", dps disso o tempo para chocar corre normalmente, mas na hora de pedir o ovo devolta, (depois do tempo) ele devolve nada...

 

Spoiler

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 onCreatureSayCallback(cid, type, msg)

local config = {

price = 50000,

delay = 5 * 60,

control = {10555, 10556},

eggn = 4850

}

if not npcHandler:isFocused(cid) then

return false

end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid


if msgcontains(msg, "care") then

local p = (config.price % 1000 == 0 and (config.price / 1000) or config.price)

if getPlayerStorageValue(cid, config.control) > os.time() then

selfSay("Sorry, but I am already caring one of your eggs.", cid)

else

selfSay("Do you want me to take care of your egg for ".. p .." ".. (p == config.price and "" or "k") .."?", cid)

talkState[talkUser] = 1

end


elseif msgcontains(msg, "back") then

if getPlayerStorageValue(cid, config.control[2]) == 1 then

selfSay("Hello, do you came to pick up your egg?", cid)

talkState[talkUser] = 2

else

selfSay("Sorry, but I am not caring eggs from you.", cid)

end


elseif msgcontains(msg, "check") then

local t = getPlayerStorageValue(cid, config.control[1])

if getPlayerStorageValue(cid, config.control[2]) == -1 then

selfSay("Sorry, but I am not caring eggs from you.", cid)

else

if t < os.time() then

selfSay("Yay, your egg has started to hatch, take it.", cid)

setPlayerStorageValue(cid, config.control[1], -1)

setPlayerStorageValue(cid, config.control[2], -1)

else

selfSay("I will be caring your egg for more ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)

end

end

end


if talkState[talkUser] == 1 then

if msgcontains(msg, "yes") then

if getPlayerStorageValue(cid, config.control[2]) == -1 then

if doPlayerRemoveMoney(cid, config.price) then

setPlayerStorageValue(cid, config.control[2], 1)

setPlayerStorageValue(cid, config.control[1], os.time()+config.delay)

selfSay("Okay! Check back soon.", cid)

else

selfSay("Sorry, you don't have enough money. You need more ".. (config.price - getPlayerMoney(cid)) .." coins.", cid)

end

else

selfSay("I am already taking care of a egg for you.", cid)

end

elseif msgcontains(msg, "no") then

selfSay("Too pricey for you, heh?", cid)

end

elseif talkState[talkUser] == 2 then

local x = getPlayerStorageValue(cid, config.control)

local t = getPlayerStorageValue(cid, config.control[1])

if msgcontains(msg, "yes") then

if x > os.time() then

local item = doPlayerAddItem(cid, config.eggn, 1)

doItemSetAttribute(item, "description", "A hatched egg.")

selfSay("Take it!", cid)

setPlayerStorageValue(cid, control[2], -1)

setPlayerStorageValue(cid, control[1], -1)

else

selfSay("Sorry, but your egg need care for more ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)

end

		end

end  

return true

end


npcHandler:setMessage(MESSAGE_GREET, "Hello, |PLAYERNAME|. I am a pet egg carer. Do you want me to {care} your pet eggs? Also you can {check} the egg status and if you have any egg here, you can get it {back}.")

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, onCreatureSayCallback)

npcHandler:addModule(FocusModule:new())	

 

 

tumblr_o70wteR8521r9n6kzo1_400.gif

Link para o post
Compartilhar em outros sites
  • Respostas 8
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Não ocorreu erro nenhum, se falar fora de ordem ele vai falar isso aí.  Aqui um arquivo.xml para você ter como base:   <?xml version="1.0" encoding="UTF-8"?> <npc name="Egger" script="NOMEDOSEUARQUIVO.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="139" head="20" body="39" legs="45" feet="7" addons="0"/> </npc>  

Pega o xml que coloquei aí e edita o nome do npc, nome do arquivo e o looktype para seu npc.

Posted Images

Spoiler

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

local config = {eggId = 1111, -- id do ovo para remover
price = 50000,
delay = 1 * 60,
eggn = 4850, -- id do ovo para entregar
control = {10555, 10556}
}
function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local msg = string.lower(msg)
    if not npcHandler:isFocused(talkUser) then
        if isInArray({"hi", "hello"}, msg) then
            npcHandler:addFocus(cid)
            selfSay("Hello, "..getPlayerName(cid).."! I am a pet egg carer. Do you want me to {care} your pet eggs? Also you can {check} the egg status and if you have any egg here, you can get it {back}.", cid)
            talkState[talkUser] = 1
        else
            return false 
        end
    elseif msgcontains(msg, "care") and talkState[talkUser] == 1 then
        local p = (config.price % 1000 == 0 and (config.price / 1000) or config.price)
        if getPlayerStorageValue(cid, config.control[1]) > os.time() then
            selfSay("Sorry, but I am already caring one of your eggs.", cid)
            talkState[talkUser] = 0
        else
            selfSay("Do you want me to take care of your egg for ".. p .." ".. (p == config.price and "" or "k") .."?", cid)
            talkState[talkUser] = 2
        end
    elseif msgcontains(msg, "back") and talkState[talkUser] == 1 then
        if getPlayerStorageValue(cid, config.control[2]) == 1 then
            selfSay("Hello, do you came to pick up your egg?", cid)
            talkState[talkUser] = 3
        else
            selfSay("Sorry, but I am not caring eggs from you.", cid)
            talkState[talkUser] = 0
        end
    elseif msgcontains(msg, "check") and talkState[talkUser] == 1 then
        local t = getPlayerStorageValue(cid, config.control[1])
        if getPlayerStorageValue(cid, config.control[2]) == -1 then
            selfSay("Sorry, but I am not caring eggs from you.", cid)
            talkState[talkUser] = 0
        else
            if t > os.time() then
                selfSay("I will be caring your egg for more ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)
                talkState[talkUser] = 0
            else
                selfSay("Yay, your egg has started to hatch, take it.", cid)
                talkState[talkUser] = 0
            end
        end
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then
        if getPlayerStorageValue(cid, config.control[2]) == -1 then
            if getPlayerItemCount(cid, config.eggId) >= 1 then
                if doPlayerRemoveMoney(cid, config.price) then
                    doPlayerRemoveItem(cid, config.eggId, 1)
                    setPlayerStorageValue(cid, config.control[1], os.time()+config.delay)
                    setPlayerStorageValue(cid, config.control[2], 1)
                    selfSay("Okay! Check back soon.", cid)
                    talkState[talkUser] = 0
                else
                    selfSay("Sorry, you don't have enough money. You need more ".. (config.price - getPlayerMoney(cid)) .." coins.", cid)
                    talkState[talkUser] = 0
                end
            else
                selfSay("You don't have any egg.", cid)
                talkState[talkUser] = 0
            end
        else
            selfSay("I am already taking care of a egg for you.", cid)
            talkState[talkUser] = 0
        end
    elseif msgcontains(msg, "no") and talkState[talkUser] == 2 then
        selfSay("Too pricey for you, heh?", cid)
        talkState[talkUser] = 0
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 3 then
        local t = getPlayerStorageValue(cid, config.control[1])
        if t < os.time() then
            local item = doPlayerAddItem(cid, config.eggn, 1)
            doItemSetAttribute(item, "description", "A hatched egg.")
            setPlayerStorageValue(cid, config.control[1], -1)
            setPlayerStorageValue(cid, config.control[2], -1)
            selfSay("Take it!", cid)
            talkState[talkUser] = 0
        else
            selfSay("Sorry, but your egg need care for more ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)
            talkState[talkUser] = 0
        end
    elseif msgcontains(msg, "bye") then
        selfSay("Bye.", cid)
        npcHandler:releaseFocus(cid)
    else
        selfSay("WHAT?", cid)
        talkState[talkUser] = 0
    end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

 

 

Contato:

 

Link para o post
Compartilhar em outros sites
1 hora atrás, Dwarfer disse:
  Ocultar conteúdo


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

local config = {eggId = 1111, -- id do ovo para remover
price = 50000,
delay = 1 * 60,
eggn = 4850, -- id do ovo para entregar
control = {10555, 10556}
}
function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local msg = string.lower(msg)
    if not npcHandler:isFocused(talkUser) then
        if isInArray({"hi", "hello"}, msg) then
            npcHandler:addFocus(cid)
            selfSay("Hello, "..getPlayerName(cid).."! I am a pet egg carer. Do you want me to {care} your pet eggs? Also you can {check} the egg status and if you have any egg here, you can get it {back}.", cid)
            talkState[talkUser] = 1
        else
            return false 
        end
    elseif msgcontains(msg, "care") and talkState[talkUser] == 1 then
        local p = (config.price % 1000 == 0 and (config.price / 1000) or config.price)
        if getPlayerStorageValue(cid, config.control[1]) > os.time() then
            selfSay("Sorry, but I am already caring one of your eggs.", cid)
            talkState[talkUser] = 0
        else
            selfSay("Do you want me to take care of your egg for ".. p .." ".. (p == config.price and "" or "k") .."?", cid)
            talkState[talkUser] = 2
        end
    elseif msgcontains(msg, "back") and talkState[talkUser] == 1 then
        if getPlayerStorageValue(cid, config.control[2]) == 1 then
            selfSay("Hello, do you came to pick up your egg?", cid)
            talkState[talkUser] = 3
        else
            selfSay("Sorry, but I am not caring eggs from you.", cid)
            talkState[talkUser] = 0
        end
    elseif msgcontains(msg, "check") and talkState[talkUser] == 1 then
        local t = getPlayerStorageValue(cid, config.control[1])
        if getPlayerStorageValue(cid, config.control[2]) == -1 then
            selfSay("Sorry, but I am not caring eggs from you.", cid)
            talkState[talkUser] = 0
        else
            if t > os.time() then
                selfSay("I will be caring your egg for more ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)
                talkState[talkUser] = 0
            else
                selfSay("Yay, your egg has started to hatch, take it.", cid)
                talkState[talkUser] = 0
            end
        end
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then
        if getPlayerStorageValue(cid, config.control[2]) == -1 then
            if getPlayerItemCount(cid, config.eggId) >= 1 then
                if doPlayerRemoveMoney(cid, config.price) then
                    doPlayerRemoveItem(cid, config.eggId, 1)
                    setPlayerStorageValue(cid, config.control[1], os.time()+config.delay)
                    setPlayerStorageValue(cid, config.control[2], 1)
                    selfSay("Okay! Check back soon.", cid)
                    talkState[talkUser] = 0
                else
                    selfSay("Sorry, you don't have enough money. You need more ".. (config.price - getPlayerMoney(cid)) .." coins.", cid)
                    talkState[talkUser] = 0
                end
            else
                selfSay("You don't have any egg.", cid)
                talkState[talkUser] = 0
            end
        else
            selfSay("I am already taking care of a egg for you.", cid)
            talkState[talkUser] = 0
        end
    elseif msgcontains(msg, "no") and talkState[talkUser] == 2 then
        selfSay("Too pricey for you, heh?", cid)
        talkState[talkUser] = 0
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 3 then
        local t = getPlayerStorageValue(cid, config.control[1])
        if t < os.time() then
            local item = doPlayerAddItem(cid, config.eggn, 1)
            doItemSetAttribute(item, "description", "A hatched egg.")
            setPlayerStorageValue(cid, config.control[1], -1)
            setPlayerStorageValue(cid, config.control[2], -1)
            selfSay("Take it!", cid)
            talkState[talkUser] = 0
        else
            selfSay("Sorry, but your egg need care for more ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)
            talkState[talkUser] = 0
        end
    elseif msgcontains(msg, "bye") then
        selfSay("Bye.", cid)
        npcHandler:releaseFocus(cid)
    else
        selfSay("WHAT?", cid)
        talkState[talkUser] = 0
    end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

 

 

 

Ocorreu um ero... eu vou falar com o NPC e ele fica "What?" toda hora... ja falei hi, hello e nada....

tumblr_o70wteR8521r9n6kzo1_400.gif

Link para o post
Compartilhar em outros sites

Não ocorreu erro nenhum, se falar fora de ordem ele vai falar isso aí. 

Aqui um arquivo.xml para você ter como base:

 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Egger" script="NOMEDOSEUARQUIVO.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="139" head="20" body="39" legs="45" feet="7" addons="0"/>
</npc>

 

Contato:

 

Link para o post
Compartilhar em outros sites
14 horas atrás, Dwarfer disse:

Não ocorreu erro nenhum, se falar fora de ordem ele vai falar isso aí. 

Aqui um arquivo.xml para você ter como base:

 


<?xml version="1.0" encoding="UTF-8"?>
<npc name="Egger" script="NOMEDOSEUARQUIVO.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="139" head="20" body="39" legs="45" feet="7" addons="0"/>
</npc>

 

 

Ocorre esse erro:

dwarfer.thumb.png.e823b1026cfdbe8c618e05dcacd68294.png

tumblr_o70wteR8521r9n6kzo1_400.gif

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por Jaurez
      .
    • Por Cat
      Em alguns casos, o tibia 8.60 comum não abre de jeito nenhum no map editor, mesmo desmarcando check file signatures e configurando o path corretamente.
       
      Este é o client 8.60 adaptado para o Remere's Map Editor. Resolvi postar já que ele foi removido do site oficial do RME. (ficou apenas a versão para linux lá)
      Se estiver tendo problemas para abrir a versão 8.60, tente utilizar este.
                                                                                                                     
      Baixar o Tibia Client 8.60 que funciona no Remere’s Map Editor
      Essa versão do Tibia 8.60 client resolve o erro unsupported client version ou Could not locate tibia.dat and/or tibia.spr, please navigate to your tibia 8.60 installation folder.
       
      Downloads
      https://tibiaking.com/applications/core/interface/file/attachment.php?id=47333

      Scan: https://www.virustotal.com/gui/file/333e172ac49ba2028db9eb5889994509e7d2de28ebccfa428c04e86defbe15cc
       
    • Por danilo belato
      Fala Galera To Com um problema aki 
       
      quero exporta umas sprites de um server para colocar em outro 
       
      eu clico na sprites ai aparece tds a forma delas do lado de la >>
       
      ai eu clico nela e ponho a opiçao de export mais quando salvo a sprite ela n abri 
       
      aparece isso quando tento vê-la 
       
      visualização não disponível ( no formatos png e bitmap)
       
      Agora no formato idc fala que o paint n pode ler 
       
      me ajudem ae...
    • Por Vitor Bicaleto
      Galera to com o script do addon doll aqui, quando eu digito apenas "!addon" ele aparece assim: Digite novamente, algo está errado!"
      quando digito por exemplo: "!addon citizen" ele não funciona e não da nenhum erro
       
      mesma coisa acontece com o mount doll.. 
    • Por Ayron5
      Substitui uma stone no serve, deu tudo certo fora  esse  erro ajudem  Valendo  Rep+  Grato  

      Erro: data/actions/scripts/boost.lua:557: table index is nil
       [Warning - Event::loadScript] Cannot load script (data/actions/scripts/boost.lua)

      Script:
  • Estatísticas dos Fóruns

    96846
    Tópicos
    519603
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo