//Used Miguel's ability as a base
addHook("ThinkFrame", function()
for player in players.iterate do
if player.mo and player.mo.valid and player.mo.skin == "fakerguide" then
-- initialize custom variables properly
if player.fdidtech == nil then player.fdidtech = 0 end
if player.fteched == nil then player.fteched = false end
if player.fcheck == nil then player.fcheck = false end
if player.fjumped == nil then player.fjumped = false end

-- reset jump when landing on the ground
if P_IsObjectOnGround(player.mo) then
player.fdidtech = 0
player.fteched = false
player.fjumped = false
end

-- detect the initial jump
if not P_IsObjectOnGround(player.mo) then
player.fjumped = true
end

if player.mo.state == S_PLAY_PAIN and (player.cmd.buttons & BT_JUMP) ~= 0 then
if player.fdidtech == 0 then
-- perform dive
P_SetObjectMomZ(player.mo, 10 * FRACUNIT)
P_InstaThrust(player.mo, player.mo.angle, FixedMul(3 * FRACUNIT, player.mo.scale))
player.mo.state = S_PLAY_ROLL
S_StartSound(player.mo, sfx_jump)
player.pflags = $ |PF_JUMPED
player.mo.colorized = true
player.fdidtech = 1
player.fteched = true

end
end

if player.mo and P_IsObjectOnGround(player.mo) and player.mo.valid and player.mo.skin == "fakerguide" then -- reset the cantech flag when the player touches down again
player.mo.colorized = false
end
end
end
end)