Ir para conteúdo
  • 0

Spell De Atack De Monstro Dando Bug, Quando Monstro Morre.


roriscrave

Pergunta

No meu server tem uma spell que uso tanto para player quanto para monstros. Porém ela está dando bug. Que acontece quando o monstro solta spell e o jogador mata o monstro antes da spell terminar.

 

 

local combats = {}
local count = 5
local combatTypes = {1,3}
local combatEffects = {340}
local combatDistanceEffects = {1}
local combatFormulas = {{-99, -9, -9, -99}}
local delays = {300,100, 100, 100,100,200,200,200}

for i = 1, count do
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, combatTypes[((i-1) % #combatTypes)+1])
setCombatParam(combat, COMBAT_PARAM_EFFECT, combatEffects[((i-1) % #combatEffects)+1])
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, combatDistanceEffects[((i-1) % #combatDistanceEffects)+1])
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, unpack(combatFormulas[((i-1) % #combatFormulas)+1]))
combats[i] = combat
end

local function onCastSpellDelayed(cid, combat, var, combat_id)
if(isCreature(variantToNumber(var)) and not getTileInfo(getThingPosition(variantToNumber(var))).protection) then
doCombat(cid, combat[combat_id], var)
if(combat[combat_id+1] ~= nil) then
addEvent(onCastSpellDelayed, delays[((combat_id-1) % #delays)+1], cid, combats, var, combat_id+1)
end
end
end

function onCastSpell(cid, var)
onCastSpellDelayed(cid, combats, var, 1)
return true
end

 

O erro é o seguinte:

 

[Error - Spell Interface] 
In a timer event called from: 
data/spells/scripts/novas\spell.lua:onCastSpell
Description: 
(luaDoCombat) Creature not found

 

Darei rep+

Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 0
local combats = {}
local count = 5
local combatTypes = {1,3}
local combatEffects = {340}
local combatDistanceEffects = {1}
local combatFormulas = {{-99, -9, -9, -99}}
local delays = {300,100, 100, 100,100,200,200,200}

for i = 1, count do
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, combatTypes[((i-1) % #combatTypes)+1])
setCombatParam(combat, COMBAT_PARAM_EFFECT, combatEffects[((i-1) % #combatEffects)+1])
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, combatDistanceEffects[((i-1) % #combatDistanceEffects)+1])
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, unpack(combatFormulas[((i-1) % #combatFormulas)+1]))
combats[i] = combat
end

local function onCastSpellDelayed(cid, combat, var, combat_id)
if(isCreature(variantToNumber(var)) and isCreature(cid) and not getTileInfo(getThingPosition(variantToNumber(var))).protection) then
   doCombat(cid, combat[combat_id], var)
   if(combat[combat_id+1] ~= nil) then
       addEvent(onCastSpellDelayed, delays[((combat_id-1) % #delays)+1], cid, combats, var, combat_id+1)
   end
end
end

function onCastSpell(cid, var)
onCastSpellDelayed(cid, combats, var, 1)
return true
end

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...