addHook("PlayerThink", function(player)
//Exit this script if player is not in game (can produce errors otherwise)
if not(player.mo) then return end
//Exit this script if player is the wrong skin
if not(player.mo.skin == "sonic") then return end
//Check if player is NOT on ground, and that their state is walking or running. Then set falling state.
if not(P_IsObjectOnGround(player.mo))
and (player.mo.state == S_PLAY_RUN or player.mo.state == S_PLAY_WALK)
player.mo.state = S_PLAY_FALL
end
end)