Double jump


(d@Ve) #21

:drink: ok its compiling with 0 errors and 0 warnings now…but if u set
g_doublejump 1
when u double jump your player is forced downwards…he kinda hesitates in mid air and lunges down :???:

is this part

      if (doublejump == 1 && (pm->cmd.serverTime - pm->pmext->jumpTime < 850) && pm->cmd.doubleTap == DT_UP) 
         pm->ps->velocity[2] = JUMP_VELOCITY * 1.4f;

wrong somewhere

thankz fer the help chruker & jaybird


(jaybird) #22

ok, chruker almost had it right ;]

try this instead


//CHRUKER & jaybird MOD
#ifdef GAMEDLL
extern vmCvar_t g_doublejump;
#define doublejump g_doublejump.integer
#else
#define doublejump 0
#endif

The cgame part is unnecessary without additional work. That should serve just fine. The important part here is the semi-colon following the #define doublejump. DO NOT put a semicolon after a define!!

Let me know if you get it working.

For a more robust implementation, you can try ETPub’s version. The only reason I don’t like this as-is implementation is because of the possibility of the triple jump, which isn’t actually hard at all to fix (involves adding another PMF_ flag).


(jet Pilot) #23

i think the reason you’re getting pushed down after you double jump could be that dj is enabled on your client (cg_doublejump.integer is set) but still disabled serverside (g_doublejump.integer isn’t)
The client predicts the doublejump, but the server says “no you don’t!”, and you get pushed back down where you should be when the client gets the frame from the server.
I think having a cg_doublejump isn’t such a great idea, especially if you do this

{ &g_doublejump, "g_doublejump", "0", CVAR_ROM | CVAR_SERVERINFO, 0, qfalse }, 

take a look at the ETPub implementation, and modify it to suit your taste (I combined chruker’s and etpub’s to make an implementation I’m happy with)


(Demolama) #24

yea you dont need the cgame side of the code…

#ifdef CGAMEDLL
#define DOUBLEJUMP 1
#elif GAMEDLL
#define DOUBLEJUMP g_doublejump.integer
#endif


(jaybird) #25

demoman - if you hardcode the client to doublejump, when you try and it’s disabled on the server, it will be very jerky as described above. Setting it to 0 (and thus disabling it client side) makes it much more playable.

The way to make it correctly predicted client side is to set it up in the serverinfo string (or even better yet, your own config string), and sync it when the server-side cvar changes. This way, you can use a client side cvar and more accurately predict the double jump.


(d@Ve) #26

wheres the etpub source i keep readin about…i couldnt find it on there website? That would probably help me out a bunch. Id learn more if i could see some existin code


(Chruker) #27

http://et.tjw.org/etpub/


(d@Ve) #28

nevermind i found it right after i posted…oops

ok, i got the etpub patch and typed all the doublejump stuff manually to my code and its werkin like it should now. i think my problem was i was i had the cvars in the wrong order. i got it now thankz :clap:


(jmnzcom) #29

all this scripting i see the codes but where do i put them in my level :???:


(nUllSkillZ) #30

It’s not for level design.
These are changes in the source code.