Voce botou em areas.lua em lib?
- Fórum
- OTServ
- Suporte
- Tópicos Sem Resposta
- [Encerrado] Bug spell (erro) (Pda)
[Encerrado] Bug spell (erro) (Pda)
Por Fuuin Fake, 27 de set. de 2015 em Tópicos Sem Resposta
info
Grupo: Cavaleiro
Registrado: 13/10/12
Posts: 168
Reputação: +39
Char no Tibia: Fuuin Fake

Sim.
Tente assim:
elseif spell == "Compass Slash" then
local config = {
times = 5, --Vezes que o pokémon irá se teleportar.
appearEffect = 211, --Efeito que vai aparecer no pokémon ao aparecer.
effect = 223, --Efeito de corte de garras.
combat = STEELDAMAGE, --Elemento.
disappearInterval = 200, --Tempo para, depois de reaparecer, o pokémon desaparecer novamente. (em milésimos de segundo)
teleportInterval = 400 --Intervalo de tempo entre cada teleporte do pokémon. (em milésimos de segundo)
}
local pos = getPosfromArea(cid, spell_area)
local randomPosis = {}
for i = 1, config.times do
randomPosis[i] = pos[math.random(#pos)]
if not isWalkable(randomPosis[i]) or getTileInfo(randomPosis[i]).protection then
while not isWalkable(randomPosis[i]) do
randomPosis[i] = pos[math.random(#pos)]
end
end
end
local function doTeleport(cid, time)
if not isCreature(cid) then return true end
if not isCreature(target) or time <= 0 then
doAppear(cid)
doCreatureSetNoMove(cid, false)
doRegainSpeed(cid)
end
local index = math.random(#randomPosis)
doTeleportThing(cid, randomPosis[index])
for i = index, #randomPosis do
randomPosis[i] = randomPosis[i + 1] or nil
end
doAppear(cid)
doSendMagicEffect(getThingPos(cid), config.appearEffect)
doDanoWithProtect(cid, config.combat, getThingPos(target), 0, -min, -max, config.effect)
addEvent(doDisapear, config.disappearInterval, cid)
addEvent(doTeleport, config.teleportInterval, cid, time - 1)
end
doDisapear(cid)
doCreatureSetNoMove(cid, true)
doChangeSpeed(cid, -getCreatureSpeed(cid))
addEvent(doTeleport, config.teleportInterval, cid, config.times)
info
Grupo: Cavaleiro
Registrado: 13/10/12
Posts: 168
Reputação: +39
Char no Tibia: Fuuin Fake

Não funcionou.
Poste a parte que você adicionou em areas.lua em lib.
O problema não está no código, e sim na área da spell. Adicione isso em areas.lua (data/lib):
spell_area = { --Área de posições que o pokémon pode teleportar.
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 3, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}
info
Grupo: Cavaleiro
Registrado: 13/10/12
Posts: 168
Reputação: +39
Char no Tibia: Fuuin Fake

Ainda continua com o mesmo erro, eu ja tinha adicionado isso.
@up
@up
info
Grupo: Campones
Registrado: 19/09/15
Posts: 17
Reputação: +2

elseif spell == "Compass Slash" then
local config = {
times = 5, --Vezes que o pokémon irá se teleportar.
appearEffect = 211, --Efeito que vai aparecer no pokémon ao aparecer.
effect = 223, --Efeito de corte de garras.
combat = STEELDAMAGE, --Elemento.
disappearInterval = 200, --Tempo para, depois de reaparecer, o pokémon desaparecer novamente. (em milésimos de segundo)
teleportInterval = 400 --Intervalo de tempo entre cada teleporte do pokémon. (em milésimos de segundo)
}
local pos = getPosfromArea(cid, spell_area)
local randomPosis = {}
for i = 1, config.times do
randomPosis[i] = pos[math.random(#pos)]
if not isWalkable(randomPosis[i]) or getTileInfo(randomPosis[i]).protection then
while not isWalkable(randomPosis[i]) do
randomPosis[i] = pos[math.random(#pos)]
end
end
end
local function doTeleport(cid, time)
if not isCreature(target) or time <= 0 then
doAppear(cid)
doCreatureSetNoMove(cid, false)
doRegainSpeed(cid)
end
local index = math.random(#randomPosis)
doTeleportThing(cid, randomPosis[index])
for i = index, #randomPosis do
randomPosis[i] = randomPosis[i + 1] or nil
end
doAppear(cid)
doSendMagicEffect(getThingPos(cid), config.appearEffect)
doDanoWithProtect(cid, config.combat, getThingPos(target), 0, -min, -max, config.effect)
addEvent(doDisapear, config.disappearInterval, cid)
addEvent(doTeleport, config.teleportInterval, cid, time - 1)
end
doDisapear(cid)
doCreatureSetNoMove(cid, true)
doChangeSpeed(cid, -getCreatureSpeed(cid))
addEvent(doTeleport, config.teleportInterval, cid, config.times)
Teste bem, eu não tenho verificado.
info
Grupo: Cavaleiro
Registrado: 13/10/12
Posts: 168
Reputação: +39
Char no Tibia: Fuuin Fake

[30/09/2015 19:10:31] [Error - TalkAction Interface] [30/09/2015 19:10:31] In a timer event called from: [30/09/2015 19:10:31] data/talkactions/scripts/move1.lua:onSay [30/09/2015 19:10:31] Description: [30/09/2015 19:10:31] data/lib/pokemon moves.lua:423: bad argument #1 to 'random' (interval is empty) [30/09/2015 19:10:31] stack traceback: [30/09/2015 19:10:31] [C]: in function 'random' [30/09/2015 19:10:31] data/lib/pokemon moves.lua:423: in function <data/lib/pokemon moves.lua:417>
obs: Antes tava dando 4 erros seguidos iguais a este mais agora so apareceu um
info
Grupo: Herói
Registrado: 28/11/10
Posts: 3.4k
Reputação: +585
Gênero: Masculino

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.






info
Grupo: Cavaleiro
Registrado: 13/10/12
Posts: 168
Reputação: +39
Char no Tibia: Fuuin Fake
Esta Dando o seguinte erro no console
O codigo no meu Pokemon moves \/
elseif spell == "Compass Slash" then local config = { times = 5, --Vezes que o pokémon irá se teleportar. appearEffect = 211, --Efeito que vai aparecer no pokémon ao aparecer. effect = 223, --Efeito de corte de garras. combat = STEELDAMAGE, --Elemento. disappearInterval = 200, --Tempo para, depois de reaparecer, o pokémon desaparecer novamente. (em milésimos de segundo) teleportInterval = 400 --Intervalo de tempo entre cada teleporte do pokémon. (em milésimos de segundo) } local pos = getPosfromArea(cid, spell_area) local randomPosis = {} for i = 1, config.times do randomPosis[i] = pos[math.random(#pos)] if not isWalkable(randomPosis[i]) or getTileInfo(randomPosis[i]).protection then while not isWalkable(randomPosis[i]) do randomPosis[i] = pos[math.random(#pos)] end end end local function doTeleport(cid, time) if not isCreature(cid) then return true end if not isCreature(target) or time <= 0 then doAppear(cid) doCreatureSetNoMove(cid, false) doRegainSpeed(cid) end local index = math.random(#randomPosis) doTeleportThing(cid, randomPosis[index]) for i = index, #randomPosis do randomPosis[i] = randomPosis[i + 1] or nil end doAppear(cid) doSendMagicEffect(getThingPos(cid), config.appearEffect) doDanoWithProtect(cid, config.combat, getThingPos(target), 0, -min, -max, config.effect) addEvent(doDisapear, config.disappearInterval, cid) addEvent(doTeleport, config.teleportInterval, cid, time - 1) end doDisapear(cid) doCreatureSetNoMove(cid, true) doChangeSpeed(cid, -getCreatureSpeed(cid)) addEvent(doTeleport, config.teleportInterval, cid, config.times)