AL
dúvida

Colocar para NPC remover item

Por Allangod, 16 de dez. de 2012 em Scripts

4
986
AllangodA
16 de dezembro de 2012 às 10:22

Olá, esse meu npc de missão verifica a storage e dá storage quando o player termina a missão, mas ta acontecendo uma coisa... Se o player tiver o item necessario ele retira o item e da a exp e a recompensa, mas se o player não tiver o item necessario ele da a exp e a recompensa mesmo assim. Eu gostaria que ele só desse a experiencia e a recompensa se o player tivesse os itens que o npc mando ele buscar.

Olha o NPC ae

 

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, 'iruka sensei') then

if getPlayerStorageValue(cid,5537) == 1 then

selfSay('Vejo que você me trouxe as 50 spiders fang...', cid)

selfSay('Obrigado pela ajuda !',cid)

doPlayerAddExperience(cid,20000)

doPlayerAddItem(cid,2152, 10)

doPlayerRemoveItem(cid, 8859, 50)

setPlayerStorageValue(cid,5537,2)

else

selfSay('Voce deve falar com o Iruka Sensei primeiro.',cid)

end

if getPlayerStorageValue(cid,5537) == 2 then

selfSay('Agora va ate a loja X e compre obsidian knife, depois mate monstro y e retire coro e leve para o test blank. Você vai precisar de pelo menos 20 coros para entregar a missao',cid)

end

return true

end

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Quem conseguir fazer dou REP+

SlicerS
16 de dezembro de 2012 às 10:55

 

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, 'iruka sensei') then

if getPlayerStorageValue(cid,5537) == 1 then

if getPlayerItemCount(cid, 8859) >= 50 then

selfSay('Vejo que você me trouxe as 50 spiders fang...', cid)

selfSay('Obrigado pela ajuda !',cid)

doPlayerAddExperience(cid,20000)

doPlayerAddItem(cid,2152, 10)

doPlayerRemoveItem(cid, 8859, 50)

setPlayerStorageValue(cid,5537,2)

else

selfSay('Você tem que me trazer 50 spiders fangs!', cid)

end

else

selfSay('Voce deve falar com o Iruka Sensei primeiro.',cid)

end

if getPlayerStorageValue(cid,5537) == 2 then

selfSay('Agora va ate a loja X e compre obsidian knife, depois mate monstro y e retire coro e leve para o test blank. Você vai precisar de pelo menos 20 coros para entregar a missao',cid)

end

return true

end

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

tenta ae..

AllangodA
16 de dezembro de 2012 às 11:06

Grande Slicer, funcionou perfeitamente.

REP+ e mto obrigado.

Yan OliveiraY
16 de dezembro de 2012 às 11:15

Dúvida Resolvida!

 

Tópico Movido.