Ir para conteúdo
  • 0

Colocar pra esse npc dar storage


Allangod

Pergunta

Eu tenho um npc de promoção igual a queen do tibia. Eu queria que colocassem pra esse npc alem de promover o char, ele tambem dar uma storage para ele. Gostaria que desse a storage 2124, 2.

Ta aí o npc, quem conseguir dou REP+

 

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({'chuunin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu posso promover voce para chuunin por 20000 gold coins. Voce quer ser promovido?'})

node1:addChildKeyword({'sim'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 40, promotion = 1, text = 'Parabens! Voce e um Chuunin.'})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

--[[

local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})

node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})

node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

]]--

 

npcHandler:addModule(FocusModule:new())

Link para o comentário
Compartilhar em outros sites

11 respostass a esta questão

Posts Recomendados

  • 0

Tente assim:

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({'chuunin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu posso promover voce para chuunin por 20000 gold coins. Voce quer ser promovido?'})
node1:addChildKeyword({'sim'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 40, promotion = 1, text = 'Parabens! Voce e um Chuunin.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
--[[
local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})
node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})
setPlayerStorageValue(cid,2124,2)
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
]]--

npcHandler:addModule(FocusModule:new())

Link para o comentário
Compartilhar em outros sites

  • 0

Tenta assim:

 

--------------- Cofiguração ---------------
local storage, valor = 2124, 2
--------------- Cofiguração ---------------


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({'chuunin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu posso promover voce para chuunin por 20000 gold coins. Voce quer ser promovido?'})
node1:addChildKeyword({'sim'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 40, promotion = 1, text = 'Parabens! Voce e um Chuunin.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
setPlayerStorageValue(cid, storage, valor)
--[[
local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})
node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
]]--

npcHandler:addModule(FocusModule:new())

Link para o comentário
Compartilhar em outros sites

  • 0

Nao pego Smix

Ta ae o npc que pede a storage

 

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

if msgcontains(msg, 'nayoro') then

if getPlayerStorageValue(cid,2124) == 2 then

if getPlayerItemCount(cid, 4865) >= 40 then

selfSay('Vejo que você me trouxe os items...', cid)

selfSay('Obrigado pela ajuda !',cid)

doPlayerAddExperience(cid,53000)

doPlayerAddItem(cid,2152, 60)

doPlayerRemoveItem(cid, 4865, 40)

setPlayerStorageValue(cid,2124,3)

else

selfSay('Você tem que me trazer 40 items!', cid)

end

else

selfSay('Você deve falar com o Nayoro primeiro e ser Chuunin.',cid)

end

if getPlayerStorageValue(cid,2124) == 3 then

selfSay('Parabens! Voce completou sua primeira missão rank C! Agora vá até o Kam e entregue a ele 50 itens que podem ser encontrados nos Onbas perto da cidade.',cid)

end

return true

end

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Link para o comentário
Compartilhar em outros sites

  • 0

Substitua esse npc que você passou por este:

 

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
if msgcontains(msg, 'nayoro') then
if getPlayerStorageValue(cid,2124) > 1 and getPlayerStorageValue(cid, 2124) < 3 then
if getPlayerItemCount(cid, 4865) >= 40 then
selfSay('Vejo que você me trouxe os items...', cid)
selfSay('Obrigado pela ajuda !',cid)
doPlayerAddExperience(cid,53000)
doPlayerAddItem(cid,2152, 60)
doPlayerRemoveItem(cid, 4865, 40)
setPlayerStorageValue(cid,2124,3)
else
selfSay('Você tem que me trazer 40 items!', cid)
end
else
selfSay('Você deve falar com o Nayoro primeiro e ser Chuunin.',cid)
end
if getPlayerStorageValue(cid,2124) > 2 and getPlayerStorageValue(cid,2124) < 4 then
selfSay('Parabens! Voce completou sua primeira missão rank C! Agora vá até o Kam e entregue a ele 50 itens que podem ser encontrados nos Onbas perto da cidade.',cid)
end
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Editado por SmiX
Link para o comentário
Compartilhar em outros sites

  • 0

Tenta esse npc para dar a storage 2124:

 

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 vocation = {
         [1] = {newPromotion = 9}, -- [id da vocation], newPrmotion = id da promotion, encontrada no diretório "data/XML/vocations.xml"
         [2] = {newPromotion = 10},
         [3] = {newPromotion = 11},
         [4] = {newPromotion = 12}
         moneyNeeded = 2000, -- QUantidade em "dindin" que vai tirar do player
         storage = 2124, -- Storage Que vai dar
         valor = 2 -- Valor da storage
}
               if (msgcontains(msg, 'promotion') or msgcontains(msg, 'PROMOTION')) then
                 if doPlayerRemoveMoney(cid, vocation.moneyNeeded) then else return selfSay("Sorry, you dont have a suficient money.", cid) end
                         selfSay("You want to be promoted?", cid)
                         talkState[talkUser] = 1
               elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
                         selfSay("Okay, you've earned your promotion.", cid)
                         doPlayerSetVocation(cid, vocation[getPlayerVocation(cid)].newPromotion)
                         doSendMagicEffect(getThingPos(cid), math.random(28, 30))
                         setPlayerStorageValue(cid, vocation.storage, vocation.valor)
                         talkState[talkUser] = 0
                         return true
               end

return true
end

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

 

Fale "HI", "PROMOTION" e "YES".

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...