its possible?
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
-
- Posts: 54
- Joined: Sun Jan 21, 2007 12:53 am
- Location: Mexico
its possible?
to give the player a make another jump in mid air? im trying to figure how, ( o btw where i can find more info about the jump in zdoom? i know i can change the height of the jump, but i dont know if its possible to make another jump after the first one its executed)
-
-
- Posts: 10773
- Joined: Sun Jul 20, 2003 12:15 pm
Re: its possible?
I hereby declare this thread to be definitive and the other one a cheap clone. Even though judging from its higher position it came second... whatever. Anyone who posts in the other one, do so at your own risk. ;P
What you achieve can probably be done well using [wiki]GetPlayerInput[/wiki] and [wiki]ThrustThingZ[/wiki] along with [wiki]GetActorZ[/wiki] and [wiki]GetActorFloorZ[/wiki] to check if the player's off the ground.
This was brought up long ago and was impossible to do correctly then, but I never thought of this again until now... crazy how well GetPlayerInput has changed the face of ZDoom. :o
What you achieve can probably be done well using [wiki]GetPlayerInput[/wiki] and [wiki]ThrustThingZ[/wiki] along with [wiki]GetActorZ[/wiki] and [wiki]GetActorFloorZ[/wiki] to check if the player's off the ground.
This was brought up long ago and was impossible to do correctly then, but I never thought of this again until now... crazy how well GetPlayerInput has changed the face of ZDoom. :o
-
- Posts: 4005
- Joined: Sat Dec 30, 2006 4:25 pm
- Location: beautiful hills of those who are friends
Re: its possible?
You could also pull a walljump and combine the jump key with a script key, but that'd mean the users would have to rebind their jump key.
-
- Posts: 2529
- Joined: Mon Mar 22, 2004 7:00 pm
- Preferred Pronouns: He/Him
- Location: California, USA. Previously known as "Agent ME".
Re: its possible?
By using GetPlayerInput you don't need to change any bindings.XutaWoo wrote:You could also pull a walljump and combine the jump key with a script key, but that'd mean the users would have to rebind their jump key.
-
- Posts: 4005
- Joined: Sat Dec 30, 2006 4:25 pm
- Location: beautiful hills of those who are friends
Re: its possible?
Yeah but by using bindings you don't need a constantly running script.
-
-
- Posts: 10773
- Joined: Sun Jul 20, 2003 12:15 pm
Re: its possible?
We could always make the user define a custom keybinding which starts a constantly running script so we could get the worst of both worlds. D:
-
- Posts: 54
- Joined: Sun Jan 21, 2007 12:53 am
- Location: Mexico
Re: its possible?
oh i didnt notice the other topic, since i must disable the antivirus to post... maybe when i refresh the window when i deactivated the antivirus make another post, so im sorry for that. someone can delete the other topic x3??.Xaser wrote:I hereby declare this thread to be definitive and the other one a cheap clone. Even though judging from its higher position it came second... whatever. Anyone who posts in the other one, do so at your own risk. ;P
What you achieve can probably be done well using [wiki]GetPlayerInput[/wiki] and [wiki]ThrustThingZ[/wiki] along with [wiki]GetActorZ[/wiki] and [wiki]GetActorFloorZ[/wiki] to check if the player's off the ground.
This was brought up long ago and was impossible to do correctly then, but I never thought of this again until now... crazy how well GetPlayerInput has changed the face of ZDoom.
thanks for the orientation guys.
-
- Posts: 2529
- Joined: Mon Mar 22, 2004 7:00 pm
- Preferred Pronouns: He/Him
- Location: California, USA. Previously known as "Agent ME".
Re: its possible?
A constantly running script isn't a performance problem at all if the only thing being done in the loop is checking if a control was pressed. The game itself does the equivalent code many times over in different places every tic; waiting on another control isn't bad.
-
- Posts: 2529
- Joined: Mon Mar 22, 2004 7:00 pm
- Preferred Pronouns: He/Him
- Location: California, USA. Previously known as "Agent ME".
Re: its possible?
I've done it.
Now onto the implementation of how this works:
To the double jump, wait until you detect the player press the jump key. Then you need to check if the game made the player jump. If it didn't, thrust the player upwards, and remember that the player did a double jump, so that they can't double jump again until after they've done a normal jump.
To check if the game made the player jump is pretty tricky. You could check if the player's current Z is less than or equal to his last Z, but then he can't double-jump during the upward part of his jump. So my idea is to keep a running total every tic of his last tic's Z (lastZ), and the tic before that (olderZ).
When the jump key is pressed, it's checked if his Z now is greater than lastZ. If it is...
{
The player is moving upward. If lastZ is greater than olderZ, the player was moving upward before he pressed the jump button, so it's assumed this can be a double jump.
Otherwise, his double jump counter is just reset.
}
If his Z now wasn't greater than lastZ, it can be a double jump.
Also, if his Z stays the same for a few tics, reset the double jump counter.
Example code:
(Download is at the top of this post)
Attached is a pk3, that autoloads the script and enables double-jumping in-game. Should work with any level, mod, or game that doesn't use script #300. Completely multiplayer compatible. The script is also easily editable to change the thrust of the double jump, and the max number of double-jumps that player can do per being airborne.Now onto the implementation of how this works:
To the double jump, wait until you detect the player press the jump key. Then you need to check if the game made the player jump. If it didn't, thrust the player upwards, and remember that the player did a double jump, so that they can't double jump again until after they've done a normal jump.
If you used GetActorZ and GetActorFloorZ, you wouldn't be able to check if the player jumped off of a thing.Xaser wrote:What you achieve can probably be done well using [wiki]GetPlayerInput[/wiki] and [wiki]ThrustThingZ[/wiki] along with [wiki]GetActorZ[/wiki] and [wiki]GetActorFloorZ[/wiki] to check if the player's off the ground.
To check if the game made the player jump is pretty tricky. You could check if the player's current Z is less than or equal to his last Z, but then he can't double-jump during the upward part of his jump. So my idea is to keep a running total every tic of his last tic's Z (lastZ), and the tic before that (olderZ).
When the jump key is pressed, it's checked if his Z now is greater than lastZ. If it is...
{
The player is moving upward. If lastZ is greater than olderZ, the player was moving upward before he pressed the jump button, so it's assumed this can be a double jump.
Otherwise, his double jump counter is just reset.
}
If his Z now wasn't greater than lastZ, it can be a double jump.
Also, if his Z stays the same for a few tics, reset the double jump counter.
Example code:
Spoiler:Working code with a counter and a bit of reorganizing:
Spoiler:If you use this in a game that has jumping disabled, then the player can only use double jumps. (This is different than normal gameplay because you can also jump while in mid-air this way.)
(Download is at the top of this post)
You do not have the required permissions to view the files attached to this post.
Last edited by Macil on Mon Feb 23, 2009 1:04 am, edited 1 time in total.
-
- Posts: 54
- Joined: Sun Jan 21, 2007 12:53 am
- Location: Mexico
Re: its possible?
ohh very nice, this its great, thanks for the example and the code description agent me, of course i going to give the credits for the help, im working on another proyect, but since i was thinking "its doom i dont think its possible to do a double jump". i guess im going to be more open minded with Zdoom.
thanks for making the wad explaining how its work (I do not want to be a nuisance ), since i only want to know if a double jump were possible in doom, when we have a little more advanced in the project im going to post some screens well anyways thanks agent me and Zdoom community. (oh btw sorry for the double post, im going to be more careful watching if my antivirus its enable or not)
thanks for making the wad explaining how its work (I do not want to be a nuisance ), since i only want to know if a double jump were possible in doom, when we have a little more advanced in the project im going to post some screens well anyways thanks agent me and Zdoom community. (oh btw sorry for the double post, im going to be more careful watching if my antivirus its enable or not)
Last edited by Zok on Mon Feb 23, 2009 10:20 am, edited 1 time in total.
-
- Posts: 687
- Joined: Fri Nov 21, 2003 1:30 am
- Location: Arizona, USA
Re: its possible?
I added a small bit so you can change direction in midair when you jump.
You do not have the required permissions to view the files attached to this post.