Jump to content

Home

Facing ?


GangsterAngel

Recommended Posts

Hey , id realy appreciate help here.

 

im doing a 'Thing' where if you "Use" the player you are gripping

aslong as u have been gripping them for 2 secconds you throw them.

 

i need to know how i make the player be thrown to the left evry time

( no matter what direction the thrower is facing )

 

im a little lost to tell the truth.....

 

heres the code i have now.

 

//RPG MOD ======== ( Throwing someone ) [ Let go of user so they can be thrown ]
if (ent->client->pers.RPG_StopGripTime !=NULL && ent->client->pers.RPG_StopGripTime < level.time) {
//=============================
//Make sure thrower is still gripping
	if( UsingFP(ent,FP_GRIP) == 1 && ent->health > 0/* && ent->client->ps.torsoAnim==BOTH_FORCEGRIP3THROW*/) {
//=============================
gentity_t *gripped = &g_entities[ent->client->ps.fd.forceGripEntityNum];
//===============================
WP_ForcePowerStop(ent,FP_GRIP);
gripped->client->pers.RPG_ThrowTime=level.time+50;
ent->client->pers.RPG_StopGripTime=NULL;

	}
	else {
//Invalid throw . no longer gripping or dead
ent->client->pers.RPG_StopGripTime=NULL;
	}
}

//RPG MOD ============================== ( Been Thrown )
if (ent->client->pers.RPG_ThrowTime !=NULL && ent->client->pers.RPG_ThrowTime < level.time) {
//Make sure they are still gripped
//		if(ent->client->ps.fd.forceGripBeingGripped > level.time) {

//Make sure the thrower is still alive and in the BOTH_FORCEGRIP3THROW anim

//FIXME: Work out what direction user is facing, and throw to the left.

ent->client->ps.velocity[0]+=400;
ent->client->ps.velocity[1]+=60;
ent->client->ps.velocity[2]+=300;

/*
//FIX: That Dosent work lol
gentity_t *gripper = &g_entities[ent->client->pers.RPG_Gripper];
vec3_t fwd, tto;
AngleVectors(gripper->client->ps.viewangles, fwd, NULL, NULL);
tto[0] += fwd[0]+400;
tto[1] +=60;
tto[2] += fwd[2]+300;
//---
ent->client->ps.velocity[0]+=tto[0];
ent->client->ps.velocity[2]+=tto[1];
ent->client->ps.velocity[3]+=tto[2];
//---
*/

ent->client->pushEffectTime =level.time+100;

		ent->client->ps.forceHandExtend = HANDEXTEND_KNOCKDOWN;
		ent->client->ps.forceDodgeAnim = 0;
		ent->client->ps.forceHandExtendTime = level.time + 600;
		ent->client->ps.quickerGetup = qfalse;

G_Sound(ent, CHAN_WEAPON, G_SoundIndex( "sound/weapons/force/push.mp3" ) );
G_Sound(ent, CHAN_WEAPON, G_SoundIndex( "sound/weapons/force/push.wav" ) );

ent->client->pers.RPG_ThrowTime=NULL;
//	}//<< still been gripped

}
//===================================

Link to comment
Share on other sites

Got it , thanx

 

//FIXME: Work out what direction user is facing, and throw to the left. ( FIXED )
vec3_t angs;
vec3_t pushDir;
gentity_t *gripper = &g_entities[ent->client->pers.RPG_Gripper];
VectorCopy( gripper->client->ps.viewangles, angs );
//--Ad abit of randimizeation
angs[YAW] += flrand( 25, 50 );
angs[PITCH] = flrand( -25, -15 );
angs[ROLL] = 210;//120; // + = Left , -= Right
//---------------------------
AngleVectors( angs, pushDir, NULL, NULL );
G_Throw( ent, pushDir, 65 + gripper->client->ps.fd.forcePower);

Link to comment
Share on other sites

Actually [ROLL] is like the motion caused by rocking your head left/right while staring straight forward.

 

instead I'd do...

//FIXME: Work out what direction user is facing, and throw to the left. ( FIXED )
vec3_t angs;
vec3_t pushDir;
gentity_t *gripper = &g_entities[ent->client->pers.RPG_Gripper];
VectorCopy( gripper->client->ps.viewangles, angs );
//--Ad abit of randimizeation
angs[YAW] += flrand( 25, 50 );
angs[PITCH] = flrand( -25, -15 );
//---------------------------
//finding the vector pointing to the right of the angles set by angs.
AngleVectors( angs, NULL, pushDir, NULL ); 
//reversing our right vector to make it point left.
VectorScale(pushDir, -1, pushDir);
G_Throw( ent, pushDir, 65 + gripper->client->ps.fd.forcePower);

This way you're actually doing your vector math right instead of winging it.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...