Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
TimeOfDeath666

[zdoom 2.8.1] how to make double jump like zdaemon

Recommended Posts

The hard-coded double jump in zdaemon lifts the player up to ~138 z-units. I downloaded this zdoom-compatible double jump script by Agent ME but I can't figure out how to make it jump higher than ~68 units. I made "int dblJumpThrust = 30;" bigger but didn't work, and I tried using a thrust number value in "ThrustThingZ(0, doubleJumpThrust, 0, 0);" but it also didn't work.

#include "zcommon.acs"
#library "dbljump"

// Code by Agent ME
// Free to use/edit/distribute, just give some credit.

// The code should technically use MODINPUT_OLDBUTTONS instead of INPUT_OLDBUTTONS, but there seems to be
// a glitch with the former right now. http://forum.zdoom.org/viewtopic.php?t=21037
// INPUT_OLDBUTTONS works as well in this case anyway.

script 300 enter
{
int maxDblJumps = 1;
int dblJumpThrust = 30;

int lastZ = GetActorZ(0);
int olderZ;
int counter = 0;
while( true )
{
	olderZ = lastZ;
	lastZ = GetActorZ(0);
	delay(1);

	if( (GetPlayerInput(-1, MODINPUT_BUTTONS) & BT_JUMP) && !(GetPlayerInput(-1, INPUT_OLDBUTTONS) & BT_JUMP) )
	{
		if( (GetActorZ(0) > lastZ) && (lastZ <= olderZ) )
		{
			counter = 0;
		} else {
			if(counter < maxDblJumps)
			{
				ThrustThingZ(0, doubleJumpThrust, 0, 0);
				counter++;
			}
		}
	} else if( (olderZ == lastZ) && (lastZ == GetActorZ(0)) )
	{	counter = 0;	}
}
}

Share this post


Link to post

I'm actually a little confused as to how this is compiling in the first place, given that your variable is named "dblJumpThrust" but the ThrustThingZ call is using a nonexistent variable named "doubleJumpThrust"

 

actually might this be why things aren't apparently changing? It might not be compiling at all but you aren't getting the output. I can test this quickly

 

EDIT: there's actually a lot of strange anomalies in that script, from the misnamed variable to some incredibly strange garbage characters in the script when I copied it into slade. Try this script:

#include "zcommon.acs"
#library "dbljump"

// Code by Agent ME
// Free to use/edit/distribute, just give some credit.

// The code should technically use MODINPUT_OLDBUTTONS instead of INPUT_OLDBUTTONS, but there seems to be
// a glitch with the former right now. http://forum.zdoom.org/viewtopic.php?t=21037
// INPUT_OLDBUTTONS works as well in this case anyway.

script 300 enter
{
	int maxDblJumps = 1;
	int dblJumpThrust = 30;

	int lastZ = GetActorZ(0);
	int olderZ;
	int counter = 0;
	while( true )
	{
		olderZ = lastZ;
		lastZ = GetActorZ(0);
		delay(1);

		if( (GetPlayerInput(-1, MODINPUT_BUTTONS) & BT_JUMP) && !(GetPlayerInput(-1, INPUT_OLDBUTTONS) & BT_JUMP) )
		{
			if( (GetActorZ(0) > lastZ) && (lastZ <= olderZ) )
			{
				counter = 0;
			} 
			else 
			{
				if(counter < maxDblJumps)
				{
					ThrustThingZ(0, dblJumpThrust, 0, 0);
					counter++;
				}
			}
		} 
		else if( (olderZ == lastZ) && (lastZ == GetActorZ(0)) )
		{	
			counter = 0;	
		}
	}
}

I tested it in ZD 2.8.1 and it compiled fine and I could change dblJumpThrust to change the force of the jump.

Edited by SaladBadger

Share this post


Link to post

Thanks, your script worked in a test map. I'm trying to make the script as its own stand-alone wad/pk3 like in Agent ME's pk3, so that I can load it along with a boom megawad, but I can't seem to figure out this LOADACS business after reading the zdoom wiki. I created a new wad in XWE, created a lump called LOADACS with "dbljump" written in it, created an A_START marker, created a SCRIPTS lump with your script, and created an A_END lump, but in zdoom it says "could not find autoloaded acs library dbljump". Here's my wad.

EDIT: ok got it working, had to put the BEHAVIOR lump from my test map into the LOADACS stand-alone wad between the A_START/END markers and rename it to the same name as the library "dbljump". The wiki referred to the behavior lump as "the binary lump" in the libraries article.

Edited by TimeOfDeath666

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×