Postado Outubro 12, 2016 8 anos Boooa noite galera .. , seguinte se alguem puder me ajudar com o meu problema ficarei muito gratooo OTserv versao 7.4 / 7.72 Problema: meu npc de runa só vende de 1 em 1 bp de life fluid ou mana fluid .. , queria colocar ele pra vender tipo varias .. Exemplo: o player quer compra 10 bp de lf de uma vez ... e o npc vai la e vende .. entenderam? NPC: ------------------- local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ event handling functions start 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 -- OTServ event handling functions end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end if msgcontains(msg, 'bp of lf') or msgcontains(msg, 'bp of life fluid') or msgcontains(msg, 'bp lf') then npcHandler:say('Do you want to buy a backpack of explosion rune for 1200 gold coins?') talk_state = 5 elseif msgcontains(msg, 'yes') and talk_state == 5 then if getPlayerMoney(cid) >= 1200 then purple2_bp = doPlayerAddItem(cid, 2000, 1) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doAddContainerItem(purple2_bp, 2006, 10) doPlayerRemoveMoney(cid, 1200) npcHandler:say('Thank you for buying.') talk_state = 0 else npcHandler:say('You don\'t have enough money.') talk_state = 0 end end if msgcontains(msg, 'bp of mf') or msgcontains(msg, 'bp of manafluid') or msgcontains(msg, 'bp mf') then npcHandler:say('Do you want to buy a backpack of mana fluid for 2000 gold coins?') talk_state = 6 elseif msgcontains(msg, 'yes') and talk_state == 6 then if getPlayerMoney(cid) >= 2000 then brown_bp = doPlayerAddItem(cid, 2001, 1) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doAddContainerItem(brown_bp, 2006, 7) doPlayerRemoveMoney(cid, 2000) npcHandler:say('Thank you for buying.') talk_state = 0 else npcHandler:say('You don\'t have enough money.') talk_state = 0 end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Obrigado e aguardo respostas.
Postado Outubro 12, 2016 8 anos Testa ae! Spoiler local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ event handling functions start 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 -- OTServ event handling functions end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end if msgcontains(msg, 'bp of lf') or msgcontains(msg, 'bp of life fluid') or msgcontains(msg, 'bp lf') then npcHandler:say('Do you want to buy a backpack of explosion rune for 1200 gold coins?') talk_state = 5 elseif msgcontains(msg, 'yes') and talk_state == 5 then if getPlayerMoney(cid) >= 1200 then purple2_bp = doPlayerAddItem(cid, 2000, 1) for i = 1, 20 do -- 20 é a quantidade que você quer que adicione então vai adicionar de 1 a 20. Ex: Vai adicionar o item 1 vez, depois mais 1, até adicionar 20x doAddContainerItem(purple2_bp, 2006, 10) end doPlayerRemoveMoney(cid, 1200) npcHandler:say('Thank you for buying.') talk_state = 0 else npcHandler:say('You don\'t have enough money.') talk_state = 0 end end if msgcontains(msg, 'bp of mf') or msgcontains(msg, 'bp of manafluid') or msgcontains(msg, 'bp mf') then npcHandler:say('Do you want to buy a backpack of mana fluid for 2000 gold coins?') talk_state = 6 elseif msgcontains(msg, 'yes') and talk_state == 6 then if getPlayerMoney(cid) >= 2000 then brown_bp = doPlayerAddItem(cid, 2001, 1) for i = 1, 20 do -- Aqui a mesma coisa... doAddContainerItem(brown_bp, 2006, 7) end doPlayerRemoveMoney(cid, 2000) npcHandler:say('Thank you for buying.') talk_state = 0 else npcHandler:say('You don\'t have enough money.') talk_state = 0 end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Dica, traduz essa porra ae, você é BR, tem que representar a gente. Kkkkkkkk Brincks, testa ae! xD
Postado Outubro 12, 2016 8 anos Autor testei aqui com /reload npcs , mas parece que não foi .. porque ele continua vendendo de 1 em 1 .. vou da rr no executavel .. as vezes é isso , pera ae é realmente .. ele esta vendendo de 1 por 1 , o script que voce copiou , tenho que apagar aquela explicação sua ou editar o 1? porque se precisar .. eu nao fiz isso kkkkk
Postado Outubro 12, 2016 8 anos É tenso, to começando em Script ainda, mais tarde, pela manhã ou tarde aparece alguém pra te ajudar! xD
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.