Ability works, but for some reason it gives me a warning.

I recreated the fallswitch in lua, and it works completely fine, but i keep getting a warning.

The code:
Fallswitch:
addHook("AbilitySpecial", function(player, mo, momz)
    if player.mo.skin != "cheeseboi"
        return
    end
    if player.pflags&PF_THOKKED
    and not player.mo.eflags & MFE_UNDERWATER
        return true
    end
    local dust1 = P_SpawnMobjFromMobj(player.mo, 0, 0, 0, MT_SPINDUST)
    local dust2 = P_SpawnMobjFromMobj(player.mo, 0, 0, 0, MT_SPINDUST)
    local dust3 = P_SpawnMobjFromMobj(player.mo, 0, 0, 0, MT_SPINDUST)
    local dust4 = P_SpawnMobjFromMobj(player.mo, 0, 0, 0, MT_SPINDUST)
    local dust5 = P_SpawnMobjFromMobj(player.mo, 0, 0, 0, MT_SPINDUST)
    local dust6 = P_SpawnMobjFromMobj(player.mo, 0, 0, 0, MT_SPINDUST)
    local dust7 = P_SpawnMobjFromMobj(player.mo, 0, 0, 0, MT_SPINDUST)
    local dust8 = P_SpawnMobjFromMobj(player.mo, 0, 0, 0, MT_SPINDUST)
    dust1.momx = 25*FRACUNIT
    dust2.momx = -25*FRACUNIT
    dust3.momy = 25*FRACUNIT
    dust4.momy = -25*FRACUNIT
    dust5.momx = 20*FRACUNIT
    dust5.momy = 20*FRACUNIT
    dust6.momx = -20*FRACUNIT
    dust6.momy = 20*FRACUNIT
    dust7.momx = 20*FRACUNIT
    dust7.momy = -20*FRACUNIT
    dust8.momx = -20*FRACUNIT
    dust8.momy = -20*FRACUNIT
     S_StartSound(player.mo, sfx_bnce2)
     P_SetObjectMomZ(player.mo, -player.momz*FRACUNIT)
    return true
end)

The warning:
WARNING: ....2\addons\CSL_Cheeseboi-V2_devbuild.pk3|Lua/LUA_MAIN:108: attempt to perform arithmetic on field 'momz' (a nil value)
stack traceback:
....2\addons\CSL_Cheeseboi-V2_devbuild.pk3|Lua/LUA_MAIN:108: in function <....2\addons\CSL_Cheeseboi-V2_devbuild.pk3|Lua/LUA_MAIN:79>

srb20461.gif
 
you are not setting PF_THOKKED in the pflags i think, just do
Lua:
player.pflags = $|PF_THOKKED
 

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top