Wall Run Ability

If you are starting out and a beginner at coding then i dont recommend doing such hard stuff. The wall check is a pain, the climbing is a pain. Wall stuff in general is a pain. Maybe you should start with something different? But if you still want a wall run then i guess you could edit some reusable resources which have a wall run.
 
you would need a "PlayerThink" hook and a "MobjMoveBlocked" hook, as well as a "JumpSpecial" hook, this is pretty complex but ive listed an example below if you would like to look at it

BASIC WALL JUMP:
// this is to set some vars used for later, only do this if your playing as sonic
addHook("PlayerThink", function(player)
    if not player and player.valid and player.mo.skin == "sonic" and and player.playerstate == PST_LIVE return end
    if player.mo.collidewall == nil
        player.mo.collidewall = false
    end
    if player.mo.collidewall == true
        player.mo.collidewall = false
    end
end)

// this is for checking if your blocked from moving by say, a wall? also checks if your moving towards it as well as a character check.
addHook("MobjMoveBlocked", function(mo)
    if mo.player and mo.skin == "sonic" and mo.valid and mo.player.playerstate == PST_LIVE
        if not P_IsObjectOnGround(mo)
            if not (mo.player.pflags & PF_ANALOGMODE)
                if mo.player.cmd.forwardmove > 0
                mo.collidewall = true
                end
            else
                if not (mo.player.cmd.forwardmove == 0)
                or not (mo.player.cmd.sidemove == 0)
                mo.collidewall = true
                end
            end
        end
    end
end, MT_PLAYER)

// this is for when your on the wall and you hit jump, another character check as pre usaual.
addHook("JumpSpecial", function(player)
    if player.mo and player.mo.skin == "sonic" and player.mo.valid and player.playerstate == PST_LIVE
        if player.mo.collidewall
            P_DoJump(player)
            S_StartSound(player.mo, sfx_zoom)
            P_InstaThrust(player.mo, player.mo.angle, -5*FRACUNIT)
            P_SetObjectMomZ(player.mo, 15*FRACUNIT)
            player.pflags = $1 & ~(PF_THOKKED)
            player.mo.collidewall = false
        return true
        end
    end
end)
 

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

Back
Top