Ir para conteúdo

Os npcs da bless de kazordoon


bpm92

Posts Recomendados

Boa noite, estou com um pequeno problema, eu tenho aqui 2 npcs no qual 1 eu quero que entregue uma storage. e o outro npc que verifique a storage, remova a storage, venda a bless, e verifique se ta com a bless.

Segue script do npc 1 que entrega a 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


function phoenix(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerStorageValue(cid,8888888) <= -1 then
            npcHandler:say('So receive the blessing of the life-giving earth, pilgrim.!', cid)
            doSendMagicEffect(getCreaturePos(cid), 12)
            setPlayerStorageValue(cid,8888888, 1)
        end
        if getPlayerStorageValue(cid,8888888) == 1 then
        npcHandler:say('ja te dei a bensao.', cid)
    end
end
keywordHandler:addKeyword({'bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Here you may receive the blessing {Spark of The Phoenix}'})

local node1 = keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'The Spark of the Phoenix is given by name and by the great pyromancer in the nearby fire temple. Do you wish to receive my part of the Spark if the Phoenix? '})
    node1:addChildKeyword({'yes'}, phoenix, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then.', reset = true})
    
    
npcHandler:addModule(FocusModule:new())


Segue npc 2 que vende a bless, verifica se ja tem bless, remove o storage do primeiro npc

 

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


function phoenix(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    
    local player_gold     = getPlayerItemCount(cid,2148)
    local player_plat     = getPlayerItemCount(cid,2152)*100
    local player_crys     = getPlayerItemCount(cid,2160)*10000
    local player_money     = player_gold + player_plat + player_crys
    
    if player_money >= 10000 then
    if doPlayerRemoveMoney(cid,10000) and getPlayerStorageValue(cid,8888888) <= 1 and getPlayerBlessing(cid, 2) then
        npcHandler:say('Here is your blessing!', cid)
        setPlayerStorageValue(cid,8888888,-1)
        doSendMagicEffect(getCreaturePos(cid), 12)
        doPlayerAddBlessing(cid, 2)
        end
        else
            npcHandler:say('Alright then.', cid)
    end
    
    if getPlayerStorageValue (cid,8888888) == -1 then
    npcHandler:say('You have already blessed you with this blessing.', cid)
    end
end
        

local node1 = keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Here you may receive the blessing {Spark of Phoenix}. But we must ask of you to sacrifice 10000 gold coins. Are you still interested?.'})
    node1:addChildKeyword({'yes'}, phoenix, {})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then.', reset = true})
    
    
    npcHandler:addModule(FocusModule:new())
    
porém estou em conflito com os npcs, eu acho que a formula do npc da bless está errado como keyworld, alguem poderia ajudar?

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...