DanteWakenin 0 #1 Postado 1 Julho, 2011 (editado) ---------- Troca Casino e BOXs Casino by Dante ----------- Vi que muitos ots não tinha o npc que trocava pokemons por casino coin então eu criei um do meu jeito primera parte o npc - atençao voce tem que configurar os item que ele vai dar. Vá em data>npc>script e copie um arquivo lua > renomeie para casinotroca > coloque isso dentro 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 -- Conversa Jogador/NPC if(msgcontains(msg, 'list')) then selfSay('Eu vendo {Porygon Card}, {Ditto Card}, {Eevee Card}, {Mime Card}.Por Casino Coin', cid) elseif(msgcontains(msg, 'porygon card')) then selfSay('Voc\ê quer comprar Porygon Card por 1000 Casino coins?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'ditto card')) then selfSay('Voc\ê quer comprar Ditto Card por 1000 Casino coins?', cid) talkState[talkUser] = 2 elseif(msgcontains(msg, 'eevee card') )then selfSay('Voc\ê quer comprar eevee card por 1000 Casino coins?', cid) talkState[talkUser] = 3 elseif(msgcontains(msg, 'mime card')) then selfSay('Voc\ê quer comprar mime card por 1000 Casino coins?', cid) talkState[talkUser] = 4 -- Confirmação da Compra elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(doPlayerRemoveItem(cid, 2159, 1000) == true) then selfSay('Obrigado por comprar!', cid) doPlayerAddItem(cid, 2554, 1) talkState[talkUser] = 0 else selfSay('Voc\ê n\ão tem 1000 Casino coins', cid) talkState[talkUser] = 0 end elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then if(doPlayerRemoveItem(cid, 2159, 1000) == true) then selfSay('Obrigado por comprar!', cid) doPlayerAddItem(cid, 2553, 1) talkState[talkUser] = 0 else selfSay('Voc\ê n\ão tem 1000 Casino coins', cid) talkState[talkUser] = 0 end elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then if(doPlayerRemoveItem(cid, 2159, 1000) == true) then selfSay('Obrigado por comprar!', cid) doPlayerAddItem(cid, 2551, 1) talkState[talkUser] = 0 else selfSay('Voc\ê n\ão tem 1000 Casino coins', cid) talkState[talkUser] = 0 end elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then if(doPlayerRemoveItem(cid, 2159, 1000) == true) then selfSay('Obrigado por comprar!', cid) doPlayerAddItem(cid, 2552, 1) talkState[talkUser] = 0 else selfSay('Voc\ê n\ão tem 1000 Casino coins', cid) talkState[talkUser] = 0 end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Agora vai na pasta npc de copie um arquivo qualquer e cole isso dentro e renomeie para marlon <?xml version="1.0" encoding="UTF-8"?> <npc name="Marlon" script="casinotroca.lua" walkinterval="350000" floorchange="0" speed="0"> <health now="150" max="150"/> <look type="259" head="78" body="114" legs="0" feet="0"/> <parameters> <parameter key="message_greet" value="Ola! Eu troco casino coins!"/> <parameter key="message_farewell" value="Good bye!"/> <parameter key="message_idletimeout" value="Good bye!"/> <parameter key="message_walkaway" value="Good bye!"/> </parameters> </npc> ---------- Primeira parte feita agora são as boxs dos pokemon do casino que fica no data>action>script BOX eevee: function onUse(cid, item, frompos, item2, topos) if getPlayerLevel(cid) >= 35 and getPlayerFreeCap(cid) ~= 0 then if doPlayerRemoveItem(cid,2551,1) == TRUE then doPlayerSendTextMessage(cid,22,"Você ganhou um Eevee.") local health = 350 -- Health do poke local maxhealth = 350 -- Maximo de health do poke local description = "Contains a Eevee." local poke1 = "This is Eevee's pokeball. HP = ["..health.."/"..maxhealth.."]" item = doCreateItemEx(2219) doItemSetAttribute(item, "poke", poke1) doItemSetAttribute(item, "nome", "Eevee") doItemSetAttribute(item, "description", description) doPlayerAddItemEx(cid, item, true) doTransformItem(item, 2222) doSendMagicEffect(getCreaturePosition(cid), 28) else doPlayerSendTextMessage(cid,22,"..") end else doPlayerSendCancel(cid,'Somente jogadores level 35+ para abrir este presente.') end return 1 end -------------- BOX porygon: function onUse(cid, item, frompos, item2, topos) if getPlayerLevel(cid) >= 35 and getPlayerFreeCap(cid) ~= 0 then if doPlayerRemoveItem(cid,2554,1) == TRUE then doPlayerSendTextMessage(cid,22,"Você ganhou um Porygon.") local health = 350 -- Health do poke local maxhealth = 350 -- Maximo de health do poke local description = "Contains a Porygon." local poke1 = "This is Porygon's pokeball. HP = ["..health.."/"..maxhealth.."]" item = doCreateItemEx(2219) doItemSetAttribute(item, "poke", poke1) doItemSetAttribute(item, "nome", "Porygon") doItemSetAttribute(item, "description", description) doPlayerAddItemEx(cid, item, true) doTransformItem(item, 2222) doSendMagicEffect(getCreaturePosition(cid), 28) else doPlayerSendTextMessage(cid,22,"..") end else doPlayerSendCancel(cid,'Somente jogadores level 35+ para abrir este presente.') end return 1 end ---------------- BOX Mime . Atenção esse script provavelmente vai ter que editar porque em muitos ot o mr.mime não pega então no meu eu mudei o nome dele pra mime dai você tem que trocar os Mime desse script para o nome do seu Mr.Mime function onUse(cid, item, frompos, item2, topos) if getPlayerLevel(cid) >= 35 and getPlayerFreeCap(cid) ~= 0 then if doPlayerRemoveItem(cid,2552,1) == TRUE then doPlayerSendTextMessage(cid,22,"Você ganhou um Mime.") local health = 350 -- Health do poke local maxhealth = 350 -- Maximo de health do poke local description = "Contains a Mime." local poke1 = "This is Mime's pokeball. HP = ["..health.."/"..maxhealth.."]" item = doCreateItemEx(2219) doItemSetAttribute(item, "poke", poke1) doItemSetAttribute(item, "nome", "Mime") doItemSetAttribute(item, "description", description) doPlayerAddItemEx(cid, item, true) doTransformItem(item, 2222) doSendMagicEffect(getCreaturePosition(cid), 28) else doPlayerSendTextMessage(cid,22,"..") end else doPlayerSendCancel(cid,'Somente jogadores level 35+ para abrir este presente.') end return 1 end ------------- BOX ditto: function onUse(cid, item, frompos, item2, topos) if getPlayerLevel(cid) >= 35 and getPlayerFreeCap(cid) ~= 0 then if doPlayerRemoveItem(cid,2553,1) == TRUE then doPlayerSendTextMessage(cid,22,"Você ganhou um Ditto.") local health = 350 -- Health do poke local maxhealth = 350 -- Maximo de health do poke local description = "Contains a Ditto." local poke1 = "This is Ditto's pokeball. HP = ["..health.."/"..maxhealth.."]" item = doCreateItemEx(2219) doItemSetAttribute(item, "poke", poke1) doItemSetAttribute(item, "nome", "Ditto") doItemSetAttribute(item, "description", description) doPlayerAddItemEx(cid, item, true) doTransformItem(item, 2222) doSendMagicEffect(getCreaturePosition(cid), 28) else doPlayerSendTextMessage(cid,22,"..") end else doPlayerSendCancel(cid,'Somente jogadores level 35+ para abrir este presente.') end return 1 end --------------- OBS: Nos scripts. if(doPlayerRemoveItem(cid, 2159, 1000) == true) then ----2159 e o id do casino coin que ele vai remover e 1000 e a quantidade que e editável também doPlayerAddItem(cid, 2554, 1) ---- 2554 e o id da box e 1 e a quantidade de box que ele vai dar - atenção que em cada parte em tem um id de box ------------- OBS2: No item.xml No meu ot eu editei os ids que ia por no npc certinho para chamar porygon card,eevee card,mime card e ditto card então no seu item.xml vai escolher os item que vai ser como box e reconfigurar os ids que eu já expliquei acima ----------- TAGS: Action.xml BOX eevee: <action itemid="2551" event="script" value="boxeevee.lua"/> BOX porygon: <action itemid="2554" event="script" value="boxporygon.lua"/> BOX mime: <action itemid="2552" event="script" value="boxmime.lua"/> BOX ditto: <action itemid="2553" event="script" value="boxditto.lua"/> Cada arquivo de box tem que renomear para os que ta na tag Editado 2 Julho, 2011 por DanteWakenin Compartilhar este post Link para o post
iuniX 4 #2 Postado 3 Julho, 2011 Não sou muito fã de NPCS feitos por Jiddo, ele desvaloriza bastante o NPC. Mas parabéns e obrigado pela contribuição. Avaliação: C Código: 55Utilidade: 45 Criatividade: 30 Média: 46.25 Pontos MIS: 15 Compartilhar este post Link para o post
Geovani 0 #3 Postado 3 Julho, 2011 coloquei ele aqui no meu ot qualquer o parametro para trocar as coins ?trade? ja tentei não deu ;s Compartilhar este post Link para o post
DanteWakenin 0 #4 Postado 3 Julho, 2011 E só fazer do jeito que ta em cima que vai dar certo Compartilhar este post Link para o post
Soul Reaper 0 #5 Postado 23 Outubro, 2011 # gostei, aqui no meu OT testei e funcionou.. Compartilhar este post Link para o post
iuniX 4 #6 Postado 23 Outubro, 2011 # gostei, aqui no meu OT testei e funcionou.. Evite reviver tópicos. Aviso verbal dado, no proximo serei obrigado a te reportar. Compartilhar este post Link para o post