SmiX 265 Postado Agosto 11, 2012 Share Postado Agosto 11, 2012 Olá galera, hoje vou postar mais um script para pokemon dash advanced. Bem legal e acho que também é um dos mais procurados... Vamos a ele. Nome: Duel System por Action O que faz? Faz com que dois players duelem com limites de pokemons, escolhido no inicio das configurações da batalha. Primeiro vamos à actions/scripts e criaremos um arquivo chamado duelSystem.lua e dentro vamos colar o código abaixo: function onUse(cid, item, fromPos, item2, toPos) if isPlayer(item2.uid) then doPlayerSetVocation(cid, 51) openChannelDialog(cid) doPlayerSendTextMessage(item2.uid, 27, ""..getCreatureName(cid)..", are is invited you fot duel. You accept?") setPlayerStorageValue(item2.uid, 5489, 1) end return true end Agora vamos a tag, em actions.XML cole a seguinte tag: <action itemid="id do item que vai o player vai usar para o duel" event="script" value="duelSystem.lua"/> Pronto. Vamos a pasta xml/channels.xml e crie as seguintes janelas: <channel id="id decorrente da sua channel" name="1 Pokemon"> <vocation id="51"/> </channel> <channel id=" id decorrente da sua channel " name="2 Pokemons"> <vocation id="51"/> </channel> <channel id=" id decorrente da sua channel " name="3 Pokemons"> <vocation id="51"/> </channel> <channel id=" id decorrente da sua channel " name="4 Pokemons"> <vocation id="51"/> </channel> <channel id=" id decorrente da sua channel " name="5 Pokemons"> <vocation id="51"/> </channel> <channel id=" id decorrente da sua channel " name="6 Pokemons"> <vocation id="51"/> </channel> Depois disso, não mude mais nada. Vamos agora em vocations.xml e vamos colar a seguinte tag dentro: <vocation id="51" name="Duel" description="pokemon trainer" needpremium="0" gaincap="0" gainhp="55" gainmana="0" gainhpticks="0" gainhpamount="0" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1" lessloss="0"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="2" club="2" sword="2" axe="2" distance="2" shielding="2" fishing="2" experience="1.1"/> </vocation> Obs: Não mude nada nela... Feito isso, vamos a pasta creaturescripts/scripts e vamos criar um arquivo chamado duelSystemChannel.lua e colaremos o código a seguir dentro: local config = { channelId1 = 13, -- Aqui você coloca-ra o id da sua primeira channel. A qual está escrito "1 Pokemon". channelId2 = 14, -- Aqui você coloca-rá o id da sua 2° channel. A qual está escrito "2 Pokemons". channelId3 = 15, -- Aqui você coloca-rá o id da sua 3° channel. A qual está escrito "3 Pokemons". channelId4 = 16, -- Aqui você coloca-rá o id da sua 4° channel. A qual está escrito "4 Pokemons". channelId5 = 17, -- Aqui você coloca-rá o id da sua 5° channel. A qual está escrito "5 Pokemons". channelId6 = 18, -- Aqui você coloca-rá o id da sua 6° channel. A qual está escrito "6 Pokemons". } function onJoinChannel(cid, channelId, users, isTv) if getPlayerVocation(cid) == 51 then else return true end if channelId == config.channelId1 then setPlayerStorageValue(cid, 12541, 0) setPlayerStorageValue(cid, 12542, 1) setGlobalStorageValue(12542, 1) doSendAnimatedText(getThingPos(cid), "1 Poke", 28) doPlayerSetVocation(cid, 1) return false elseif channelId == config.channelId2 then setPlayerStorageValue(cid, 12541, 0) setPlayerStorageValue(cid, 12542, 1) setGlobalStorageValue(12542, 2) doSendAnimatedText(getThingPos(cid), "2 Pokes", 28) doPlayerSetVocation(cid, 1) return false elseif channelId == config.channelId3 then setPlayerStorageValue(cid, 12541, 0) setPlayerStorageValue(cid, 12542, 1) setGlobalStorageValue(12542, 3) doSendAnimatedText(getThingPos(cid), "3 Pokes", 28) doPlayerSetVocation(cid, 1) return false elseif channelId == config.channelId4 then setPlayerStorageValue(cid, 12541, 0) setPlayerStorageValue(cid, 12542, 1) setGlobalStorageValue(12542, 4) doSendAnimatedText(getThingPos(cid), "4 Pokes", 28) doPlayerSetVocation(cid, 1) return false elseif channelId == config.channelId5 then setPlayerStorageValue(cid, 12541, 0) setPlayerStorageValue(cid, 12542, 1) setGlobalStorageValue(12542, 5) doSendAnimatedText(getThingPos(cid), "5 Pokes", 28) doPlayerSetVocation(cid, 1) return false elseif channelId == config.channelId6 then setPlayerStorageValue(cid, 12541, 0) setPlayerStorageValue(cid, 12542, 1) setGlobalStorageValue(12542, 6) doSendAnimatedText(getThingPos(cid), "6 Pokes", 28) doPlayerSetVocation(cid, 1) return false end return true end Agora vamos colocar duas tags, uma em login.lua e a outra em creaturescripts.xml: CreatureScript.xml: <event type="joinchannel" name="DuelSystemChannel" event="script" value="duelSystemChannel.lua"/> Login.lua registerCreatureEvent(cid, "DuelSystemChannel") Feito isso, vamos a talkactions/scripts e criaremos um arquivo chamado acceptDuel.lua e dentro cole o código abaixo: function onSay(cid, words, param, channel) if getPlayerStorageValue(cid, 5489) >= 1 then setPlayerStorageValue(cid, 12541, 0) setPlayerStorageValue(cid, 6598755, 1) doSendAnimatedText(getThingPos(cid), "BATTLE", math.random(20, 60)) for _, sid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(sid, 12542) >= 1 then setPlayerStorageValue(sid, 6598754, 1) doSendAnimatedText(getThingPos(sid), "BATTLE", math.random(20, 60)) end end setGlobalStorageValue(1203, 1) else return false end end Agora vamos á talkactions.XML e colaremos as tag a seguir: <talkaction words="yes" event="script" value="duel.lua"/> <talkaction words="sim" event="script" value="duel.lua"/> Agora vamos em lib/ e criaremos um arquivo chamado duelLibSystem.lua e colaremos o seguinte código dentro: function checkPokeballsInDuel(cid) if getGlobalStorageValue(1203) >= 1 and getPlayerStorageValue(cid, 12541) >= getGlobalStorageValue(12542) then doSendAnimatedText(getThingPos(cid), "LOOSES", 118) setPlayerStorageValue(cid, 12541, 0) setPlayerStorageValue(cid, 6598755, 0) setPlayerStorageValue(cid, 6598754, 0) setGlobalStorageValue(1203, 0) for _, sid in ipairs(getPlayersOnline())do if getPlayerStorageValue(sid, 12541) < 7 and getPlayerStorageValue(sid, 6598754) >= 1 or getPlayerStorageValue(sid, 12541) < 7 and getPlayerStorageValue(sid, 6598755) >= 1 then doSendAnimatedText(getThingPos(sid), "WINS", 118) setPlayerStorageValue(sid, 12541, 0) setPlayerStorageValue(sid, 6598755, 0) setPlayerStorageValue(sid, 6598754, 0) end end end if getGlobalStorageValue(1203) >= 1 and getPlayerStorageValue(cid, 12541) <= getGlobalStorageValue(12542) then setPlayerStorageValue(cid, 12541, getPlayerStorageValue(cid, 12541) +1) doSendAnimatedText(getThingPos(cid), "POKEIN", 28) end end function doBackPokeballsInDuel(cid) if getGlobalStorageValue(1203) >= 1 and getPlayerStorageValue(cid, 12541) >= 0 then doSendAnimatedText(getThingPos(cid), "POKEOUT", 118) end end Vamos para actions/scripts/goback.lua e vamos procurar por está linha: if item.itemid == usando then Abaixo disso cole isso: doBackPokeballsInDuel(cid) Aindan no mesmo script procure por: elseif item.itemid == pokeballs[btype].on then E abaixo dele cole isso: checkPokeballsInDuel(cid) Vamos agora em creaturescripts/scripts/goback.lua e antes do utimo apague tudo e cole isto dentro: function onLogout(cid) if getPlayerStorageValue(cid, 1460) >= 1 then doPlayerSendCancel(cid, "Sorry, you are in tournament.") return TRUE end local thisitem = getPlayerSlotItem(cid, 8) local pokeballl = getPlayerSlotItem(cid, 8) if thisitem.uid <= 0 then return true end local ballName = getItemAttribute(thisitem.uid, "poke") -------------------------------------------------------- btype = getPokeballType(thisitem.itemid) --------------------------------------------------------------- if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 637501) >= 1 then BackTeam(cid, getCreatureSummons(cid), effect) --edited team scyther end ------------------------------------------------------------------- local summon = getCreatureSummons(cid)[1] if #getCreatureSummons(cid) == 1 and thisitem.uid > 1 then doItemSetAttribute(thisitem.uid, "hp", getPlayerStorageValue(cid, 212120) / getPlayerStorageValue(cid, 212121)) doTransformItem(thisitem.uid, pokeballs[btype].on) doSendMagicEffect(getThingPos(summon), pokeballs[btype].effect) doRemoveCreature(summon) end if getCreatureOutfit(cid).lookType == 814 then doPlayerStopWatching(cid) end if getPlayerStorageValue(cid, 17000) >= 1 then markFlyingPos(cid, getThingPos(cid)) end if getPlayerStorageValue(cid, 22545) == 1 then --Edited golden arena setGlobalStorageValue(22550, getGlobalStorageValue(22550)-1) setPlayerStorageValue(cid, 22545, -1) end return TRUE end local deathtexts = {"Oh no! POKENAME, come back!", "Come back, POKENAME!", "That's enough, POKENAME!", "You did well, POKENAME!", "You need to rest, POKENAME!", "Nice job, POKENAME!", "POKENAME, you are too hurt!"} function onDeath(cid, deathList) local owner = getCreatureMaster(cid) local thisball = getPlayerSlotItem(owner, 8) local ballName = getItemAttribute(thisball.uid, "poke") if getPlayerStorageValue(cid, 212124) >= 1 then return true end btype = getPokeballType(thisball.itemid) doSendMagicEffect(getThingPos(cid), pokeballs[btype].effect) doTransformItem(thisball.uid, pokeballs[btype].off) doItemSetAttribute(thisball.uid, "morta", "yes") doPlayerSendTextMessage(owner, 22, "Your pokemon fainted.") local say = deathtexts[math.random(#deathtexts)] say = string.gsub(say, "POKENAME", getCreatureName(cid)) if getPlayerStorageValue(cid, 33) <= 0 then doCreatureSay(owner, say, TALKTYPE_SAY) end doItemSetAttribute(thisball.uid, "hp", 0) doItemSetAttribute(thisball.uid, "happy", getPlayerStorageValue(cid, 1008) - happyLostOnDeath) doItemSetAttribute(thisball.uid, "hunger", getPlayerStorageValue(cid, 1009)) doRemoveCreature(cid) if getGlobalStorageValue(1203) >= 1 and getPlayerStorageValue(owner, 12541) <= getGlobalStorageValue(12542) then doSendAnimatedText(getThingPos(owner), "POKEOUT", 118) end return false end Obs: O script falta duas funções para funcionar perfeitamente. A primeira é para não deixar o player usar o item em cima dele mesmo. A segunda e para não deixar o player deslogar enquanto está no duel. Tentei e tentei mas não consegui... Caso alguém possa ajudar fico muito grato. Como funciona? Você da use em cima do player que quer batalhar, escolhe quantos pokemons querem usar. O outro player fala (“yes” ou “sim”) e começam a duelar. Eu deixei uma função para deixar um player attackar o outro se ele estiver sem pokemon. Porem não perdera nada se morrer. É isso galera espero que gostem. Lembrando vou atualizar este sistema para melhora-lo. Só deixei ele para teste. Caso gostem termino ele. Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/ Compartilhar em outros sites More sharing options...
Mophz 0 Postado Agosto 11, 2012 Share Postado Agosto 11, 2012 Realmente muito bom SmiX. Tenho apenas duas dúvidas, ele funciona no PDA (Sem Level) do Slicer? Teria como fazer por talkaction em vez de action? Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1314862 Compartilhar em outros sites More sharing options...
SmiX 265 Postado Agosto 11, 2012 Autor Share Postado Agosto 11, 2012 Sim, funciona no PDA. Acho que é melhor por action fiz mais "REAL". Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1314868 Compartilhar em outros sites More sharing options...
Mophz 0 Postado Agosto 11, 2012 Share Postado Agosto 11, 2012 @SmiX, Obrigado por me responder e sobre a questão de fazer por talkaction era apenas uma duvida. Irei utilizar seu sistema com certeza. Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1314875 Compartilhar em outros sites More sharing options...
rDs7008 47 Postado Agosto 11, 2012 Share Postado Agosto 11, 2012 Tô gostando de ver Smix Tá melhorando teus scripts kkk Perto daquele dos Ícones tá bem melhor Muito bom mesmo Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1314883 Compartilhar em outros sites More sharing options...
StyloMaldoso 330 Postado Agosto 11, 2012 Share Postado Agosto 11, 2012 Obrigado por disponibilizar um system bãoo desse, vai ajuda bastante gente !thanks. Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1314893 Compartilhar em outros sites More sharing options...
SmiX 265 Postado Agosto 11, 2012 Autor Share Postado Agosto 11, 2012 @RicardoSohnn Vou aceitar isso como um elogio. Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1314894 Compartilhar em outros sites More sharing options...
LLossavaro 43 Postado Agosto 11, 2012 Share Postado Agosto 11, 2012 @Mophz Funciona em sem level sim cabei de testar. Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1314914 Compartilhar em outros sites More sharing options...
HolyMaN 14 Postado Agosto 12, 2012 Share Postado Agosto 12, 2012 @SmiX, teria como adaptar isso no order por exemplo?? tem como me explicar como faço? Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1315208 Compartilhar em outros sites More sharing options...
rDs7008 47 Postado Agosto 12, 2012 Share Postado Agosto 12, 2012 @smix Foi sim um elogio O que quis dizer é que apenas poderia ter feito o outro sistema lá com bem menos coisas, entende? Mas mesmo assim é uma ótima iniciativa, é dificil ver alguem que posta os sistemas que faz. Rep pra vc Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1315268 Compartilhar em outros sites More sharing options...
vitoorcoorrea 0 Postado Agosto 13, 2012 Share Postado Agosto 13, 2012 @Smix aqui deu os seguintes erros. [Error - LuaScriptInterface::loadFile] cannot open data/actions/scripts/duelSystem.lua: No such file or directory [12/08/2012 20:59:18] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/duelSystem.lua) [12/08/2012 20:59:18] cannot open data/actions/scripts/duelSystem.lua: No such file or directory [12/08/2012 20:59:19] [Error - LuaScriptInterface::loadFile] cannot open data/talkactions/scripts/duel.lua: No such file or directory [12/08/2012 20:59:19] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/duel.lua) [12/08/2012 20:59:19] cannot open data/talkactions/scripts/duel.lua: No such file or directory [12/08/2012 20:59:19] [Error - LuaScriptInterface::loadFile] cannot open data/talkactions/scripts/duel.lua: No such file or directory [12/08/2012 20:59:19] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/duel.lua) [12/08/2012 20:59:19] cannot open data/talkactions/scripts/duel.lua: No such file or directory [12/08/2012 20:59:20] [Error - LuaScriptInterface::loadFile] cannot open data/creaturescripts/scripts/duelSystemChannel.lua: No such file or directory [12/08/2012 20:59:20] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/duelSystemChannel.lua) [12/08/2012 20:59:20] cannot open data/creaturescripts/scripts/duelSystemChannel.lua: No such file or directory [12/08/2012 20:59:20] >> Loading chat channels [12/08/2012 20:59:20] [Warning - Vocations::getVocation] Vocation 51 not found. [12/08/2012 20:59:20] [Warning - Chat::loadFromXml] Wrong vocation id: 51 [12/08/2012 20:59:20] [Warning - Vocations::getVocation] Vocation 51 not found. [12/08/2012 20:59:20] [Warning - Chat::loadFromXml] Wrong vocation id: 51 [12/08/2012 20:59:20] [Warning - Vocations::getVocation] Vocation 51 not found. [12/08/2012 20:59:20] [Warning - Chat::loadFromXml] Wrong vocation id: 51 [12/08/2012 20:59:20] [Warning - Vocations::getVocation] Vocation 51 not found. [12/08/2012 20:59:20] [Warning - Chat::loadFromXml] Wrong vocation id: 51 [12/08/2012 20:59:20] [Warning - Vocations::getVocation] Vocation 51 not found. [12/08/2012 20:59:20] [Warning - Chat::loadFromXml] Wrong vocation id: 51 [12/08/2012 20:59:20] [Warning - Vocations::getVocation] Vocation 51 not found. [12/08/2012 20:59:20] [Warning - Chat::loadFromXml] Wrong vocation id: 51. Help plx Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1315725 Compartilhar em outros sites More sharing options...
HolyMaN 14 Postado Agosto 13, 2012 Share Postado Agosto 13, 2012 (editado) @Sky2, @Smix aqui deu os seguintes erros. [Error - LuaScriptInterface::loadFile] cannot open data/actions/scripts/duelSystem.lua: No such file or directory [12/08/2012 20:59:18] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/duelSystem.lua) [12/08/2012 20:59:18] cannot open data/actions/scripts/duelSystem.lua: No such file or directory [12/08/2012 20:59:19] [Error - LuaScriptInterface::loadFile] cannot open data/talkactions/scripts/duel.lua: No such file or directory [12/08/2012 20:59:19] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/duel.lua) [12/08/2012 20:59:19] cannot open data/talkactions/scripts/duel.lua: No such file or directory [12/08/2012 20:59:19] [Error - LuaScriptInterface::loadFile] cannot open data/talkactions/scripts/duel.lua: No such file or directory [12/08/2012 20:59:19] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/duel.lua) [12/08/2012 20:59:19] cannot open data/talkactions/scripts/duel.lua: No such file or directory [12/08/2012 20:59:20] [Error - LuaScriptInterface::loadFile] cannot open data/creaturescripts/scripts/duelSystemChannel.lua: No such file or directory [12/08/2012 20:59:20] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/duelSystemChannel.lua) [12/08/2012 20:59:20] cannot open data/creaturescripts/scripts/duelSystemChannel.lua: No such file or directory [12/08/2012 20:59:20] >> Loading chat channels [12/08/2012 20:59:20] [Warning - Vocations::getVocation] Vocation 51 not found. [12/08/2012 20:59:20] [Warning - Chat::loadFromXml] Wrong vocation id: 51 [12/08/2012 20:59:20] [Warning - Vocations::getVocation] Vocation 51 not found. [12/08/2012 20:59:20] [Warning - Chat::loadFromXml] Wrong vocation id: 51 [12/08/2012 20:59:20] [Warning - Vocations::getVocation] Vocation 51 not found. [12/08/2012 20:59:20] [Warning - Chat::loadFromXml] Wrong vocation id: 51 [12/08/2012 20:59:20] [Warning - Vocations::getVocation] Vocation 51 not found. [12/08/2012 20:59:20] [Warning - Chat::loadFromXml] Wrong vocation id: 51 [12/08/2012 20:59:20] [Warning - Vocations::getVocation] Vocation 51 not found. [12/08/2012 20:59:20] [Warning - Chat::loadFromXml] Wrong vocation id: 51 [12/08/2012 20:59:20] [Warning - Vocations::getVocation] Vocation 51 not found. [12/08/2012 20:59:20] [Warning - Chat::loadFromXml] Wrong vocation id: 51. Help plx pra arruma 1º erro, vai no talkactions.xml e altera: <talkaction words="yes" case-sensitive="no" hide="yes" event="script" value="duel.lua"/> <talkaction words="sim" case-sensitive="no" hide="yes" event="script" value="duel.lua"/> para: <talkaction words="yes" case-sensitive="no" hide="yes" event="script" value="acceptduel.lua"/> <talkaction words="sim" case-sensitive="no" hide="yes" event="script" value="acceptduel.lua"/> pra arruma o 2º erro, vc pulo uma parte, intaum vai no vocations.xml (dentro da pasta "data/xml") e acrecenta.. <vocation id="51" name="Duel" description="pokemon trainer" needpremium="0" gaincap="0" gainhp="55" gainmana="0" gainhpticks="0" gainhpamount="0" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1" lessloss="0"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="2" club="2" sword="2" axe="2" distance="2" shielding="2" fishing="2" experience="1.1"/> </vocation> @all, consegui coloca no order, mais qual o comando pra cancelar o DUEL?!?! sempre que eu relogo, da duel accept ^^ Editado Agosto 13, 2012 por GOD Gniu Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1315736 Compartilhar em outros sites More sharing options...
Nu77 81 Postado Agosto 13, 2012 Share Postado Agosto 13, 2012 Boa SmiX eu tinha um systema parecido com o seu mais falto terminar, parabens... fico muito bom mesmo. Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1315738 Compartilhar em outros sites More sharing options...
supernetoo 8 Postado Agosto 19, 2012 Share Postado Agosto 19, 2012 @smix, O seu sistema não pegou aqui no meu servidor, uso o PDA by Slicer v1.5 e não pega de geito nenhum, modifiquei tudo aqui, não apresenta erros nem nada, eu estava testando com a sword, mudei a sprite dela e quando dei use with em um char diferente não apareceu nada... Tem como resolver? Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1319555 Compartilhar em outros sites More sharing options...
Raidou 16 Postado Agosto 19, 2012 Share Postado Agosto 19, 2012 Já vi este sistema em alguns ots. Vlw por postar aki. Serve pra 8.54 neh? Link para o comentário https://xtibia.com/forum/topic/191802-duel-system-por-action/#findComment-1319606 Compartilhar em outros sites More sharing options...
Posts Recomendados