- Joined
- Jun 26, 2020
- Messages
- 1,928
I'm trying to create a boss fight and first I have to create its spells, but the problem is for some reason after various casts the spells are not casted, I don't even get an error message so I don't know what's going on, this are the spells:
Scorching heat
Lava explosions
Fire ball attack
Also I send you a map to you can test them.
Scorching heat
Lua:
do
local SPELL = FourCC('A001')
local DURATION = 10. -- seconds
local DAMAGE = 25. -- per second
local AREA = 250.
local INTERVAL = 0.03125
local DMG_PER_TICK = DAMAGE * INTERVAL
RegisterSpellEffectEvent(SPELL, function ()
local caster = GetSpellAbilityUnit()
local eff = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl", caster, "origin")
BlzSetSpecialEffectScale(eff, 2.)
Timed.echo(function (node)
if node.elapsed < DURATION then
ForUnitsInRange(GetUnitX(caster), GetUnitY(caster), AREA, function (u)
if IsUnitEnemy(caster, GetOwningPlayer(u)) then
UnitDamageTarget(caster, u, DMG_PER_TICK, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS)
DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\LordofFlameMissile\\LordofFlameMissile.mdl", u, "chest"))
end
end)
else
BlzSetSpecialEffectScale(eff, 0.01)
DestroyEffect(eff)
return true
end
end, INTERVAL)
end)
end
Lua:
do
local SPELL = FourCC('A002')
local DURATION = 10. -- seconds
local DAMAGE = 100. -- per explosion
local MIN_DIST = 128.
local AREA = 500.
local AREA_EXP = 150.
local INTERVAL = 0.5
RegisterSpellEffectEvent(SPELL, function ()
print("LE")
local caster = GetSpellAbilityUnit()
Timed.echo(function (node)
for _ = 1, GetRandomInt(1, 4) do
local angle = GetRandomReal(0, 2*bj_PI)
local dist = GetRandomReal(MIN_DIST, AREA)
local x = GetUnitX(caster) + dist * Cos(angle)
local y = GetUnitY(caster) + dist * Sin(angle)
DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Volcano\\VolcanoMissile.mdl", x, y))
DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl", x, y))
ForUnitsInRange(x, y, AREA_EXP, function (u)
if IsUnitEnemy(caster, GetOwningPlayer(u)) then
UnitDamageTarget(caster, u, DAMAGE, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS)
end
end)
end
return node.elapsed > DURATION
end, INTERVAL)
end)
end
Lua:
do
local SPELL = FourCC('A003')
local RANGE = 900. -- The same as in the object editor
local DAMAGE = 10. -- per tick
local AREA = 128.
RegisterSpellEffectEvent(SPELL, function ()
local caster = GetSpellAbilityUnit()
local x = GetUnitX(caster)
local y = GetUnitY(caster)
local tx = GetSpellTargetX()
local ty = GetSpellTargetY()
local angle = Atan2(ty - y, tx - x)
local missile = Missiles:create(x, y, 100., x + RANGE * Cos(angle), y + RANGE * Sin(angle), 100.)
missile:model("Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl")
missile:speed(500.)
missile:scale(2.)
missile.source = caster
missile.owner = GetOwningPlayer(caster)
missile.collision = AREA
missile.onHit = function (u)
missile:flush(u)
if IsUnitEnemy(caster, GetOwningPlayer(u)) then
UnitDamageTarget(caster, u, DAMAGE, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS)
end
end
missile:launch()
end)
end