Postado Outubro 13, 2017 7 anos Bem queria uma script de Box que desse um Poke Random com a chance de cada Poke configurável, ja tenho uma que faz isso com item mais não consegui adaptar.Se alguém Puder da uma ajudinha agradeço muito :D Script Da Box Que ja Tenho Que Da Item: Spoiler local config = {storage = 559761,hours = 1} local items = { --[numeração] = {id = ID DO ITEM, count = QUANTIDADE DO ITEM, c = CHANCE} [1]={id=2160, count=100, c=60}, -- item 1 [2]={id=14215, count=7, c=20}, -- item 2 [3]={id=14214, count=100, c=60}, -- item 3 [4]={id=14188, count=1, c=60}, -- item 4 [5]={id=14186, count=1, c=50}, -- item 5 [6]={id=14185, count=1, c=35}, -- item 6 [7]={id=12618, count=8, c=60}, -- item 7 [8]={id=12323, count=1, c=60}, -- item 8 [9]={id=14241, count=1, c=40}, -- item 9 [10]={id=2392, count=100, c=60}, -- item 10 } function getRandomItem(t) local i = math.random(1, #t) i = t if math.random(1, 100) <= i.c then return i end return getRandomItem(t) end function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) >= 225 then if getPlayerStorageValue(cid,config.storage) >= os.time() then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas voce deve aguardar ate "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,config.storage)).." para pegar seu presente novamente!") end local i = getRandomItem(items) setPlayerStorageValue(cid, config.storage, os.time()+config.hours*3600) doPlayerAddItem(cid, i.id, i.count) doSendAnimatedText(getPlayerPosition(cid), "Box!", TEXTCOLOR_GREEN) doPlayerSendTextMessage(cid, 27, "Você abriu uma Box e Ganhou "..i.count.."x "..getItemNameById(i.id)..(i.count > 1 and "s" or "")..".") else doPlayerSendCancel(cid,'So Level 225+ Pode Pegar') end return true end Exemplo de Box De Poke: Spoiler local a = { [12313] = {pokemons = {"Tyranitar", "Aggron", "Rhyperior", "Steelix", "Shiny Onix", "Shiny Larvitar", "Metagross","Tyranitar", "Aggron", "Rhyperior", "Steelix", "Metagross", "Metagross","Tyranitar", "Aggron", "Rhyperior", "Steelix", "Metagross", "Metagross","Tyranitar", "Aggron", "Rhyperior", "Steelix", "Metagross", "Metagross","Tyranitar", "Aggron", "Rhyperior", "Steelix", "Metagross", "Metagross","Tyranitar", "Aggron", "Rhyperior", "Steelix", "Metagross"}} } local happy = 1000 function onUse(cid, item, frompos, item2, topos) local b = a[item.itemid] if not b then return true end local pokemon = b.pokemons[math.random(#b.pokemons)] if not pokes[pokemon] then return true end doPlayerSendTextMessage(cid, 27, "You opened a pokemon prize box +"..item.itemid - (11637).."!") doPlayerSendTextMessage(cid, 27, "The prize pokemon was a "..pokemon..", congratulations!") doSendMagicEffect(getThingPos(cid), 29) addPokeToPlayer(cid, pokemon, 20, nil, btype) --alterado v1.9 doRemoveItem(item.uid, 1) if useOTClient then doCreatureExecuteTalkAction(cid, "/salvar") end return true end
Postado Outubro 13, 2017 7 anos @port16 Seu sv tem essa função? addPokeToPlayer Se não tiver, qual função no seu sv que dá poke pro player?
Postado Outubro 13, 2017 7 anos Autor 1 hora atrás, antharaz disse: @port16 Seu sv tem essa função? addPokeToPlayer Se não tiver, qual função no seu sv que dá poke pro player? Tem sim
Postado Outubro 13, 2017 7 anos Spoiler local config = { storage = 559761, --storage usada exaust = 1, --exaust em horas pokes = { {pokemon="Rat", c=90}, --{id = ID DO ITEM, c = CHANCE} {pokemon="Rotworm", c=90}, {pokemon="Dog", c=90} }, lvl_min = 200 --level minimo para usar } function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) < config.lvl_min then return doPlayerSendCancel(cid,'Somente Level '..config.lvl_min..'+ Pode Pegar') elseif getPlayerStorageValue(cid,config.storage) > os.time() then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas voce deve aguardar ate "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,config.storage)).." para pegar seu presente novamente!") end setPlayerStorageValue(cid, config.storage, os.time()+config.exaust*3600) local poke = config.pokes[math.random(1,#config.pokes)] print(poke.c) if math.random(1,100) > poke.c then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas voce não obteve sucesso ao pegar seu presente!") end addPokeToPlayer(cid, poke.pokemon, 20, nil, btype) doSendAnimatedText(getPlayerPosition(cid), "Box!", TEXTCOLOR_GREEN) doPlayerSendTextMessage(cid, 27, "Você abriu uma Box e Ganhou um "..poke.pokemon..".") return true end
Postado Outubro 13, 2017 7 anos Autor 14 minutos atrás, antharaz disse: Ocultar conteúdo local config = { storage = 559761, --storage usada exaust = 1, --exaust em horas pokes = { {pokemon="Rat", c=90}, --{id = ID DO ITEM, c = CHANCE} {pokemon="Rotworm", c=90}, {pokemon="Dog", c=90} }, lvl_min = 200 --level minimo para usar } function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) < config.lvl_min then return doPlayerSendCancel(cid,'Somente Level '..config.lvl_min..'+ Pode Pegar') elseif getPlayerStorageValue(cid,config.storage) > os.time() then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas voce deve aguardar ate "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,config.storage)).." para pegar seu presente novamente!") end setPlayerStorageValue(cid, config.storage, os.time()+config.exaust*3600) local poke = config.pokes[math.random(1,#config.pokes)] print(poke.c) if math.random(1,100) > poke.c then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, mas voce não obteve sucesso ao pegar seu presente!") end addPokeToPlayer(cid, poke.pokemon, 20, nil, btype) doSendAnimatedText(getPlayerPosition(cid), "Box!", TEXTCOLOR_GREEN) doPlayerSendTextMessage(cid, 27, "Você abriu uma Box e Ganhou um "..poke.pokemon..".") return true end Vllw man funcionou, mas teria como fazer pro player sempre conseguir algum pokemon ?
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.