Postado Outubro 10, 2022 3 anos local monsters = { [1] = {monstro = "Wolf", chance = 50, time = 10}, --[Ordem numerica] = {nome do monstro = Bulbasaur, chance = chance de aparecer esse monstro} [2] = {monstro = "Wolf Beast", chance = 40, time = 10}, --[Ordem numerica] = {nome do monstro = Bulbasaur, chance = chance de aparecer esse monstro} [3] = {monstro = "Bandit", chance = 80, time = 10} --[Ordem numerica] = {nome do monstro = Bulbasaur, chance = chance de aparecer esse monstro} } local function getRandomMonster(t) local i = math.random(1, #t) i = t[i] if math.random(1, 100) <= i.chance then return i end return getRandomMonster(t) end local chance = 60 -- 60% de chance de sucesso e 40% de falhar local shinys = {"Bandit"} -- adiciona o nome dos pokemons que não deverão sumir aqui. function onStepIn(cid, item, toPosition, fromPosition) if isPlayer(cid) and math.random(1, 100) <= chance and getPlayerStorageValue(cid, 74480) <= os.time() then local tempo = 1 local i = getRandomMonster(monsters) local monstro = doCreateMonster(i.monstro, getCreaturePosition(cid)) setPlayerStorageValue(cid, 74480, i.time*1000 + os.time()) doCreatureSay(monstro, "Um " ..i.monstro.. " Selvagem Apareceu!", TALKTYPE_MONSTER) addEvent(function() if isCreature(monstro) and not isInArray(shinys, i.monstro) then doRemoveCreature(monstro) end end, tempo*60*1000) end return true end
Postado Outubro 10, 2022 3 anos Autor 5 minutos atrás, hiquezerah disse: local monsters = { [1] = {monstro = "Wolf", chance = 50, time = 10}, --[Ordem numerica] = {nome do monstro = Bulbasaur, chance = chance de aparecer esse monstro} [2] = {monstro = "Wolf Beast", chance = 40, time = 10}, --[Ordem numerica] = {nome do monstro = Bulbasaur, chance = chance de aparecer esse monstro} [3] = {monstro = "Bandit", chance = 80, time = 10} --[Ordem numerica] = {nome do monstro = Bulbasaur, chance = chance de aparecer esse monstro} } local function getRandomMonster(t) local i = math.random(1, #t) i = t[i] if math.random(1, 100) <= i.chance then return i end return getRandomMonster(t) end local chance = 60 -- 60% de chance de sucesso e 40% de falhar local shinys = {"Bandit"} -- adiciona o nome dos pokemons que não deverão sumir aqui. function onStepIn(cid, item, toPosition, fromPosition) if isPlayer(cid) and math.random(1, 100) <= chance and getPlayerStorageValue(cid, 74480) <= os.time() then local tempo = 1 local i = getRandomMonster(monsters) local monstro = doCreateMonster(i.monstro, getCreaturePosition(cid)) setPlayerStorageValue(cid, 74480, i.time*1000 + os.time()) doCreatureSay(monstro, "Um " ..i.monstro.. " Selvagem Apareceu!", TALKTYPE_MONSTER) addEvent(function() if isCreature(monstro) and not isInArray(shinys, i.monstro) then doRemoveCreature(monstro) end end, tempo*60*1000) end return true end tu adapta pra esse script aki? Spoiler local monsters = { [1] = {monstro = "Bulbasaur", chance = 50}, --[Ordem numerica] = {nome do monstro = Bulbasaur, chance = chance de aparecer esse monstro} [2] = {monstro = "Ivysaur", chance = 40}, --[Ordem numerica] = {nome do monstro = Bulbasaur, chance = chance de aparecer esse monstro} [3] = {monstro = "Venusaur", chance = 1} --[Ordem numerica] = {nome do monstro = Bulbasaur, chance = chance de aparecer esse monstro} } local function getRandomMonster(t) local i = math.random(1, #t) i = t[i] if math.random(1, 100) <= i.chance then return i end return getRandomMonster(t) end local chance = 60 -- 60% de chance de sucesso e 40% de falhar function onStepIn(cid, item, toPosition, fromPosition) if isPlayer(cid) and math.random(1, 100) <= chance then local tempo = 1 local i = getRandomMonster(monsters) local monstro = doCreateMonster(i.monstro, getCreaturePosition(cid)) doCreatureSay(monstro, "Um " ..i.monstro.. " Selvagem Apareceu!", TALKTYPE_MONSTER) addEvent(function() if isCreature(monstro) then doRemoveCreature(monstro) end end, tempo*60*1000) end return true end
Postado Outubro 10, 2022 3 anos 40 minutos atrás, Aizuuu disse: tu adapta pra esse script aki? Mostrar conteúdo oculto local monsters = { [1] = {monstro = "Bulbasaur", chance = 50}, --[Ordem numerica] = {nome do monstro = Bulbasaur, chance = chance de aparecer esse monstro} [2] = {monstro = "Ivysaur", chance = 40}, --[Ordem numerica] = {nome do monstro = Bulbasaur, chance = chance de aparecer esse monstro} [3] = {monstro = "Venusaur", chance = 1} --[Ordem numerica] = {nome do monstro = Bulbasaur, chance = chance de aparecer esse monstro} } local function getRandomMonster(t) local i = math.random(1, #t) i = t[i] if math.random(1, 100) <= i.chance then return i end return getRandomMonster(t) end local chance = 60 -- 60% de chance de sucesso e 40% de falhar function onStepIn(cid, item, toPosition, fromPosition) if isPlayer(cid) and math.random(1, 100) <= chance then local tempo = 1 local i = getRandomMonster(monsters) local monstro = doCreateMonster(i.monstro, getCreaturePosition(cid)) doCreatureSay(monstro, "Um " ..i.monstro.. " Selvagem Apareceu!", TALKTYPE_MONSTER) addEvent(function() if isCreature(monstro) then doRemoveCreature(monstro) end end, tempo*60*1000) end return true end adaptar oque maninho? você fala do tempo de 10 segundos para ter chance de nascer algum monstro novamente?
Postado Outubro 10, 2022 3 anos Autor 2 minutos atrás, hiquezerah disse: adaptar oque maninho? você fala do tempo de 10 segundos para ter chance de nascer algum monstro novamente? Exatamente
Postado Outubro 10, 2022 3 anos @Aizuuu O último código que te enviei ja está com essa verificação, você testou?
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.