J450N Posted April 13, 2017 Posted April 13, 2017 Hi there !i was hoping that there is a way to speed up saber throw,its a bit floaty and easy to dodge.Would this just be a animation mod or a value change Smoo likes this
Daedra Posted April 13, 2017 Posted April 13, 2017 I honestly think the base animation for saber throw sucks. The animation for it is basically the player holding out their stretched arm while the saber just spins forward and then comes back like a Frisbee. It's actually lame for the most part. Maybe someone could make new animations based on the saber throw from The Force Unleashed: I love how there are two versions. Luke has a super fast one, and the Hoth stalker has a slow one, but yet it still looks faster than the Jedi Academy saber throw. Teancum, Tompa9, Kuhe and 3 others like this
GamingPrince83 Posted April 14, 2017 Posted April 14, 2017 Hi there ! i was hoping that there is a way to speed up saber throw,its a bit floaty and easy to dodge.Would this just be a animation mod or a value change If it's the velocity of the throw you have to edit the code. If your using Visual Studio just edit this in wp_saber.cpp if ( self->client->ps.forcePowerLevel[FP_SABERTHROW] > FORCE_LEVEL_1 || self->client->ps.saberEntityState == SES_RETURNING || VectorCompare( saber->s.pos.trDelta, vec3_origin ) ) {//control if it's returning or just starting float saberSpeed = 500;//FIXME: based on force level? // Edit, saberSpeed = 500 // change the 500 to what ever number you want. float dist; gentity_t *enemy = NULL; AngleVectors( fwdangles, forward, NULL, NULL ); You can also search for "saberSpeed" it will give you everything speed related. Smoo and J450N like this
J450N Posted April 15, 2017 Author Posted April 15, 2017 SaberBlade83 thank you so much !! i really appreciate your fast response !can i still edit the code on mac ? (i know this may seem a silly question) also where is the w_saber.cpp file located ?again thank you for your time Smoo likes this
Smoo Posted April 16, 2017 Posted April 16, 2017 SaberBlade83 thank you so much !! i really appreciate your fast response ! can i still edit the code on mac ? (i know this may seem a silly question) also where is the w_saber.cpp file located ? again thank you for your timeyou can edit code on any os so long as you have a text editor, not sure what you need to compile in mac though J450N likes this
J450N Posted April 17, 2017 Author Posted April 17, 2017 I use PAKSACPE via wine,where do i find this w_saber.cpp ? is it in Assets 1 ? i have tried finding this.cpp file and cannot find it. cheers again guys
Smoo Posted April 17, 2017 Posted April 17, 2017 The source code isn't in the game files, you have to download it from here https://github.com/JACoders/OpenJK or use git J450N likes this
J450N Posted April 17, 2017 Author Posted April 17, 2017 Would i have to do a similar thing to change blaster speed too ?
RecklessJames Posted February 25, 2018 Posted February 25, 2018 I've been spending the last 3 days trying to change the saber spin speed and nothing works, and there is nothing in the codes that references this at all. The code here changes the flight speed, but I'm try to change the rotation speed.... absolutely no where to be found and I'm at a complete loss.
Droidy365 Posted February 26, 2018 Posted February 26, 2018 Hmmm, that's interesting. The saber spins faster at Level 3 than it does at other Levels, so it should be in there somewhere. I'm not a coder, so take this with as many grains of salt you like
RecklessJames Posted February 26, 2018 Posted February 26, 2018 Oh yeah that's a good point! I actually got it now! It was hard to find at first because it wasn't easily identifiable at first, but it did relate to force levels. I changed a lot more than that too actually, cause I like doing experiments with the code. Here are alterations I made under wp_saber.cpp (for Single Player, I haven't tested Multiplayer yet). Here I enabled a 4th level for lightsaber throwing, and also changed the range of distance for them altogether: //NOTE: keep in synch with table below!!! int saberThrowDist[NUM_FORCE_POWER_LEVELS] = { 0,//none 250, //256, 500, //400, 750, //400 1000 }; //NOTE: keep in synch with table above!!! int saberThrowDistSquared[NUM_FORCE_POWER_LEVELS] = { 0,//none 62500, //65536, 250000, //160000, 562500, //160000 1000000 };Here is the main thing that I was looking for that I couldn't find at first, which affects the spinning speed: switch ( self->client->ps.forcePowerLevel[FP_SABERTHROW] ) {//FIXME: make a table? default: case FORCE_LEVEL_1: saber->s.apos.trDelta[1] = 600; break; case FORCE_LEVEL_2: saber->s.apos.trDelta[1] = 800; break; case FORCE_LEVEL_3: saber->s.apos.trDelta[1] = 1200; break; case FORCE_LEVEL_4: saber->s.apos.trDelta[1] = 2000; break; }And then this next one is the most I've screwed with... here I made changes to speeds, added the 4th level behavior, and also decided to make it so it continues cutting the wall without returning to your hand. I also made it so level 3 and 4 sabers will continue spinning when returning to your hand! void WP_RunSaber( gentity_t *self, gentity_t *saber ) { extern qboolean returnDamage; vec3_t origin, oldOrg; vec3_t saberMins = { -3.0f,-3.0f,-3.0f }; vec3_t saberMaxs = { 3.0f,3.0f,3.0f }; trace_t tr; VectorCopy( saber->currentOrigin, oldOrg ); // get current position EvaluateTrajectory( &saber->s.pos, level.time, origin ); // get current angles EvaluateTrajectory( &saber->s.apos, level.time, saber->currentAngles ); // trace a line from the previous position to the current position, // ignoring interactions with the missile owner int clipmask = saber->clipmask; if ( !self || !self->client || self->client->ps.SaberLength() <= 0 ) {//don't keep hitting other sabers when turned off clipmask &= ~CONTENTS_LIGHTSABER; } gi.trace( &tr, saber->currentOrigin, saber->mins, saber->maxs, origin, saber->owner ? saber->owner->s.number : ENTITYNUM_NONE, clipmask, (EG2_Collision)0, 0 ); VectorCopy( tr.endpos, saber->currentOrigin ); if ( self->client->ps.SaberActive() ) { if ( self->client->ps.saberInFlight || (self->client->ps.weaponTime&&!Q_irand( 0, 100 )) ) {//make enemies run from a lit saber in flight or from me when I'm attacking if ( !Q_irand( 0, 10 ) ) {//not so often... AddSightEvent( self, saber->currentOrigin, self->client->ps.SaberLength()*3, AEL_DANGER, 100 ); } } } if (tr.startsolid) { tr.fraction = 0; } gi.linkentity(saber); //if (tr.fraction != 1) //{//touch push triggers? // WP_SaberImpact(self, saber, &tr); //} if (saber->s.pos.trType == TR_LINEAR) {//home //figure out where saber should be vec3_t forward, saberHome, saberDest, fwdangles = { 0 }; VectorCopy(self->client->ps.viewangles, fwdangles); if (self->s.number) { fwdangles[0] -= 8; } else if (cg.renderingThirdPerson) { fwdangles[0] -= 5; } if (self->client->ps.forcePowerLevel[FP_SABERTHROW] > FORCE_LEVEL_1 || self->client->ps.saberEntityState == SES_RETURNING || VectorCompare(saber->s.pos.trDelta, vec3_origin)) {//control if it's returning or just starting float saberSpeed = 500; float dist; gentity_t *enemy = NULL; AngleVectors(fwdangles, forward, NULL, NULL); if (self->client->ps.saberEntityDist < 100) {//make the saber head to my hand- the bolt it was attached to VectorCopy(self->client->renderInfo.handRPoint, saberHome); } else {//aim saber from eyes VectorCopy(self->client->renderInfo.eyePoint, saberHome); } VectorMA(saberHome, self->client->ps.saberEntityDist, forward, saberDest); if (self->client->ps.forcePowerLevel[FP_SABERTHROW] > FORCE_LEVEL_2 && self->client->ps.saberEntityState == SES_LEAVING) { if (self->enemy && !WP_SaberValidateEnemy(self, self->enemy)) {//if my enemy isn't valid to auto-aim at, don't autoaim } else { //pick an enemy enemy = WP_SaberFindEnemy(self, saber); if (enemy) {//home in on enemy float enemyDist = Distance(self->client->renderInfo.handRPoint, enemy->currentOrigin); VectorCopy(enemy->currentOrigin, saberDest); saberDest[2] += enemy->maxs[2] / 2.0f;//FIXME: when in a knockdown anim, the saber float above them... do we care? self->client->ps.saberEntityDist = enemyDist; //once you pick an enemy, stay with it! saber->enemy = enemy; //FIXME: lock onto that enemy for a minimum amount of time (unless they become invalid?) } } } //Make the saber head there VectorSubtract(saberDest, saber->currentOrigin, saber->s.pos.trDelta); dist = VectorNormalize(saber->s.pos.trDelta); if (self->client->ps.forcePowerLevel[FP_SABERTHROW] > FORCE_LEVEL_2 && self->client->ps.saberEntityState == SES_LEAVING && !enemy) { if (dist < 200) { saberSpeed = 400 - (dist * 2); } } else if (self->client->ps.saberEntityState == SES_LEAVING && dist < 50) { saberSpeed = dist * 2 + 30; if ((enemy && dist > enemy->maxs[0]) || (!enemy && dist > 24)) {//auto-tracking an enemy and we can't hit him if (saberSpeed < 120) {//clamp to a minimum speed saberSpeed = 120; } } } if (self->client->ps.forcePowerLevel[FP_SABERTHROW] > FORCE_LEVEL_2 && self->client->ps.saberEntityState == SES_RETURNING && !(self->client->ps.saber[0].saberFlags&SFL_RETURN_DAMAGE)) {//FIXME: if returning, move faster? qboolean returnDamage = 3.0f; self->client->ps.saberEntityState = SES_LEAVING; saberSpeed = 800; if (dist < 200) { saberSpeed -= 400 - (dist * 2); } } if (self->client->ps.forcePowerLevel[FP_SABERTHROW] > FORCE_LEVEL_3 && self->client->ps.saberEntityState == SES_LEAVING && !enemy) { saberSpeed = 800; } VectorScale(saber->s.pos.trDelta, saberSpeed, saber->s.pos.trDelta); VectorCopy(saber->currentOrigin, saber->s.pos.trBase); saber->s.pos.trTime = level.time; saber->s.pos.trType = TR_LINEAR; } else { VectorCopy(saber->currentOrigin, saber->s.pos.trBase); saber->s.pos.trTime = level.time; saber->s.pos.trType = TR_LINEAR; } if (self->client->ps.saberEntityState == SES_RETURNING && !(self->client->ps.saber[0].saberFlags&SFL_RETURN_DAMAGE))//type != SABER_STAR ) {//if it's heading back, point it's base at us fwdangles[0] += SABER_PITCH_HACK; saber->s.apos.trType = TR_INTERPOLATE; VectorClear(saber->s.apos.trDelta); } } }Hopefully this helps out with others wanting to edit lightsaber throwing more. I'm still very new to this (as well as coding in general) and I'm learning as I go, so it might be a bit messy lol. This code was originally based off a combination of custom OpenJK source code and Jedi Academy: Enhanced, before I made these changes that is. The next things we need that would be cool is to have custom trail effects for specifically throwing the lightsaber, that way it can have a cool spinning look to it. Maybe even a way to throw a 2nd lightsaber? I'm sure these two things are possible, but haven't figured them out yet.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now