View Full Version : add a key
06-07-2002, 07:59 PM
I made a JetPack and I would like to create a key. When i use the key (or when I type the bound console command) I would like the funtion PM_Jetpack to be launched.
Can u help me ?
06-07-2002, 08:56 PM
create a command and a function and link the command to your fucntion in the array....
(not very clear ..i know..)
06-07-2002, 09:10 PM
You need to do it in g_cmds.c. Make your function toggle some server flag for the caller. I made a new value for pm_flags in playerState_t since the client code shares bg_pmove.c, which is where your jetpack functions will be. Check for the flag in here and launch (no pun intended) the function is it is set.
06-07-2002, 09:15 PM
yeah i m stupid ....
of course it s g_ it s the server !!
whoa i m too tired i ll get some sleep ...
06-07-2002, 10:36 PM
u can allso define a new button in q_shared.h
06-07-2002, 11:04 PM
It's done both in game and cgame.
06-07-2002, 11:21 PM
q_shared.h is a shared header therefor its in all modules, yes, dont forget to build all modules after that.
06-08-2002, 01:12 AM
Yep, you also need to build both cgame and game after messing with bg_pmove.c.
There are two ways of attacking the jetpack problem. The way I'm doing is to have a command "jetpack" which turns the jetpack on. When it's active, jump and duck will control thrust. The other way is to make a new button as you described and apply thrust when it is pressed. That way you can have a separate command while still retaining jump and duck.
The way I'm doing just seems more sensible to me (which is why I'm doing it, duh!) but the key way is still perfectly valid. I also didn't like to use a whole new button when I can get away without doing so in case anyone ever wanted to incorporate the jetpack in a mod which NEEDED a new button. I don't want to waste them...
06-08-2002, 05:23 PM
my JetPack is different...
when you turn it on, you jump back (higher than a forcejump) .
Imagine if you use it with the rocket launcher (that I ameliorated 2) !
I don't want it to be fully controllable. You'll probably just be able to move forward and backward (like in Episode 2).
vBulletin®, Copyright ©2000-2014, Jelsoft Enterprises Ltd.