BlzSetAbilityRealLevelField is not working

Status
Not open for further replies.
Level 24
Joined
Jun 26, 2020
Messages
1,921
Hello, this is the first time I'm using this function, and its not working, I tried to change the damage of an ability based in Cluster Rockets and is not changing, I'm sure that everything is ok, can you tell me what's wrong please?
Lua:
OnMapInit(function ()
    local Spell = FourCC('A024')
    local StrDmgFactor = 0.15
    local AgiDmgFactor = 0.15
    local IntDmgFactor = 0.15
    local AttackFactor = 0.5

    RegisterSpellEffectEvent(Spell, function ()
        local caster = GetSpellAbilityUnit()
        -- Calculating the damage
        local damage = GetAttributeDamage(caster, StrDmgFactor, AgiDmgFactor, IntDmgFactor) +
                       GetAvarageAttack(caster) * AttackFactor
        -- --
        BlzSetAbilityRealLevelField(BlzGetUnitAbility(caster, Spell), ABILITY_RLF_DAMAGE_AMOUNT_NCS1, 0, damage/12)
    end)

end)
The ability in the object editor
1653800737763.png

The raw values
1653800757605.png
 
Level 43
Joined
Feb 27, 2007
Messages
5,470
This could be wildly off the mark but I remember Cluster Rockets specifically being a dumb as fuck ability to try to modify in the editor. There was always some problem with it or shit didn't work right; I can't quite remember but something like that can maybe be corroborated by @Kyrbi0. If that's the case maybe it affects this. Try modifying a different ability to see if it works... or even a different field on this ability.
 
Level 24
Joined
Jun 26, 2020
Messages
1,921
So my option is replicate the ability, the problem, I don't know how exactly works and I wanna make it similar, this is what I achieve, but I don't get a similar result:
Lua:
OnMapInit(function ()
    local Spell = FourCC('A029')
    local StrDmgFactor = 0.15
    local AgiDmgFactor = 0.15
    local IntDmgFactor = 0.15
    local AttackFactor = 0.5
    -- The same as it is in the object editor
    local Area = 200.
    local Order = 852652 -- clusterrockets

    RegisterSpellEffectEvent(Spell, function ()
        local caster = GetSpellAbilityUnit()
        local owner = GetOwningPlayer(caster)
        local cx = GetUnitX(caster)
        local cy = GetUnitY(caster)
        local x = GetSpellTargetX()
        local y = GetSpellTargetY()
        -- Calculating the damage
        local damage = GetAttributeDamage(caster, StrDmgFactor, AgiDmgFactor, IntDmgFactor) +
                       GetAvarageAttack(caster) * AttackFactor
        -- --
        damage = damage / 6
        local counter = 6
        Timed.echo(function ()
            if counter == 0 or GetUnitCurrentOrder(caster) ~= Order then return true end
            local angle = 2 * math.pi * math.random()
            local dist = Area * math.random()
            local tx = x + dist * math.cos(angle)
            local ty = y + dist * math.sin(angle)
            local missile = Missiles:create(cx, cy, 25, tx, ty, 0)
            missile.source = caster
            missile.owner = owner
            missile.damage = damage
            missile:model("Abilities\\Spells\\Other\\TinkerRocket\\TinkerRocketMissile.mdl")
            missile:speed(700.)
            missile:arc(60.)
            missile.onFinish = function ()
                ForUnitsInRange(missile.x, missile.y, Area, function (u)
                    if IsUnitEnemy(u, missile.owner) then
                        Damage.apply(caster, u, damage, true, false, udg_Machine, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                        -- Stun
                        DummyCast(owner,
                                    GetUnitX(caster), GetUnitY(caster),
                                    STUN_SPELL,
                                    STUN_ORDER,
                                    2,
                                    CastType.TARGET,
                                    u)
                    end
                end)
            end
            missile:launch()
            counter = counter - 1
        end, 0.25)
    end)

end)
 
Status
Not open for further replies.
Top