Ir para conteúdo
  • 0

ayuda en movement


samuelitho

Pergunta

como puedo hacer para que los pokemones spawn por nivel 

AQUI ESTA EL MOVEMENT COMO PUEDO EDITARLO PARA QUE SALGAN CON NIVEL

 

local cfg = {
monsters = {"Pidgey"},
grassChance = 15, -- % chance create monster
timeTo = 10, -- Seconds so you can use them again
}

function onStepIn(cid, item, pos)

if not isPlayer(cid) then return true end
if getGlobalStorageValue(14260) > os.time() then return true end

if math.random(100) <= cfg.grassChance then
doCreateMonster(cfg.monsters[math.random(1, #cfg.monsters)], getCreaturePosition(cid))
addEvent(doSendMagicEffect, 1 * 1000, getCreaturePosition(cid), 14)
setGlobalStorageValue(14260, os.time() + cfg.timeTo)
end
return true
end

Link para o comentário
Compartilhar em outros sites

13 respostass a esta questão

Posts Recomendados

  • 0

Teste o script dessa maneira

 

explicação:


    [1] = {monsters = "Pidgey", grassChance = 15, timeTo = 10, level = 100} 


          level  necessário para fazer o pidgey

 

script:

Spoiler

local config =
{
    [1] = {monsters = "Pidgey", grassChance = 15, timeTo = 10, level = 100} 
}
function onStepIn(cid, item, pos)
    
    for i=1, #config do
        
        if getPlayerLevel(cid) >= config.level then
        elseif getGlobalStorageValue(14260) > os.time() then 
        elseif math.random(100) <= config.grassChance then
            doCreateMonster(config.monsters[math.random(1, #config.monsters)], getCreaturePosition(cid))
            addEvent(doSendMagicEffect, 1 * 1000, getCreaturePosition(cid), 14)
            setGlobalStorageValue(14260, os.time() + config.timeTo)
        end
        return true
    end
end

 

Editado por Poke X Ice
Link para o comentário
Compartilhar em outros sites

  • 0
17 horas atrás, Naruse disse:

Você quer que o pokémon nasça level 5 ?

Tente

 


local cfg = {
monsters = {"Pidgey"},
grassChance = 15, -- % chance create monster
timeTo = 10, -- Seconds so you can use them again
}

function onStepIn(cid, item, pos)

if not isPlayer(cid) then return true end
if getGlobalStorageValue(14260) > os.time() then return true end

if math.random(100) <= cfg.grassChance then
doCreateMonster(cfg.monsters[math.random(1, #cfg.monsters)], getCreaturePosition(cid))
addEvent(doSendMagicEffect, 1 * 1000, getCreaturePosition(cid), 14)
doItemSetAttribute(item, "level", 5)
setGlobalStorageValue(14260, os.time() + cfg.timeTo)
end
return true
end

 


TESTE ASI NO FUNCA



local cfg = {{monsters = {"Pidgey"}, grassChance = 15, timeTo = 10, lvl = 5},
             {monsters = {"Rattata"}, grassChance = 10, timeTo = 10, lvl = 2},
             {monsters = {"Caterpie"}, grassChance = 5, timeTo = 10, lvl = 4},
}

function onStepIn(cid, item, pos)

if not isPlayer(cid) then return true end
if getGlobalStorageValue(14260) > os.time() then return true end

if math.random(100) <= cfg.grassChance then
doCreateMonster(cfg.monsters[math.random(1, #cfg.monsters)], getCreaturePosition(cid))
addEvent(doSendMagicEffect, 1 * 1000, getCreaturePosition(cid), 14)
doItemSetAttribute(item, "level", cfg.lvl)
setGlobalStorageValue(14260, os.time() + cfg.timeTo)
end
return true
end
Editado por samuelitho
Link para o comentário
Compartilhar em outros sites

  • 0
2 horas atrás, Naruse disse:

Tenta não tirar o level, troca o "cfg.lvl" por 5 pra ve

[02/09/2018 06:17:37] [Error - MoveEvents Interface] 
[02/09/2018 06:17:37] data/movements/scripts/ruta1.lua:onStepIn
[02/09/2018 06:17:37] Description: 
[02/09/2018 06:17:37] (luaDoItemSetAttribute) Item not found

Link para o comentário
Compartilhar em outros sites

  • 0
14 horas atrás, samuelitho disse:

[02/09/2018 06:17:37] [Error - MoveEvents Interface] 
[02/09/2018 06:17:37] data/movements/scripts/ruta1.lua:onStepIn
[02/09/2018 06:17:37] Description: 
[02/09/2018 06:17:37] (luaDoItemSetAttribute) Item not found




local cfg = {{monsters = {"Pidgey"}, grassChance = 15, timeTo = 10, lvl = 5},
             {monsters = {"Rattata"}, grassChance = 10, timeTo = 10, lvl = 2},
             {monsters = {"Caterpie"}, grassChance = 5, timeTo = 10, lvl = 4},
}

function onStepIn(cid, pos)

if not isPlayer(cid) then return true end
if getGlobalStorageValue(14260) > os.time() then return true end

if math.random(100) <= cfg.grassChance then
doCreateMonster(cfg.monsters[math.random(1, #cfg.monsters)], getCreaturePosition(cid))
addEvent(doSendMagicEffect, 1 * 1000, getCreaturePosition(cid), 14)
doItemSetAttribute(item, "level", cfg.lvl)
setGlobalStorageValue(14260, os.time() + cfg.timeTo)
end
return true
end
Editado por Marshmello
Link para o comentário
Compartilhar em outros sites

  • 0
3 horas atrás, Marshmello disse:




local cfg = {{monsters = {"Pidgey"}, grassChance = 15, timeTo = 10, lvl = 5},
             {monsters = {"Rattata"}, grassChance = 10, timeTo = 10, lvl = 2},
             {monsters = {"Caterpie"}, grassChance = 5, timeTo = 10, lvl = 4},
}

function onStepIn(cid, pos)

if not isPlayer(cid) then return true end
if getGlobalStorageValue(14260) > os.time() then return true end

if math.random(100) <= cfg.grassChance then
doCreateMonster(cfg.monsters[math.random(1, #cfg.monsters)], getCreaturePosition(cid))
addEvent(doSendMagicEffect, 1 * 1000, getCreaturePosition(cid), 14)
doItemSetAttribute(item, "level", cfg.lvl)
setGlobalStorageValue(14260, os.time() + cfg.timeTo)
end
return true
end

[02/09/2018 23:59:13] [Error - MoveEvents Interface] 
[02/09/2018 23:59:13] data/movements/scripts/ruta1.lua:onStepIn
[02/09/2018 23:59:13] Description: 
[02/09/2018 23:59:13] data/movements/scripts/ruta1.lua:11: attempt to compare number with nil
[02/09/2018 23:59:13] stack traceback:
[02/09/2018 23:59:13]     data/movements/scripts/ruta1.lua:11: in function <data/movements/scripts/ruta1.lua:6>

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...