View Full Version : New Saber throw Mechanic WIP/Help/Brainstorm

01-01-2004, 07:20 AM
The current saber throw mechanics are not representative of the Star Wars Universe. Currently its little more than a yo-yo.

I'd like to make saber throw a single use power.
You throw it and its gone. (until you force pull it back)
I'd also like it to change owners to whoever used forcepull on it.

I'd like to give semi-realistic physics.
Wall sticking. (being worked on)
Player sticking. (Instant death lock win, or stab down when knocked down death)

I'm open to any/all suggestions.

Also I'd like to redo the current throw and make it similar to the way the thermal det is handled. Charge up the throw to determine the distance. Your force level sets the arc, and speed of the spin.

01-01-2004, 07:26 AM
This is my brainstorm right now. Most is similar to the way the Thermal det is handled.

in WP_SaberPositionUpdate

if (self->client->ps.saberInFlight) //keshire
{ //do the thrown-saber stuff
gentity_t *saberent = &g_entities[saberNum];

if (saberent)

if (!self->client->ps.saberEntityState && self->client->ps.saberEntityNum)

vec3_t startorg, startang, dir;

float chargeAmount = 1.0f; // default of full charge

??VectorCopy( forward, dir ); //from thermal code
??VectorCopy( muzzle, start ); //from thermal code

AngleVectors(self->client->ps.viewangles, dir, NULL, NULL);

VectorCopy(boltOrigin, startorg);
VectorCopy(boltAngles, startang);

saberent->s.saberInFlight = qtrue;

WP_SaberAddG2Model( saberent, self->client->saber[0].model, self->client->saber[0].skin );
saberent->s.modelGhoul2 = 127;
self->client->ps.saberEntityState = 1;

saberent->physicsObject = qtrue; //Should I leave this in?

??bolt->classname = "thermal_detonator"; //from thermal

saberent->nextthink = level.time + FRAMETIME;
saberent->think = saberFirstThrown;
saberent->touch = thrownSaberTouch; //maybe NULL?

VectorSet( saberent->r.mins, SABERMINS_X, SABERMINS_Y, SABERMINS_Z );
VectorSet( saberent->r.maxs, SABERMAXS_X, SABERMAXS_Y, SABERMAXS_Z );

??bolt->clipmask = MASK_SHOT; //from thermal

W_TraceSetStart( saberent, startorg, saberent->r.mins, saberent->r.maxs );//make sure our start point isn't on the other side of a wall

if ( saberent->client )
chargeAmount = level.time - saberent->client->ps.weaponChargeTime;

chargeAmount = chargeAmount / (float)TD_VELOCITY;

if ( chargeAmount > 1.0f )
chargeAmount = 1.0f;
else if ( chargeAmount < TD_MIN_CHARGE )
chargeAmount = TD_MIN_CHARGE;

saberent->genericValue5 = 0;

saberent->s.pos.trType = TR_GRAVITY; //set its arc and modify it based on force level

saberent->parent = self;

??bolt->r.ownerNum = ent->s.number;

VectorScale( dir, TD_VELOCITY * chargeAmount, saberent->s.pos.trDelta );

if ( saberent->health >= 0 )
saberent->s.pos.trDelta[2] += 120;

if ( self->client->saber[0].spinSound )
saberent->s.loopSound = self->client->saber[0].spinSound;
saberent->s.loopSound = saberSpinSound;
saberent->s.loopIsSoundset = qfalse;

saberent->damage = SABER_THROWN_HIT_DAMAGE;

saberent->s.eType = ET_GENERAL;
saberent->s.eFlags = 0;
saberent->r.svFlags &= ~(SVF_NOCLIENT);
saberent->s.weapon = WP_SABER;

saberent->methodOfDeath = MOD_SABER;
saberent->splashMethodOfDeath = MOD_SABER;
saberent->s.solid = 2;
saberent->r.contents = CONTENTS_LIGHTSABER;

saberent->s.pos.trTime = level.time;

VectorCopy(startorg, saberent->s.pos.trBase);
VectorCopy(startang, saberent->s.apos.trBase);

VectorCopy(boltOrigin, saberent->r.currentOrigin); //copies current to bolt

??VectorCopy( start, bolt->pos2 );

??bolt->bounceCount = -5;

01-02-2004, 11:19 AM
I don't think making it charge is going to work well. So I just put a standard distance on it. I'll change this based on force level.

01-03-2004, 01:32 AM
Why don't you think charging will work?

And what are the "??" suppose to represent in your code? That you don't know what those lines do? I think I can help you with that. :)

01-03-2004, 03:49 AM
Well I put in all the charging code and it seems to be throwing it even though the button is pressed down. Despite changes to the spot where it determines charging and weaponstate. It was pissing me off too.

01-03-2004, 03:59 AM
And yes the question marked statements were originally fromt he thermal code.

Is it just me or is it just me and you who browse this forum?

01-03-2004, 04:19 AM
I know that Wudan and some n00bs also browse this forum. :)

01-06-2004, 09:44 AM
Ok now for a hard question.

How to go about the saber damage re-working?

From what I can tell

saberCheckRadiusDamage has a similar function to CheckSaberDamage


CheckThrownSaberDamaged has a similar function to SaberRadiusDamage

The main difference (from what I can tell) is the regular damage checks have the saber divided into saber and blade.

as so
void saberCheckRadiusDamage(gentity_t *saberent, int returning)
a check for returning
determining what distance to use.


qboolean CheckThrownSaberDamaged(gentity_t *saberent, gentity_t *saberOwner, gentity_t *ent, int dist, int returning, qboolean noDCheck)

The actual damage function where if damage isn't done it reverts back to the touch function.

01-30-2004, 09:28 PM
You get it all workin?

I had some similar ideas as far as implementing saber throw went...

01-31-2004, 05:47 AM
Everything but the collision and damage re-do is done. RazorAce and RenegadeOfPhunk have the code. Hopefully RazorAce can work in the saber throw into his new collison detection code.

02-01-2004, 09:21 AM
I'm still working on the saber system mechanics but I made excellent progress today after taking a short break from coding.

I hope your progress hasn't been held up by me.