GangsterAngel Posted August 3, 2005 Share Posted August 3, 2005 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 More sharing options...
GangsterAngel Posted August 3, 2005 Author Share Posted August 3, 2005 come on , i know some of u out their could help me..eg ,Razor !.. PLEASE! , lol Link to comment Share on other sites More sharing options...
ensiform Posted August 3, 2005 Share Posted August 3, 2005 look at debugthrow maybe in g_cmds.c or how the rancor tosses you possibly. also there is a G_Throw function somewhere if i remember correctly. Link to comment Share on other sites More sharing options...
GangsterAngel Posted August 3, 2005 Author Share Posted August 3, 2005 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 More sharing options...
razorace Posted August 4, 2005 Share Posted August 4, 2005 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 More sharing options...
GangsterAngel Posted August 4, 2005 Author Share Posted August 4, 2005 Humm . yeah , thats alot more left. with my code it was kinda alot fowards and a little left. looked ok though. but yeah , urs is deffantly alot more left. thanx razor Link to comment Share on other sites More sharing options...
razorace Posted August 4, 2005 Share Posted August 4, 2005 My method is using vector math left, which is what I thought you were shooting for. And you're welcome. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.