Guimmd2 0 Postado Junho 27, 2010 Share Postado Junho 27, 2010 (editado) Olá! Eu estou precisando de um script de Pokeball. Mas ai uns vem falar: já tem no forum. Mas a questão é a seguinte: os scripts de Pokeball que achei, o monstro tem que estar vivo para capturar, ou seja, tem que estar com vida 1, 100, 1000, etc, mas nunca no 0 (corpse). E o pedido é esse: Quero um script que você lance a pokeball no corpse do monstro (morto), como no Pokemon Online. E que tenha uma chance grande da ball quebrar e chance baixa de capturar. Server TFS Versão 8.11 Exemplo: PS: Se não for pedir de mais, também quero o script da Great Ball (chance 2x), Super Ball (chance 3x) e Ultra Ball (chance 4x), ou pelo menos me informar aonde eu posso configurar a porcentagem de chance de captura. :smile_positivo: Editado Junho 27, 2010 por Guimmd2 Link para o comentário Compartilhar em outros sites More sharing options...
matheus1000 11 Postado Junho 27, 2010 Share Postado Junho 27, 2010 data/lib/functions bote isso: _warpzone = 2147483648 -- start storing strings here (THIS IS THE ABSOLUTE MAXIMUM VALUE FOR THIS)_maxlength = 1024 -- multiply by 3 to get the true length. setPlayerStorageInteger = setPlayerStorageValue getPlayerStorageInteger = getPlayerStorageValue function setPlayerStorageString(cid, key, value) if #value > (_maxlength-1) * 3 - 1 then -- Last word is reserved for 0 termination of the string. error("Storage string is too long") end if key > _warpzone / _maxlength then error("Storage string key is too large (" .. key .. ")") end key = _warpzone + key * _maxlength local word = 0 local wordwrap = 0 local wordcount = 0 local i = 1 while i <= #value do local byte = string.byte(string.sub(value, i, i)) word = bit.bor(word, bit.lshift(byte, wordwrap)) wordwrap = wordwrap + 8 if wordwrap == 24 then --[[ In the ideal world we would be able to store 4 characters per word, however, as the default return value for getPlayerStorageValue is -1, we cant use the last bit. ]]-- setPlayerStorageInteger(cid, key + wordcount, word) word = 0 wordwrap = 0 wordcount = wordcount + 1 end i = i + 1 end -- store the last word setPlayerStorageInteger(cid, key + wordcount, word) end function getPlayerStorageString(cid, key) if key > _warpzone / _maxlength then error("Storage string key is too large (" .. key .. ")") end key = _warpzone + key * _maxlength local wordcount = 0 local str = "" while true do if wordcount >= _maxlength then break end local word = getPlayerStorageInteger(cid, key + wordcount) if word == -1 then -- end of string break else -- Extract the 3 characters from the value byte = bit.band(word, 255) if byte == 0 then break else str = str .. string.char(byte) end byte = bit.rshift(bit.band(word, 65280), 8) if byte == 0 then break else str = str .. string.char(byte) end byte = bit.rshift(bit.band(word, 16711680), 16) if byte == 0 then break else str = str .. string.char(byte) end end wordcount = wordcount + 1 end return str end E isso: function doConvinceSummon(cid, creature, amount, pos)summonplayerpos = {x=pos.x, y=pos.y, z=pos.z, stackpos=253} summonplayer = getThingfromPos(summonplayerpos) if(summonplayer ~= nil and summonplayer.itemid > 0) then doPlayerSendCancel(cid,"There is not enough room to summon here.") ret = 0 else convince = doSummonCreature(creature, pos) doConvinceCreature(cid, convince) ret = 1 end return ret end data/actions e crie um arquivo chamado Pokebola.lua e bote isso: local notAllowed = {"Ferumbras", "Demon"}local storage = { status = 25650, pokeName = 25651 } local actionid_used = 7510 function onUse(cid, item, fromPos, item2, toPos) local pokeballStatus = getPlayerStorageValue(cid, storage.status) local pokeName = getPlayerStorageString(cid, storage.pokeName) pos = getPlayerPosition(cid) pos.stackpos = 0 if pokeballStatus == -1 then toPos.stackpos = 253 local pokeThing = getThingfromPos(toPos) if isCreature(pokeThing.uid) == TRUE then if isPlayer(pokeThing.uid) == FALSE then local pokename_ = getCreatureName(pokeThing.uid) if item.actionid ~= actionid_used then -- local maxHealth = 400 -- local creatureHealth = getCreatureHealth(pokeThing.uid) -- local divNum = (string.len(maxHealth)-1)^2 -- local result = math.floor((creatureHealth/divNum)/10) -- local chance = math.random(1, math.random(4, math.random(7, math.max(result, 7)))) -- if chance == result then if isInTable(notAllowed, pokename_) == TRUE then doPlayerSendCancel(cid, "You cannot catch this creature") else setPlayerStorageString(cid, storage.pokeName, pokename_) doRemoveCreature(pokeThing.uid) doSendDistanceShoot(fromPos, toPos, 37) setPlayerStorageValue(cid, storage.status, 1) doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".") doSetItemActionId(item.uid, actionid_used) end -- else -- doSendMagicEffect(fromPos, 2) -- doPlayerSendCancel(cid, "The Pokemom Escaped") -- end elseif item.actionid == actionid_used and pokename_ == pokeName then doPlayerSay(cid, pokeName .. " Back!!", TALKTYPE_SAY) doRemoveCreature(pokeThing.uid) doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".") setPlayerStorageValue(cid, storage.status, 1) doSendDistanceShoot(fromPos, toPos, 37) else doSendMagicEffect(fromPos, 2) doPlayerSendCancel(cid, "This pokeball is already used") end else doPlayerSendCancel(cid, "You cannot catch this creature") end else doPlayerSendCancel(cid, "Creature not found") end elseif pokeballStatus == 1 then summons = getCreatureSummons(cid) -- if #summons >= 2 then -- doPlayerSendCancel(cid, "You cannot call more pokemons") -- else doConvinceSummon(cid, pokeName, 0, toPos) doSendDistanceShoot(fromPos, toPos, 37) doPlayerSay(cid, pokeName .. " Go!!", TALKTYPE_SAY) setPlayerStorageValue(cid, storage.status, -1) doSetItemSpecialDescription(item.uid, "it is empty.") -- end end else return 1 end function isInTable(t, val) for _, v in pairs(t) do if v == val then return TRUE end end return LUA_ERROR end data/actions/actions.xml <action itemid="xxxx" script="pokebola.lua" allowfaruse="1" blockwalls="1" /> Link para o comentário Compartilhar em outros sites More sharing options...
Guimmd2 0 Postado Junho 27, 2010 Autor Share Postado Junho 27, 2010 (editado) Cara, eu já testei esse script, esse ai o monstro tem que estar vivo, eu quero um script que jogue a Pokeball NO CORPO DO MONSTRO. Se esse script tem como jogar no corpo do monstro, me mostre em que parte do script fica o IDs dos corpses. E também quero saber onde configura a chance de captura. Editado Junho 27, 2010 por Guimmd2 Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados