lfnetwork.com mark read register faq members calendar

Thread: Help with jetpack
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 04-19-2005, 02:44 PM   #1
Join Date: Sep 2003
Posts: 159
Help with jetpack and disruptor

I am still learning alot of the stuff with making mods and hardly know anything really. But I am trying to make a jetpackin my mod that works like the darkt rooper jetpack in Star Wars Battlefront. I know that JA already has a jetpack in it and everything,but I dont want to edit that at all. I want to make a new thing where when the player types "/jetpack" then t puts the jetpack model on the players back and when the player is in the air (just starts jumping) if they press jump again, then it activates the new jetpack. This jetpack should play the effecs like the old normal jetpack does, and the sounds, but it should just "shoot" the player upwards and in the direction they are facing, I want it to shoot them up about 20% higher than a force jump lvl 3 does, and it should only push them forward if the player is holding forward at the time that the justpack was activated, otherwise it just pushes them straight up. But I only want the player to be able to use the jetpack when 1) they have the jetpack on their back, 2) only when they have just started jumping in the air (within 500 miliseconds of starting to jump, so half a second). Making it so they can only activate the jetpack just after they start jumping will be to prevent players from simply using the jetpack to save themselves if they get pushed off aledge and are about to de, because I dont know about you, but I find it highly annoying when people dont die when they should. Anyway, also want to make it so the player cant use the jetpack again for 10 seconds. I found a quake 3 tutorial about making a jetpack, but it kinda justs pushes the player upward while he/she is holding the button. This is what I have for the jetpack right now, but it is still a long way from where I want it to be:

Use the jetpack.
static void PM_JetpackMove( void ) {
int i;
vec3_t wishvel;
float wishspeed;
vec3_t wishdir;
float scale;

// normal slowdown
PM_Friction ();

scale = PM_CmdScale( &pm->cmd );
// user intentions
if ( !scale ) {
wishvel[0] = 0;
wishvel[1] = 500; //< this pushes you in a "north" direction, I want to go "forward" from where the player is facing, not just "north"
wishvel[2] = 2000; //< this is upward thrust (bigger number, more thrust)
} else {
for (i=0 ; i<3 ; i++) {
wishvel[i] = scale * pml.forward[i]*pm->cmd.forwardmove + scale * pml.right[i]*pm->cmd.rightmove;

VectorCopy (wishvel, wishdir);
wishspeed = VectorNormalize(wishdir);

PM_Accelerate (wishdir, wishspeed, pm_jetpackaccelerate); //< use the jetpack acceleration factor

PM_StepSlideMove( qtrue ); //< make this true to make gravity affect you

I have that in between the PM_FlyMove and PM_AirMove area of the bg_pmove.c file.

Also, I am having trouble getting my disruptor to be able to shoot through walls. I found a tutorial for the railgun in quake 3 to be able to do this and I was trying to copy it over to make it work for the disruptor rifle in JA. I have this almost at the very bottom of the "static void WP_DisruptorMainFire( gentity_t *ent )" section in the g_weapons.c file:

// prepare for firing through the wall
VectorCopy ( tr.endpos, muzzle );
VectorCopy ( tr.endpos, muzzle );
VectorMA ( muzzle, DISRUPTOR_WALL_MAX, forward, muzzle );

if ( !( trap_PointContents( muzzle, -1 ) & CONTENTS_SOLID ) )
trap_Trace (traceEnt, muzzle, NULL, NULL, tr.endpos, ent->s.number, MASK_SHOT );
VectorCopy (tr.endpos, muzzle);

WP_DisruptorMainFire( ent );
VectorCopy ( tr.endpos, muzzle );

Yes I did define the DISRUPTOR_WALL_MAX before this, that isnt the problem. The problem I am having is that the grame crashes with a "G_Spawn: No Free Entities" error every time I shoot the disruptor rifle (main fire only) and it hits a "thin" wall. If I shoot a brush that is thicker than 128 units, the shot does not go through the wall, and the game does not crash. But if I shoot a brush smaller than 128 units, the game crashes with that g_spawn error.

So if you can help with either of those I would greatly appreciate it

EDIT: I moved the disruptor thing to right below the jedi dodge area. I think tha the line:

trap_Trace ( traceEnt, muzzle, NULL, NULL, tr.endpos, ent->s.number, MASK_SHOT );

was what was causing the crash problem. I changed the code to be like this:

if ( !( trap_PointContents( muzzle, -1 ) & CONTENTS_SOLID ) )
// if ( trap_Trace( traceEnt, start, vec3_origin, vec3_origin, end, ent->s.number, CONTENTS_SOLID ) )
{//act like we didn't even hit the wall
VectorCopy( tr.endpos, start );
VectorCopy( tr.endpos, muzzle );
VectorCopy( tr.endpos, muzzle );
// VectorMA ( muzzle, DISRUPTOR_WALL_MAX, forward, muzzle );
// trap_Trace ( &tr, start, NULL, NULL, end, ignore, MASK_SHOT );
// trap_Trace ( traceEnt, muzzle, NULL, NULL, tr.endpos, ent->s.number, MASK_SHOT );
// VectorCopy ( tr.endpos, muzzle );
// WP_DisruptorMainFire( ent );

I was messing around with it alot, so thats why there are so many things commented out. Anyway, it seemes to work, but only some times. I dont know why it works sometimes and doesnt work other times, am I even on the right track at all?

I took 2 screenshots of me using the disruptor in game, one showing it shooting through the ground, and the other not going through it, same brush I think, just over slightly and looking in a different direction. I dont think how far away the enemy is has anything to do with it working or not, because I can shoot an enemy through some walls at taspir from all the way across the map :S


Last edited by MDN14; 04-19-2005 at 11:47 PM.
MDN14 is offline   you may: quote & reply,
Old 04-22-2005, 08:07 PM   #2
Impressive, Terran!
razorace's Avatar
Join Date: May 2002
Posts: 9,172
"G_Spawn: No Free Entities" means that something in your code is creating so many entities (probably the effect entity) that it's crashing the game.

---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > JediKnight Series > Editing Central > JA Coding > Help with jetpack

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT -4. The time now is 08:51 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.