Ir para conteúdo
  • 0

[Erro Tasks] No Creaturescript (Evento Onkill.lua)


juliorpv

Pergunta

Seguinte. Uma pessoa pegou a task de matar os Behemoths, mas quando ela mata os behes, ele simplesmente não morre, some a barra de hp do behemoth, mas ele continua la vivo, e atacando!, fui no console do bot, e estava em loop a seguinte mensagem de erro: errokr.png

 

Meu ArenaKill.lua está da seguinte forma:

 

 

local t = {

newPos = {x=33062, y=31029, z=7},

msg = "You have won! As new champion take the ancient armor as reward before you leave.",

area = {

fromX = 33054, toX = 33073,

fromY = 31026, toY = 32356,

z = 3

}

}

local spheres = {

['energy overlord'] = 8568,

['fire overlord'] = 8569,

['ice overlord'] = 8570,

['earth overlord'] = 8578

}

 

function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)

local creaturesList = {}

for x = -radiusx, radiusx do

for y = -radiusy, radiusy do

if not (x == 0 and y == 0) then

creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z, stackpos = 253})

if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then

table.insert(creaturesList, creature.uid)

end

end

end

end

 

local creature = getTopCreature(position)

if(creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then

if not(table.find(creaturesList, creature.uid)) then

table.insert(creaturesList, creature.uid)

end

end

return creaturesList

end

function onKill(cid, target, damage, flags)

if isPlayer(target) or not isInArray({1, 3}, flags) or getCreatureMaster(target) then

return true

end

 

local name = getCreatureName(target):lower()

if name == 'tirecz' then

local players = getCreaturesInRange({x=33063, y=31035,z=3}, 10, 9, FALSE, TRUE)

for i = 1, #players do

doTeleportThing(players, t.newPos)

doCreatureSay(players, t.msg, TALKTYPE_ORANGE_1, false, players, getCreaturePosition(players))

end

return true

end

 

if spheres[name] then

setGlobalStorageValue(spheres[name], -1)

return true

end

 

local now = tasks[name]

if (now) then

if isInArray({-1, now.amount}, getPlayerStorageValue(cid, now.storage)) or (not isInArray({14003, 14004, 14005}, now.storage) and getPlayerStorageValue(cid, 14500) ~= now.storage) then

return true

end

 

local newValue = getPlayerStorageValue(cid, now.storage) + 1

setPlayerStorageValue(cid, now.storage, newValue)

end

 

local room = getArenaMonsterIdByName(getCreatureName(target))

if room > 0 then

setPlayerStorageValue(cid, room, 1)

doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,'You can enter next room!')

end

return TRUE

end

 

Antes de ver que se tratava de um erro no script, eu cheguei a trocar o behemoth.xml, e persistiu o erro. alguem tem alguma sugestão?

Editado por juliorpv
Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0

esse erro e típico da funçao Onkill e Ontarget e OnAtackk e porque esse tipo de event nao esta preparado para script grande que normalmente pode apresentar erro e assim o script nao termina e a creature so morre se o script terminar.

O certo msn e saber o que esta causando isso para este de event tem que ser um script mt bem analisado.

Ate o laag pode prejudicar a morte de um monstro quando um event estiver executando.

 

a e aki esta o script concertado

 

local t = {

newPos = {x=33062, y=31029, z=7},

msg = "You have won! As new champion take the ancient armor as reward before you leave.",

area = {

fromX = 33054, toX = 33073,

fromY = 31026, toY = 32356,

z = 3

}

}

local spheres = {

['energy overlord'] = 8568,

['fire overlord'] = 8569,

['ice overlord'] = 8570,

['earth overlord'] = 8578

}

function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)

local creaturesList = {}

for x = -radiusx, radiusx do

for y = -radiusy, radiusy do

if not (x == 0 and y == 0) then

creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z, stackpos = 253})

if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then

table.insert(creaturesList, creature.uid)

end

end

end

end

local creature = getTopCreature(position)

if(creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then

if not(table.find(creaturesList, creature.uid)) then

table.insert(creaturesList, creature.uid)

end

end

return creaturesList

end

function onKill(cid, target, damage, flags)

if isPlayer(target) or not isInArray({1, 3}, flags) or getCreatureMaster(target) then

return true

end

local name = getCreatureName(target):lower()

if name == 'tirecz' then

local players = getCreaturesInRange({x=33063, y=31035,z=3}, 10, 9, FALSE, TRUE)

for i = 1, #players do

doTeleportThing(players, t.newPos)

doCreatureSay(players, t.msg, TALKTYPE_ORANGE_1, false, players, getCreaturePosition(players))

end

return true

end

if spheres[name] then

setGlobalStorageValue(spheres[name], -1)

return true

end

local now = tasks[name]

if (now) then

if isInArray({-1, now.amount}, getPlayerStorageValue(cid, now.storage)) or (not isInArray({14003, 14004, 14005}, now.storage) and getPlayerStorageValue(cid, 14500) ~= now.storage) then

return true

end

local newValue = getPlayerStorageValue(cid, now.storage +1)

setPlayerStorageValue(cid, now.storage, newValue)

end

local room = getArenaMonsterIdByName(getCreatureName(target))

if room > 0 then

setPlayerStorageValue(cid, room, 1)

doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,'You can enter next room!')

end

return TRUE

end

Link para o comentário
Compartilhar em outros sites

  • 0

Ótimo amigo, estarei testando agora mesmo, funcionando eu posto e rep+ ! obrigado!

 

eu troquei o script no arenakill.lua.

Aparentemente resolveu a questão de os bixos não morrer, mas apareceu outro problema.

Eu vou no npc, pego a task, ae la no botão Quests do tibia, ta la, dos 2000 behes, e 0 mortos, mas quando eu mato o primeiro, a task simplesmente some do menu quests...

Link para o comentário
Compartilhar em outros sites

  • 0

agr eu entendi o proposito do autor do script ele cometeu um pequeno erro

mais sem mais delongas

 

 

local t = {

newPos = {x=33062, y=31029, z=7},

msg = "You have won! As new champion take the ancient armor as reward before you leave.",

area = {

fromX = 33054, toX = 33073,

fromY = 31026, toY = 32356,

z = 3

}

}

local spheres = {

['energy overlord'] = 8568,

['fire overlord'] = 8569,

['ice overlord'] = 8570,

['earth overlord'] = 8578

}

function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)

local creaturesList = {}

for x = -radiusx, radiusx do

for y = -radiusy, radiusy do

if not (x == 0 and y == 0) then

creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z, stackpos = 253})

if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then

table.insert(creaturesList, creature.uid)

end

end

end

end

local creature = getTopCreature(position)

if(creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then

if not(table.find(creaturesList, creature.uid)) then

table.insert(creaturesList, creature.uid)

end

end

return creaturesList

end

function onKill(cid, target, damage, flags)

if isPlayer(target) or not isInArray({1, 3}, flags) or getCreatureMaster(target) then

return true

end

local name = getCreatureName(target):lower()

if name == 'tirecz' then

local players = getCreaturesInRange({x=33063, y=31035,z=3}, 10, 9, FALSE, TRUE)

for i = 1, #players do

doTeleportThing(players, t.newPos)

doCreatureSay(players, t.msg, TALKTYPE_ORANGE_1, false, players, getCreaturePosition(players))

end

return true

end

if spheres[name] then

setGlobalStorageValue(spheres[name], -1)

return true

end

local now = tasks[name]

if (now) then

if isInArray({-1, now.amount}, getPlayerStorageValue(cid, now.storage)) or (not isInArray({14003, 14004, 14005}, now.storage) and getPlayerStorageValue(cid, 14500) ~= now.storage) then

return true

end

local newValue = getPlayerStorageValue(cid, now.storage)

setPlayerStorageValue(cid, now.storage, newValue +1)

end

local room = getArenaMonsterIdByName(getCreatureName(target))

if room > 0 then

setPlayerStorageValue(cid, room, 1)

doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,'You can enter next room!')

end

return TRUE

end

Editado por caotic
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...