addHook("AbilitySpecial", function(p) if not (p and p.mo and p.mo.valid) then return end if p.mo.skin ~= "sonic" then return end -- change with your own character if p.pflags & PF_THOKKED then return true end local currentSpeed = R_PointToDist2(0, 0, p.mo.momx, p.mo.momy) local boost = FixedMul(currentSpeed, FRACUNIT/2) + (5 * FRACUNIT) -- speed related stuff P_Thrust(p.mo, p.mo.angle, boost) P_SetObjectMomZ(p.mo, 8 * FRACUNIT, true) -- the main boost if currentSpeed > 50 * FRACUNIT then p.mo.momz = $ + (6 * FRACUNIT) S_StartSound(p.mo, sfx_zoom) p.thok_trail_active = 60 p.charflags = $ | SF_CANBUSTWALLS end -- buffs for reaching 50 speed, you can change this to a different number local th = P_SpawnMobj(p.mo.x, p.mo.y, p.mo.z + (p.mo.height / 2), MT_THOK) if th and th.valid then th.angle = p.mo.angle th.target = p.mo th.color = p.mo.color th.scale = p.mo.scale end -- thok sprite stuff p.pflags = $ | PF_THOKKED S_StartSound(p.mo, sfx_thok) return true end) -- main buffs code addHook("PlayerThink", function(p) if not (p and p.mo and p.mo.valid) then return end if p.mo.skin ~= "sonic" then return end if P_IsObjectOnGround(p.mo) and p.thok_trail_active and p.thok_trail_active > 0 then p.thok_trail_active = 0 p.charflags = $ & ~SF_CANBUSTWALLS end if p.thok_trail_active and p.thok_trail_active > 0 then p.thok_trail_active = $ - 1 if leveltime % 2 == 0 then local ghost = P_SpawnGhostMobj(p.mo) if ghost and ghost.valid then ghost.color = (leveltime % 4 == 0) and SKINCOLOR_CORNFLOWER or SKINCOLOR_ARCTIC ghost.colorized = true ghost.scale = p.mo.scale ghost.destscale = p.mo.scale ghost.scalespeed = FRACUNIT / 10 end end if p.thok_trail_active == 0 then p.charflags = $ & ~SF_CANBUSTWALLS end else p.thok_trail_active = 0 end end)