How to use a shield's ability without the shield part in Lua

Tempmarrow

Average beatdown enjoyer
For example
Shield Abilities:
addHook("ThinkFrame", do
    for player in players.iterate
        if (player.mo and player.mo.skin == "sonic")
            if not (player.mo.custom2down)
                player.mo.custom2down = 0
            end
            if player.cmd.buttons & BT_CUSTOM2
            and player.powers[pw_shield] == SH_NONE
            and player.mo.custom2down == 0
                player.mo.custom2down = 1
                player.powers[pw_shield] = SH_ELEMENTAL
            end
            if player.cmd.buttons & BT_CUSTOM2
            and player.powers[pw_shield] == SH_ELEMENTAL
            and player.mo.custom2down == 0
                player.mo.custom2down = 1
                player.powers[pw_shield] = SH_BUBBLEWRAP
            end
            if player.cmd.buttons & BT_CUSTOM2
            and player.powers[pw_shield] == SH_BUBBLEWRAP
            and player.mo.custom2down == 0
                player.mo.custom2down = 1
                player.powers[pw_shield] = SH_WHIRLWIND
            end
            if player.cmd.buttons & BT_CUSTOM2
            and player.powers[pw_shield] == SH_WHIRLWIND
            and player.mo.custom2down == 0
                player.mo.custom2down = 1
                player.powers[pw_shield] = SH_ATTRACT
            end
                if player.cmd.buttons & BT_CUSTOM2
            and player.powers[pw_shield] == SH_ATTRACT
            and player.mo.custom2down == 0
                player.mo.custom2down = 1
                player.powers[pw_shield] = SH_THUNDERCOIN
            end
            if player.cmd.buttons & BT_CUSTOM2
            and player.powers[pw_shield] == SH_THUNDERCOIN
            and player.mo.custom2down == 0
                player.mo.custom2down = 1
                player.powers[pw_shield] = SH_ARMAGEDDON
            end
            if player.cmd.buttons & BT_CUSTOM2
            and player.powers[pw_shield] == SH_ARMAGEDDON
            and player.mo.custom2down == 0
                player.mo.custom2down = 1
                player.powers[pw_shield] = SH_NONE
            end
            if not (player.cmd.buttons & BT_CUSTOM2)
                player.mo.custom2down = 0
            end
        end
    end
end)
 
I don't believe there is a way to play those effects directly without re-writing them yourself. You could try to store the player's current shield, force them to press spin in the PreThinkFrame and restore their shield after the ability activates, but that would be EXTREMELY easy to mess up.


Thankfully, the shield action code is located here, and most of it is relatively simple enough to replicate. P_DoJumpShield and P_BlackOw are already exposed to Lua, so you do not need to re-write them.
 

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

Back
Top