Ir para conteúdo

Featured Replies

Postado

estou com um pequeno problema, meu npc que vende todas as bless vende todas as bless de uma vez, porém quando compro as bless, ele continua me vendendo se eu continuar pedindo, eu gostaria que ele falasse que ja possuo as bless quando eu compro todas. ( o meu outro npc de kazordoon, eu queria que ele vendesse a bless somente se a pessoa falasse com o primeiro npc d bless, (exatamente igual ao global, aonde o player vai em um primeiro pra depois pedir no outro).

esse é meu npc de bless que me vende bless varias vezes sem parar.

function onCreatureSay(cid, type, msg)
    if(not (isFocused(cid)) and (msg == "hi" or msg == "hello")) then
        selfSay("Welcome, ".. getCreatureName(cid) ..". I sell {blessing}.", cid)
        addFocus(cid)
    elseif((isFocused(cid)) and (msg == "bless" or msg == "blessing")) then
        selfSay("Would you like buying blessing per 50000 gold coins?", cid)
    elseif((isFocused(cid)) and (msg == "yes")) then
        if getPlayerMoney(cid) >= price and getPlayerStorageValue(cid, 25252) == 1 then
            selfSay("Alright.", cid)
            doPlayerRemoveMoney(cid, price)
            doPlayerAddBlessing(cid, 1)
            doPlayerAddBlessing(cid, 2)
            doPlayerAddBlessing(cid, 3)
            doPlayerAddBlessing(cid, 4)
            doPlayerAddBlessing(cid, 5)
        else
            selfSay("You don't have enough money or scroll Henricus.", cid)
        end
    elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then
        selfSay("Goodbye!", cid)
        closeShopWindow(cid)
        removeFocus(cid)
    end
end

 
function onThink()
    for i, focus in pairs(focuses) do
        if(not isCreature(focus)) then
            removeFocus(focus)
        else
            local distance = getDistanceTo(focus) or -1
            if((distance > 4) or (distance == -1)) then
                selfSay("Hey, where you going?")
                removeFocus(focus)
            end
        end
    end
    lookAtFocus()
end

e esse são os 2 npcs de kazordoon

 

O segundo npc que só vende caso o primeiro der um storage.

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 node1 = keywordHandler:addKeyword({'fifth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Here you may receive the blessing {Spark of The Phoenix}. But we must ask of you to sacrifice 10000 gold. Are you still interested?'})
    node1:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 2, premium = true, baseCost = 10000, levelCost = 0, startLevel = 10, endLevel = 120})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
    
    local node2 = keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Here you may receive the blessing {Spark of The Phoenix}. But we must ask of you to sacrifice 10000 gold. Are you still interested?'})
    node2:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 2, premium = true, baseCost = 10000, levelCost = 0, startLevel = 10, endLevel = 120})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Oh. You do not have enough money.'})

npcHandler:addModule(FocusModule:new())

 

esse aqui é o primeiro npc que deve me dar um storage pro primeiro vender a bless. porém o segundo npc deve remover essse storage pra q quando a pessoa morra ela possa por bless novamente

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 node1 = keywordHandler:addKeyword({'fifth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Here you may receive the blessing {Spark of The Phoenix}. But we must ask of you to sacrifice 10000 gold. Are you still interested?'})
    node1:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 2, premium = true, baseCost = 0, levelCost = 0, startLevel = 10, endLevel = 120})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
    
    local node2 = keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Here you may receive the blessing {Spark of The Phoenix}. But we must ask of you to sacrifice 10000 gold. Are you still interested?'})
    node2:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 2, premium = true, baseCost = 0, levelCost = 0, startLevel = 10, endLevel = 120})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Oh. You do not have enough money.'})

npcHandler:addModule(FocusModule:new())

Postado

Olha esse NPC blessing https://www.xtibia.com/forum/topic/235100-npc-bless/

Pelo que eu olhei,ele verifica se o player ja tem bless para poder vender.

Editado por Rayo (veja o histórico de edições)

Contribuições:
 

=> Distribuições/Servidores

  1. [8.60] The Forgotten Server 1.3 (COMPILADO WIN x64)

 

=> Scripts/Códigos/Tutoriais

  1. Pokemon pescado aparece em volta do seu pokemon
  2. [Gesior]Dobrar pontos PagSeguro a partir de x valor doado

 

 Gostou de alguma contribuição? Rep +?

Postado
  • Autor

@Rayo  problema do meu npc que ele nao é um simples npc q vende bless, ele só vendea bless com o scroll de bless. pra ter acesso a ele precisa da scroll, eu uso a scroll entao ele passa a vender, mas o problema é  q eu preciso q ele fale que n pode me vender mais dps q eu compro1x
ele ta configurado pra vender todas d uma vez

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 519.6k

Informação Importante

Confirmação de Termo