Ir para conteúdo
  • Cadastre-se

(Resolvido)Erro (luaDoCombat) Creature not found


Ir para solução Resolvido por xWhiteWolf,

Posts Recomendados

Bom galera do querendo adicionar esse script do @xWhiteWolf no meu otserv, funciona prefeito. porém quando o monstro ou player morre, fica aparecendo varios erro no console. se alguem pergunta como assim monstro ou player é pq eu crie duas spells no msm modo desse aqui, porem um pra monstro e a outra pra player.

 

 

Spoiler

local waves = 8 --- numero de vezes que vão cair os meteoros

local water = {490, 491, 492, 493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625}
local combat = createCombatObject()
local meteor = createCombatObject()
setCombatParam(meteor, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(meteor, COMBAT_PARAM_EFFECT, CONST_ME_LOSEENERGY)
setCombatFormula(meteor, COMBAT_FORMULA_LEVELMAGIC, -30, -50, -40, -55)

local meteor_water = createCombatObject()
setCombatParam(meteor_water, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(meteor_water, COMBAT_PARAM_EFFECT, CONST_ME_LOSEENERGY)
setCombatFormula(meteor, COMBAT_FORMULA_LEVELMAGIC, -30, -50, -40, -55)

combat_arr = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 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, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 3, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}
local combat_area = createCombatArea(combat_arr)
setCombatArea(combat, combat_area)

local function meteorCast(p)
doCombat(p.cid, p.combat, positionToVariant(p.pos))
end

local function stunEffect(cid)
doSendMagicEffect(getThingPos(cid), CONST_ME_STUN)
end

function onTargetTile(cid, pos)
if (math.random(0, 6) == 6) then
local ground = getThingfromPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0})
if (isInArray(water, ground.itemid) == TRUE) then
local newpos = {x = pos.x - 7, y = pos.y - 6, z = pos.z}
doSendDistanceShoot(newpos, pos, CONST_ANI_SMALLICE)
addEvent(meteorCast, 200, {cid = cid, pos = pos, combat = meteor_water})
else
local newpos = {x = pos.x - 7, y = pos.y - 6, z = pos.z}
doSendDistanceShoot(newpos, pos, CONST_ANI_SMALLICE)
addEvent(meteorCast, 200, {cid = cid,pos = pos, combat = meteor})
end
end
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
function onCastSpell(cid, var)
for i = 0, waves do
addEvent(function()
if isCreature(cid) then
doCombat(cid, combat, var)
end
end, 200 * i)
end

return true
end

 

o erro é?: In a timer event called from: 

              (luaDoCombat) Creature not found

 

isso ficar deixando o server lento, uso tfs 0.4

Link para o post
Compartilhar em outros sites
  • Solução
local function meteorCast(p)
  if isCreature(p.cid) then
      doCombat(p.cid, p.combat, positionToVariant(p.pos))
  end
end

deixa a função meteorCast assim que os erros devem parar.

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

Link para o post
Compartilhar em outros sites
6 horas atrás, xWhiteWolf disse:

local function meteorCast(p)
  if isCreature(p.cid) then
      doCombat(p.cid, p.combat, positionToVariant(p.pos))
  end
end

deixa a função meteorCast assim que os erros devem parar.

obg amigo ajudou muito. funcionou perfeito, agr so arruma todos os script valeu.

Link para o post
Compartilhar em outros sites
7 horas atrás, xWhiteWolf disse:

local function meteorCast(p)
  if isCreature(p.cid) then
      doCombat(p.cid, p.combat, positionToVariant(p.pos))
  end
end

deixa a função meteorCast assim que os erros devem parar.

Amigo, pode me ajudar com essa spell? estou com o mesmo erro.

 

Spoiler

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_HITCOLOR, COLOR_TEAL)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 13)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, 41)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -35.0, 0, -35.5, 0)

local function onCastSpell1(parameters)
doCombat(parameters.cid, parameters.combat1, parameters.var)
end
 
function onCastSpell(cid, var)
local parameters = {cid = cid, var = var, combat1 = combat1}

for k = 1, 10 do
    addEvent(function()
        if isCreature(cid) then
            addEvent(onCastSpell1, 1, parameters)
        end
    end, 1 + ((k-1) * 225))
end
return true
end

 

Link para o post
Compartilhar em outros sites
27 minutos atrás, Thayguroficial disse:

Amigo, pode me ajudar com essa spell? estou com o mesmo erro.

Spoiler

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_HITCOLOR, COLOR_TEAL)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 13)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, 41)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -35.0, 0, -35.5, 0)
local function onCastSpell1(parameters)
	if isCreature(parameters.cid) then
		doCombat(parameters.cid, parameters.combat1, parameters.var)
	end
end
 
function onCastSpell(cid, var)
local parameters = {cid = cid, var = var, combat1 = combat1}
for k = 1, 10 do
    addEvent(function()
        if isCreature(cid) then
            addEvent(onCastSpell1, 1, parameters)
        end
    end, 1 + ((k-1) * 225))
end
return true
end

 

o problema em ambos os casos era um addEvent sem o check de isCreature.

Editado por xWhiteWolf (veja o histórico de edições)

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

Link para o post
Compartilhar em outros sites
56 minutos atrás, xWhiteWolf disse:
  Ocultar conteúdo


local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_HITCOLOR, COLOR_TEAL)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 13)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, 41)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -35.0, 0, -35.5, 0)
local function onCastSpell1(parameters)
	if isCreature(parameters.cid) then
		doCombat(parameters.cid, parameters.combat1, parameters.var)
	end
end
 
function onCastSpell(cid, var)
local parameters = {cid = cid, var = var, combat1 = combat1}
for k = 1, 10 do
    addEvent(function()
        if isCreature(cid) then
            addEvent(onCastSpell1, 1, parameters)
        end
    end, 1 + ((k-1) * 225))
end
return true
end

 

o problema em ambos os casos era um addEvent sem o check de isCreature.

MUITO OBRIGADOOOOOOO, te amo cara. Sério!

Link para o post
Compartilhar em outros sites
  • 11 months later...

olar pode me ajuda estou com mesmo problema nesta spells o negocio e qem as vezes aparece e as vezes n acho q qando player mato o outro usando a magia aparece.. segui a spells 

 

local acombat1 = createCombatObject()
local acombat2 = createCombatObject()
local acombat3 = createCombatObject()
local acombat4 = createCombatObject()

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 6)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -100.90, -80, -70.7, 0)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, 10)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -100.90, -80, -70.7, 0)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 6)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -100.90, -80, -70.7, 0)

local combat4 = createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat4, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
setCombatParam(combat4, COMBAT_PARAM_DISTANCEEFFECT, 10)
setCombatFormula(combat4, COMBAT_FORMULA_LEVELMAGIC, -100.90, -80, -70.7, 0)

arr1 = {
{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, 2, 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},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}

arr2 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0},
{0, 1, 0, 0, 0, 0, 0, 0, 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Area(arr1)
local area2 = createCombatArea(arr2)
local area3 = createCombatArea(arr3)
local area4 = createCombatArea(arr4)
setCombatArea(acombat1, area1)
setCombatArea(acombat2, area2)
setCombatArea(acombat3, area3)
setCombatArea(acombat4, area4)


function onTargetTile(cid, pos)
    doCombat(cid,combat1,positionToVariant(pos))
end

function onTargetTile2(cid, pos)
    doCombat(cid,combat2,positionToVariant(pos))
end

function onTargetTile3(cid, pos)
    doCombat(cid,combat3,positionToVariant(pos))
end

function onTargetTile4(cid, pos)
    doCombat(cid,combat4,positionToVariant(pos))
end

setCombatCallback(acombat1, CALLBACK_PARAM_TARGETTILE, "onTargetTile")

setCombatCallback(acombat2, CALLBACK_PARAM_TARGETTILE, "onTargetTile2")

setCombatCallback(acombat3, CALLBACK_PARAM_TARGETTILE, "onTargetTile3")

setCombatCallback(acombat4, CALLBACK_PARAM_TARGETTILE, "onTargetTile4")


local function onCastSpell1(parameters)
    doCombat(parameters.cid, acombat1, parameters.var)
end
 
local function onCastSpell2(parameters)
    doCombat(parameters.cid, acombat2, parameters.var)
end
 
local function onCastSpell3(parameters)
    doCombat(parameters.cid, acombat3, parameters.var)
end
 
local function onCastSpell4(parameters)
    doCombat(parameters.cid, acombat4, parameters.var)
end
 
function onCastSpell(cid, var)
local parameters = { cid = cid, var = var}
addEvent(onCastSpell1, 100, parameters)
addEvent(onCastSpell2, 200, parameters)
addEvent(onCastSpell3, 400, parameters)
addEvent(onCastSpell4, 600, parameters)

return TRUE

end  
 

 

Editado por WiversonJr
mostra (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo