SHOW:
|
|
- or go back to the newest paste.
| 1 | local pokemons = {
| |
| 2 | - | -- [chance em porcentagem] = {"Nome do Pokemon", "nome do pokemon 2"}
|
| 2 | + | -- [chance em porcentagem] = {"Nome do Pokemon", "nome do pokemon 2"}
|
| 3 | - | [80] = {"Caterpie", "Weedle", "Noctowl"},
|
| 3 | + | [80] = {"Caterpie", "Weedle", "Noctowl"},
|
| 4 | } | |
| 5 | ||
| 6 | function onUse(cid, item, fromPosition, itemEx, toPosition) | |
| 7 | - | local e = {2,3,4,5,6,9}
|
| 7 | + | local e = {2,3,4,5,6,9}
|
| 8 | - | local t = {}
|
| 8 | + | local t = {}
|
| 9 | - | for _, v in pairs(pokemons) do |
| 9 | + | for _, v in pairs(pokemons) do |
| 10 | - | table.insert(t, _) |
| 10 | + | table.insert(t, _) |
| 11 | - | end |
| 11 | + | end |
| 12 | - | table.sort(t) |
| 12 | + | table.sort(t) |
| 13 | - | for _, v in pairs(t) do |
| 13 | + | for _, v in pairs(t) do |
| 14 | - | if math.random(1, 100) < v then |
| 14 | + | if math.random(1, 100) < v then |
| 15 | - | c = v |
| 15 | + | c = v |
| 16 | - | break |
| 16 | + | break |
| 17 | - | end |
| 17 | + | end |
| 18 | - | end |
| 18 | + | end |
| 19 | - | local m = pokemons[c][math.random(1,#pokemons[c])] |
| 19 | + | local m = pokemons[c][math.random(1,#pokemons[c])] |
| 20 | - | local monster = doCreateMonster(m, getPlayerPosition(cid)) |
| 20 | + | local monster = doCreateMonster(m, getPlayerPosition(cid)) |
| 21 | - | doSendMagicEffect(getCreaturePosition(monster), CONST_ME_TELEPORT) |
| 21 | + | doSendMagicEffect(getCreaturePosition(monster), CONST_ME_TELEPORT) |
| 22 | - | doSendMagicEffect(toPosition, e[math.random(1,#e)]) |
| 22 | + | doSendMagicEffect(toPosition, e[math.random(1,#e)]) |
| 23 | - | doCreatureSay(monster, m.." Um pokemon foi encontrado!", TALKTYPE_ORANGE_1) |
| 23 | + | doCreatureSay(monster, m.." Um pokemon foi encontrado!", TALKTYPE_ORANGE_1) |
| 24 | - | return true |
| 24 | + | return true |
| 25 | end |