Postado Dezembro 23, 2018 6 anos boa tarde, gostaria de saber se tem como fazer o npc, vender os itens por gold ingot q no caso id 9971, mais eu gostaria tipo a pessoa traz 100 gold ingot, compra um item, traz 5000 mil outro e etc ?? <?xml version="1.0" encoding="UTF-8"?> <npc name="Items Donate" script="data/npc/scripts/itemsdonate.lua" walkinterval="0"> <health now="100" max="100"/> <look type="302" head="58" body="43" legs="38" feet="76" addons="0"/> <parameters> <parameter key="module_shop" value="1"/> <parameter key="shop_buyable" value="Otfun Rod, 7735, 10000000000;Otfun Wand, 6534, 10000000000;Otfun Arrow, 2352, 10000000000;Otfun Club, 7423, 10000000000;Otfun Axe, 7453, 10000000000;Otfun Sword, 7405, 10000000000;up helmet, 8299, 100000000;up armor, 8302, 100000000;up legs,8301,100000000;up boots,8303,100000000;up shield, 8310,100000000;supremmy holy,2270,50000000000;supremmy sd,2263,50000000000;Trap rune,2299,50000000000;Donate Vip,9003,10000000000;"/> </parameters> <parameters> <parameter key="shop_sellable" value="Enfeite Gem,2155,100000000;"/> </parameters> </npc>
Postado Dezembro 23, 2018 6 anos Veja ai se vai funconar de uma meneira que você queira. <?xml version="1.0" encoding="UTF-8"?> <npc name="ItemsDonor" script="data/npc/scripts/donor.lua" speed="0" floorchange="0"> <health now="100" max="100"/> <look type="129" head="78" body="88" legs="0" feet="88" addons="3"/> <parameters> <parameter key="message_greet" value="Olá |PLAYERNAME| eu sou um vendendor muito conhecido pelos belissimos itens que vendo, tenho certeza que não irá se arrepender!" /> <parameter key="message_walkaway" value="Volte Sempre."/> <parameter key="message_farewell" value="Espero sua volta!" /> </parameters> </npc> Quando ele comprar até o storage chegar em 6 ele não pdoerá comprar mais, mas ai com um pouco de conhecimento você pode aumentar e um Scriper pode melhorar de uma forma que possa diminuir o script e ficar melhor. local cfg ={ price = 100 } 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 isInArray({"donate","donor"}, msg) then if getPlayerStorageValue(cid, 2357) <= 0 then npcHandler:say('Você gostaria de comprar um {item donor} por {'..cfg.price..' gold\'s ingot\'s}', cid) talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, 2357) == 1 then npcHandler:say('Você gostaria de comprar um {item donor} por {'.. cfg.price*5 ..' gold\'s ingot\'s}', cid) --*5 = 500 talkState[talkUser] = 2 elseif getPlayerStorageValue(cid, 2357) == 2 then npcHandler:say('Você gostaria de comprar um {item donor} por {'.. cfg.price*10 ..' gold\'s ingot\'s}', cid) --*10 = 1000 talkState[talkUser] = 3 elseif getPlayerStorageValue(cid, 2357) == 3 then npcHandler:say('Você gostaria de comprar um {item donor} por {'.. cfg.price*15 ..' gold\'s ingot\'s}', cid) talkState[talkUser] = 4 elseif getPlayerStorageValue(cid, 2357) == 4 then npcHandler:say('Você gostaria de comprar um {item donor} por {'.. cfg.price*20 ..' gold\'s ingot\'s}', cid) talkState[talkUser] = 5 elseif getPlayerStorageValue(cid, 2357) == 5 then npcHandler:say('Você gostaria de comprar um {item donor} por {'.. cfg.price*30 ..' gold\'s ingot\'s}', cid) talkState[talkUser] = 6 end elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if getPlayerItemCount(cid, 9971) >= cfg.price then doPlayerTakeItem(cid,9971,cfg.price) doPlayerAddItem(cid,2160,1) setPlayerStorageValue(cid,2357,1) npcHandler:say('Foi um prazer negociar com você!', cid) else npcHandler:say('Volte quando tiver os {'..cfg.price..' gold\'s ingot\'s}', cid) end elseif(msgcontains(msg, 'yes') and getPlayerStorageValue(cid,2357) == 1 and talkState[talkUser] == 2) then if getPlayerItemCount(cid, 9971) >= cfg.price*5 then doPlayerTakeItem(cid,9971,cfg.price*5) doPlayerAddItem(cid,2160,2) setPlayerStorageValue(cid,2357,2) npcHandler:say('Foi um prazer negociar com você!', cid) else npcHandler:say('Volte quando tiver os {'.. cfg.price*5 ..' gold\'s ingot\'s}', cid) end elseif(msgcontains(msg, 'yes') and getPlayerStorageValue(cid,2357) == 2 and talkState[talkUser] == 3) then if getPlayerItemCount(cid, 9971) >= cfg.price*10 then doPlayerTakeItem(cid,9971,cfg.price*10) doPlayerAddItem(cid,2160,3) setPlayerStorageValue(cid,2357,3) npcHandler:say('Foi um prazer negociar com você!', cid) else npcHandler:say('Volte quando tiver os {'.. cfg.price*10 ..' gold\'s ingot\'s}', cid) end elseif(msgcontains(msg, 'yes') and getPlayerStorageValue(cid,2357) == 3 and talkState[talkUser] == 4) then if getPlayerItemCount(cid, 9971) >= cfg.price*15 then doPlayerTakeItem(cid,9971,cfg.price*15) doPlayerAddItem(cid,2160,4) setPlayerStorageValue(cid,2357,4) npcHandler:say('Foi um prazer negociar com você!', cid) else npcHandler:say('Volte quando tiver os {'.. cfg.price*15 ..' gold\'s ingot\'s}', cid) end elseif(msgcontains(msg, 'yes') and getPlayerStorageValue(cid,2357) == 4 and talkState[talkUser] == 5) then if getPlayerItemCount(cid, 9971) >= cfg.price*20 then doPlayerTakeItem(cid,9971,cfg.price*20) doPlayerAddItem(cid,2160,5) setPlayerStorageValue(cid,2357,5) npcHandler:say('Foi um prazer negociar com você!', cid) else npcHandler:say('Volte quando tiver os {'.. cfg.price*20 ..' gold\'s ingot\'s}', cid) end elseif(msgcontains(msg, 'yes') and getPlayerStorageValue(cid,2357) == 5 and talkState[talkUser] == 6) then if getPlayerItemCount(cid, 9971) >= cfg.price*30 then doPlayerTakeItem(cid,9971,cfg.price*30) doPlayerAddItem(cid,2160,6) setPlayerStorageValue(cid,2357,6) npcHandler:say('Foi um prazer negociar com você!', cid) else npcHandler:say('Volte quando tiver os {'.. cfg.price*30 ..' gold\'s ingot\'s}', cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Dezembro 23, 2018 6 anos por Roy (veja o histórico de edições)
Postado Dezembro 23, 2018 6 anos Autor é o msm item só q, quero quantidade, o gold ingot no meu servidor é uma moeda depois do crystal coins, então quero basear os itens nela, um item por 100 gold ingot, outro por 1000, quero q eu mesmo estabeleça a quantidade, pq por crystal coins o ot, tem um limite pra vender no npc.. só da pra colocar 1 bilhão.... 1 minuto atrás, Roy disse: Mas tipo é com sequência de item certo? Compra um, a partir dai só compra o segundo se estiver comprado o primeiro?
Postado Dezembro 23, 2018 6 anos @BilauX no fórum existe inúmeros tópicos sobre npc que venda items por outro items, nesse caso esse outro item você define para sua moeda.
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.