Adding triple jump to your engine

Explanation for how to add triple jump (based off the YoYoYo engine for GMStudio, but the concept applies to all engines)

 playerJump script

if (place_meeting(x,y+(global.grav),objBlock) || onPlatform || place_meeting(x,y+(global.grav),objWater))
{
    vspeed = -jump;
    //djump = 1; <--replace this line with this one:
    djump = 2; //give 2 jumps back
    audio_play_sound(sndJump,0,0);
}
// else if (djump == true || place_meeting(x,y+(global.grav),objWater2)) <--replace this line with this one:
else if (djump > 0 || place_meeting(x,y+(global.grav),objWater2)) //lets you djump if you have at least one remaining
{
    vspeed = -jump2;
    sprite_index = sprPlayerJump;
    audio_play_sound(sndDJump,0,0);
    
    if (!place_meeting(x,y+(global.grav),objWater3))
        //djump = 0; <-- replace this line with this one:
        djump-=1; //remove one from djump counter, allows you to djump again later if you still have one
}

 player collision with block

if(!place_free(x+hspeed,y))
{
    //left/right collisions with block, removed for brevity
}
 
if(!place_free(x,y+vspeed))
{
    if (global.grav == 1)
    {
        if(vspeed <= 0){move_contact_solid(90,abs(vspeed));}
        //if(vspeed > 0){move_contact_solid(270,abs(vspeed));djump=1;} <-- replace this line with this one:
        if(vspeed > 0){move_contact_solid(270,abs(vspeed));djump=2;} //set djump to 2, giving you two djumps back
    }
    else
    {
        //if(vspeed <= 0){move_contact_solid(90,abs(vspeed));djump=1;} <-- replace this line with this one:
        if(vspeed <= 0){move_contact_solid(90,abs(vspeed));djump=2;} //set djump to 2, giving you two djumps back
        if(vspeed > 0){move_contact_solid(270,abs(vspeed));}
    }
    vspeed = 0;
}

if (!place_free(x+hspeed,y+vspeed)) {hspeed = 0;}

 scrLoadGame Script

//Only applies to the YoYoYo Engine!
//Allows you to triple-jump immediately if you saved in midair

//find this line:
global.player_djump = 1;
//and replace with this:
global.player_djump = 2;

 scrInitializeVariables Script

//Only applies to the YoYoYo Engine!
//Allows you to triple-jump immediately if you spawn in midair

//find this line:
global.player_djump = 1;
//and replace with this:
global.player_djump = 2;

 scrKillPlayer Script

//Only applies to the YoYoYo Engine!
//Allows you to triple-jump immediately if the player dies and a new one is created without loading, and is created in midair
//(yeah it's a contrived example but I'm just including it for completeness Keepo)

//find this line:
global.player_djump = 1;
//and replace with this:
global.player_djump = 2;