Não vi erro na script. Tente criar um outro arquivo.lua e coloca os codigos neles. Talvez seja um probleminha no arquivo, as vezes acontece.
O evento funciona normal?
Talvez esteja faltando arquivos do evento em outras pastas.
info
Grupo: Diretor
Registrado: 12/05/12
Posts: 818
Reputação: +578
Gênero: Masculino
Char no Tibia: [ADM] Night

Não vi erro na script. Tente criar um outro arquivo.lua e coloca os codigos neles. Talvez seja um probleminha no arquivo, as vezes acontece.
O evento funciona normal?
Talvez esteja faltando arquivos do evento em outras pastas.
Editado Dezembro 8 por nedroesdoksdja
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

Mude a última função (spawnNewZombie) sua da linha 98 para baixo.
Coloque isto:
function spawnNewZombie()
local posx = {}
local posy = {}
local posz = {}
local pir = {}
for i=1, 5 do
local posx_tmp = math.random(ZE_spawnFromPosition.x ,ZE_spawnToPosition.x)
local posy_tmp = math.random(ZE_spawnFromPosition.y ,ZE_spawnToPosition.y)
local posz_tmp = math.random(ZE_spawnFromPosition.z ,ZE_spawnToPosition.z)
local pir_tmp = 0
local spec = getSpectators({x=posx_tmp, y=posy_tmp, z=posz_tmp}, 3, 3, false)
if(spec and #spec > 0) then
for z, pid in pairs(spec) do
if(isPlayer(pid)) then
pir_tmp = pir_tmp + 1
end
end
end
posx[i] = posx_tmp
posy[i] = posy_tmp
posz[i] = posz_tmp
pir[i] = pir_tmp
end
local lowest_i = 1
for i=2, 5 do
if(pir[i] < pir[lowest_i]) then
lowest_i = i
end
end
local ret = (type(doCreateMonster("Zombie Event", {x=posx[lowest_i], y=posy[lowest_i], z=posz[lowest_i]}, false, false, false)) == 'number')
if(ret) then
addZombiesCount()
end
return ret
end
Não vi erro na script. Tente criar um outro arquivo.lua e coloca os codigos neles. Talvez seja um probleminha no arquivo, as vezes acontece.
Já tenho uns 7 anos de tibia, e nunca deu isso em um otserver meu.
verifique se você tá colocando o nome certo.
info
Grupo: Campones
Registrado: 01/05/15
Posts: 49
Reputação: +2

Tava com um problema parecido com esse fiz o que o Yan Lima disse e funcionou ![]()
Já tenho uns 7 anos de tibia, e nunca deu isso em um otserver meu.
verifique se você tá colocando o nome certo.
para um pessoa que tem 7 anos de tibia. ta faltando aprender mais coisas.
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

É né que coisa.Tava com um problema parecido com esse fiz o que o Yan Lima disse e funcionou
para um pessoa que tem 7 anos de tibia. ta faltando aprender mais coisas.
O problema nem tem haver com o TFS 0.4, que dá erro na função...
Que os gringos até postaram na página seguinte.
Editado Dezembro 8 por Caronte
info
Grupo: Barão
Registrado: 13/07/15
Posts: 242
Reputação: +56
Char no Tibia: Sekk

Postaram resolução? por que eu fui pegando os scripts UPDATED que postavam la!
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

Postaram resolução? por que eu fui pegando os scripts UPDATED que postavam la!
Veja a segunda página lá, e siga o meu post, é só alterar a última função...
O gringo postou a correção para TFS_0.4
info
Grupo: Barão
Registrado: 13/07/15
Posts: 242
Reputação: +56
Char no Tibia: Sekk

Substitui a sua parte ali, mas olha:
O zombie spawnou, mas quando ele chegou em uma distancia de uns 2 sqm do player, o player morreu, acabou o evento, o outro venceu e apareceram esses erros no distrô:
doCreateMonster(name, pos, false, false, false)
info
Grupo: Diretor
Registrado: 12/05/12
Posts: 818
Reputação: +578
Gênero: Masculino
Char no Tibia: [ADM] Night

vai em creaturescripts\scripts\zombie\onattack e substitua tudo por isso:
function loseOnZombieArena(cid)
kickPlayerFromZombiesArea(cid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce perdeu.")
local players = getZombiesEventPlayers()
if(#players <= 1) then
local winner = players[1]
if(winner) then
doPlayerAddItem(winner, 2157, 5, true)
doPlayerAddItem(winner, 6119, 1, true)
doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "Voce ganhou o Zombie Event.")
doBroadcastMessage("Depois de " .. os.time() - getPlayerZombiesEventStatus(winner) .. " segundos, o jogador " .. getCreatureName(winner) .. " ganhou o Zombie Arena Event com " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zumbis!")
kickPlayerFromZombiesArea(winner)
else
doBroadcastMessage("O evento acabou, infelizmente ninguém ganhou!")
end
doSetStorage(ZE_STATUS, 0)
doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS)
doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0)
doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1
local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1
local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z}
for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do
centerPos.z = z
for i, uid in pairs(getSpectators(centerPos, width, height, false)) do
if(isMonster(uid)) then
doRemoveCreature(uid)
end
end
end
end
end
function onStatsChange(target, cid, changetype, combat, value)
if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then
doCreatureAddHealth(target, getCreatureMaxHealth(target))
loseOnZombieArena(target)
return false
end
return true
end
Depois vai em lib\032-position.lua e substitue por:
function isInRange(position, fromPosition, toPosition)
return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)
end
function getDistanceBetween(fromPosition, toPosition)
local x, y = math.abs(fromPosition.x - toPosition.x), math.abs(fromPosition.y - toPosition.y)
local diff = math.max(x, y)
if(fromPosition.z ~= toPosition.z) then
diff = diff + 9 + 6
end
return diff
end
function getDirectionTo(pos1, pos2)
local dir = NORTH
if(pos1.x > pos2.x) then
dir = WEST
if(pos1.y > pos2.y) then
dir = NORTHWEST
elseif(pos1.y < pos2.y) then
dir = SOUTHWEST
end
elseif(pos1.x < pos2.x) then
dir = EAST
if(pos1.y > pos2.y) then
dir = NORTHEAST
elseif(pos1.y < pos2.y) then
dir = SOUTHEAST
end
else
if(pos1.y > pos2.y) then
dir = NORTH
elseif(pos1.y < pos2.y) then
dir = SOUTH
end
end
return dir
end
function getCreatureLookPosition(cid)
return getPosByDir(getThingPos(cid), getCreatureLookDirection(cid))
end
function getPositionByDirection(position, direction, size)
local n = size or 1
if(direction == NORTH) then
position.y = position.y - n
elseif(direction == SOUTH) then
position.y = position.y + n
elseif(direction == WEST) then
position.x = position.x - n
elseif(direction == EAST) then
position.x = position.x + n
elseif(direction == NORTHWEST) then
position.y = position.y - n
position.x = position.x - n
elseif(direction == NORTHEAST) then
position.y = position.y - n
position.x = position.x + n
elseif(direction == SOUTHWEST) then
position.y = position.y + n
position.x = position.x - n
elseif(direction == SOUTHEAST) then
position.y = position.y + n
position.x = position.x + n
end
return position
end
function doComparePositions(position, positionEx)
return position.x == positionEx.x and position.y == positionEx.y and position.z == positionEx.z
end
function getArea(position, x, y)
local t = {}
for i = (position.x - x), (position.x + x) do
for j = (position.y - y), (position.y + y) do
table.insert(t, {x = i, y = j, z = position.z})
end
end
return t
end
Editado Dezembro 9 por nedroesdoksdja
info
Grupo: Barão
Registrado: 13/07/15
Posts: 242
Reputação: +56
Char no Tibia: Sekk

O erro de position sumiu, mas agora, "funciona", mas assim, o player morre, e o outro vence, blz, ai aparece esse erro no distro:
info
Grupo: Diretor
Registrado: 12/05/12
Posts: 818
Reputação: +578
Gênero: Masculino
Char no Tibia: [ADM] Night

Tente esse:
function loseOnZombieArena(cid)
kickPlayerFromZombiesArea(cid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce perdeu.")
local players = getZombiesEventPlayers()
if(#players <= 1) then
local winner = players[1]
if(winner) then
doPlayerAddItem(winner, 2157, 5, true)
doPlayerAddItem(winner, 6119, 1, true)
doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "Voce ganhou o Zombie Event.")
doBroadcastMessage("Depois de " .. os.time() - getPlayerZombiesEventStatus(winner) .. " segundos, o jogador " .. getCreatureName(winner) .. " ganhou o Zombie Arena Event com " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zumbis!")
kickPlayerFromZombiesArea(winner)
else
doBroadcastMessage("O evento acabou, infelizmente ninguém ganhou!")
end
doSetStorage(ZE_STATUS, 0)
doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS)
doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0)
doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1
local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1
local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z}
for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do
centerPos.z = z
for i, uid in pairs(getSpectators(centerPos, width, height, false)) do
if(isMonster(uid)) then
doRemoveCreature(uid)
end
end
end
end
end
function onStatsChange(target, cid, changetype, combat, value)
if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then
doCreatureAddHealth(target, getCreatureMaxHealth(target))
loseOnZombieArena(target)
return false
end
return true
end
info
Grupo: Barão
Registrado: 13/07/15
Posts: 242
Reputação: +56
Char no Tibia: Sekk

RESOLVIDO! REP+ PARA OS DOIS!!! VLWW
info
Grupo: Marquês
Registrado: 03/02/13
Posts: 1.2k
Reputação: +254
Gênero: Masculino
Char no Tibia: Partiu Baladinha

Tópico Movido
Este tópico foi movido de "OTServ → Suporte OTServ → Suporte Scripting"
para "OTServ → Suporte OTServ → Suporte Scripting → Pedidos e dúvidas resolvidos - Scripting".
info
Grupo: Campones
Registrado: 08/12/15
Posts: 1
Reputação: +1

Em 08/12/2015 at 23:20, Yan Liima disse:vai em creaturescripts\scripts\zombie\onattack e substitua tudo por isso:
function loseOnZombieArena(cid) kickPlayerFromZombiesArea(cid) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce perdeu.") local players = getZombiesEventPlayers() if(#players <= 1) then local winner = players[1] if(winner) then doPlayerAddItem(winner, 2157, 5, true) doPlayerAddItem(winner, 6119, 1, true) doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "Voce ganhou o Zombie Event.") doBroadcastMessage("Depois de " .. os.time() - getPlayerZombiesEventStatus(winner) .. " segundos, o jogador " .. getCreatureName(winner) .. " ganhou o Zombie Arena Event com " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zumbis!") kickPlayerFromZombiesArea(winner) else doBroadcastMessage("O evento acabou, infelizmente ninguém ganhou!") end doSetStorage(ZE_STATUS, 0) doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS) doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0) doSetStorage(ZE_ZOMBIES_SPAWNED, 0) local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1 local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1 local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z} for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do centerPos.z = z for i, uid in pairs(getSpectators(centerPos, width, height, false)) do if(isMonster(uid)) then doRemoveCreature(uid) end end end endendfunction onStatsChange(target, cid, changetype, combat, value) if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then doCreatureAddHealth(target, getCreatureMaxHealth(target)) loseOnZombieArena(target) return false end return trueend
Vlwwww!!!!! Ajudo De ++++++++ Rep++
info
Grupo: Barão
Registrado: 13/07/15
Posts: 242
Reputação: +56
Char no Tibia: Sekk
Bom galera, direto ao assunto, segui um tópico no OTLand(aqui) para adicionar o evento Zombie Event no meu server.
Tudo certo até os players entrarem no mapa do zombie, mas ai começa uns bugs no console:
Ai vai o meu lib/zombie_event.lua