Jump to content

Home

Help with jetpack


MDN14

Recommended Posts

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:

 

/*

===================

PM_JetpackMove

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 = scale * pml.forward*pm->cmd.forwardmove + scale * pml.right*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 );

traces++;

// WP_DisruptorMainFire( ent );

continue;

}

 

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

 

hit.jpg

didnt_go_through.jpg

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...