-- Hello! If you want to use any code of my mod into yours, fell free to use, just credit me tho. I also recommend you see the mods in the credits. -- Here the code register the crouch states freeslot("S_PLAY_CROUCH", "S_PLAY_UNCROUCH") states[S_PLAY_CROUCH] = { sprite = SPR_PLAY, frame = A|SPR2_LAND, var1 = 0, var2 = 0, tics = 2, nextstate = S_PLAY_CROUCH } states[S_PLAY_UNCROUCH] = { sprite = SPR_PLAY, frame = FF_SPR2ENDSTATE|SPR2_LAND, var1 = S_PLAY_STND, var2 = 0, tics = 2, nextstate = S_PLAY_UNCROUCH } -- This is the custom crouch ability, so you can use it like a S_SKIN ability2 rawset(_G,"CA2_CROUCH",22) -- This is the crouch and spin action addHook("SpinSpecial", function(player) --This is the crouch section if player.charability2 == CA2_CROUCH --If the player has the crouch as ability2 and player.speed <= 3*FRACUNIT --And his speed is below 3*FRACUNIT and P_IsObjectOnGround(player.mo) --And is on the ground player.normalspeed = 0 --Set his normal max speed to 0, so he cant move player.mo.state = S_PLAY_CROUCH --Set his state to the custom crouch state player.height = skins[player.mo.skin].spinheight --Set his height to the character spin height end --This is the spin section if player.charability2 == CA2_CROUCH --If the player has the crouch as ability2 and player.speed >= 3*FRACUNIT --And his speed is above 3*FRACUNIT and P_IsObjectOnGround(player.mo) --And is on the ground and not (player.pflags & PF_SPINNING) --And he is not spinning player.pflags = $|PF_SPINNING --Make the player spin player.mo.state = S_PLAY_ROLL --Set his state to rolling S_StartSound(player.mo, sfx_spin) --Play the spin sound end end) -- This is the spindash action addHook("JumpSpecial", function(player) if player.charability2 == CA2_CROUCH --If the player has the crouch as ability2 and player.mo.state == S_PLAY_CROUCH --and he is crouching player.pflags = $|PF_SPINNING|PF_STARTDASH|PF_SPINDOWN|PF_JUMPDOWN -- Make the player charge a spindash player.charability2 = CA2_SPINDASH -- change his ability2 to spindash or it wont charge (Thanks lav for explaining that to me on the SRB2 discord server) player.mo.state = S_PLAY_SPINDASH --Set his state to spindash, or it will look like the player is rolling player.normalspeed = skins[player.mo.skin].normalspeed --Set his normal max speed to the character default, so he can move again S_StartSound(player.mo, sfx_spndsh) --Play the spindash sound end end) --This is the uncrouch action and where the code makes characters with the vannila spindash have the crouch ability addHook("PlayerThink", function(player) --This is the replacement of spindash to crouch section if player.charability2 == CA2_SPINDASH --If the player has the crouch as ability2 and not (player.pflags & PF_STARTDASH) --And its not charging a spindash, so he can charge up the spindash when doing player.charability2 = CA2_CROUCH --Set his ability2 to crouch end --This is the uncrouch section if player.mo.state == S_PLAY_CROUCH --If the player is crouching and not (player.pflags & PF_SPINDOWN) --and he released the spin button player.mo.state = S_PLAY_UNCROUCH --Set his state to the custom uncrouch state player.height = skins[player.mo.skin].height --Set his height to the character default height player.normalspeed = skins[player.mo.skin].normalspeed --Set his normal max speed to the character default, so he can move again end end) --Those are all the spin changes addHook("PlayerThink", function(player) --Here the code makes the player move more freely when spinning if player.pflags & PF_SPINNING --If the player is spinning and not (player.pflags & PF_STARTDASH) --and its not charging a spindash player.thrustfactor = (skins[player.mo.skin].thrustfactor)*5 --Mutiple the thrustfactor by 5 (thats what sets how the moving control, the higher the better you can move control) else player.thrustfactor = skins[player.mo.skin].thrustfactor --Set the thrustfactor to the character default end --Here the code remove the roll jump lock if player.pflags & PF_SPINNING --If the player is spinning and player.pflags & PF_JUMPED --And has jumped player.pflags = $ & ~PF_SPINNING --Removes the constant that makes the player spin, so you control your jump as if you dint spin frist end end)