LucasForums

LucasForums (http://www.lucasforums.com/index.php)
-   JA Coding (http://www.lucasforums.com/forumdisplay.php?f=539)
-   -   [Fix] 2handed Lightning (http://www.lucasforums.com/showthread.php?t=203314)

Kimberly 03-31-2010 03:31 PM

[Fix] 2handed Lightning
 
I just want to share this fix you guys ;)

----------------------------------------
The following code is made by the author
----------------------------------------

In w_force.c
(that part handles the damage)

Search "jackin' 'em up" and replace the conditions with this code:
Code:

/*
 *
 * Added by Kimmy
 * Conditions for 2handed lightning
 *
 */
if ( self->client->ps.weapon == WP_NONE
|| self->client->ps.weapon == WP_MELEE
|| self->client->ps.weapon == WP_SABER
&& self->client->ps.saberHolstered
&& self->client->ps.fd.forcePowerLevel[FP_LIGHTNING] > FORCE_LEVEL_2 )
                                {//2-handed lightning
                                        //jackin' 'em up, Palpatine-style
                                        dmg *= 2;
                                }


In cg_players.c
(the origin and such stuff)

Search "doing the electrocuting"

And add this part

Code:

/*
 * Added by Kimmy
 * 2handed lightning should work now
 *
 */

                vec3_t axis[3];
                vec3_t tAng, fAng, fxDir;
                vec3_t efOrgL; //origin left hand
                vec3_t efOrgR; //origin right hand

                VectorSet( tAng, cent->turAngles[PITCH], cent->turAngles[YAW], cent->turAngles[ROLL] );

                VectorSet( fAng, cent->pe.torso.pitchAngle, cent->pe.torso.yawAngle, 0 );

                AngleVectors( fAng, fxDir, NULL, NULL );

                if ( cent->currentState.torsoAnim == BOTH_FORCE_2HANDEDLIGHTNING_HOLD )
                {
                        mdxaBone_t        rHandMatrix;
                        trap_G2API_GetBoltMatrix(cent->ghoul2, 0, ci->bolt_rhand, &rHandMatrix, cent->turAngles, cent->lerpOrigin, cg.time, cgs.gameModels, cent->modelScale);
                        efOrgR[0] = rHandMatrix.matrix[0][3]; //right hand matrix -> efOrgR
                        efOrgR[1] = rHandMatrix.matrix[1][3];
                        efOrgR[2] = rHandMatrix.matrix[2][3];       
                       
                        if (!gotLHandMatrix)
                        {
                                trap_G2API_GetBoltMatrix(cent->ghoul2, 0, ci->bolt_lhand, &lHandMatrix, cent->turAngles, cent->lerpOrigin, cg.time, cgs.gameModels, cent->modelScale);
                                gotLHandMatrix = qtrue;
                        }
                        efOrgL[0] = lHandMatrix.matrix[0][3]; //left hand matrix -> efOrgL
                        efOrgL[1] = lHandMatrix.matrix[1][3];
                        efOrgL[2] = lHandMatrix.matrix[2][3];
                }
                else
                {
                        if (!gotLHandMatrix)
                        {
                                trap_G2API_GetBoltMatrix(cent->ghoul2, 0, ci->bolt_lhand, &lHandMatrix, cent->turAngles, cent->lerpOrigin, cg.time, cgs.gameModels, cent->modelScale);
                                gotLHandMatrix = qtrue;
                        }
                        efOrgL[0] = lHandMatrix.matrix[0][3]; //just for the simple lightning from the left hand
                        efOrgL[1] = lHandMatrix.matrix[1][3];
                        efOrgL[2] = lHandMatrix.matrix[2][3];
                }

                AnglesToAxis( fAng, axis );

/*
 * Added by Kimmy
 * This should fix playing the single hand effect at two places
 *
 */
                if ( cent->currentState.activeForcePass > FORCE_LEVEL_2 )

                {//arc
                        //trap_FX_PlayEffectID( cgs.effects.forceLightningWide, efOrg, fxDir );
                        //trap_FX_PlayEntityEffectID(cgs.effects.forceLightningWide, efOrg, axis, cent->boltInfo, cent->currentState.number, -1, -1);
                        if ( pm->ps->weapon == WP_NONE || pm->ps->weapon == WP_MELEE || ( pm->ps->weapon == WP_SABER && pm->ps->saberHolstered ) )
                        {
                                trap_FX_PlayEntityEffectID(cgs.effects.forceLightningWide, efOrgR, axis, -1, -1, -1, -1); // thats the solution - we need to play the fx from two origins
                        }

                        trap_FX_PlayEntityEffectID(cgs.effects.forceLightningWide, efOrgL, axis, -1, -1, -1, -1);
                }
                else
                {//line
                        //trap_FX_PlayEffectID( cgs.effects.forceLightning, efOrg, fxDir );
                        //trap_FX_PlayEntityEffectID(cgs.effects.forceLightning, efOrg, axis, cent->boltInfo, cent->currentState.number, -1, -1);
                        trap_FX_PlayEntityEffectID(cgs.effects.forceLightning, efOrgL, axis, -1, -1, -1, -1);
                }

                /*
                if (cent->bolt4 < cg.time)
                {
                        cent->bolt4 = cg.time + 100;
                        trap_S_StartSound(NULL, cent->currentState.number, CHAN_AUTO, trap_S_RegisterSound("sound/weapons/force/lightning.wav") );
                }
                */
        }

The end is "fullbody push effect"



In bg_pmove.c
(animation)


Between "gripping" and "draining"

Code:

/*
 * Added by Kimmy
 * improved 2handed animation fix
 *
 */

                        else if ( (pm->ps->fd.forcePowersActive&(1<<FP_LIGHTNING)) )
                        {//lightning
                                if ( pm->ps->weapon == WP_MELEE ||
                                        pm->ps->weapon == WP_NONE ||
                                        pm->ps->weapon == WP_SABER && pm->ps->saberHolstered )
                                {//2-handed lightning
                                        desiredAnim = BOTH_FORCE_2HANDEDLIGHTNING_HOLD;
                                }
                                else
                                {
                                        desiredAnim = BOTH_FORCELIGHTNING_HOLD;
                                }
                        }




If you want you can give me credit ;)

-Kimberly aka Nomi Halcyon-

Tinny 04-05-2010 11:25 AM

Thanks for the heads up, are you working on a mod?

Kimberly 04-05-2010 08:10 PM

well, im just helping Didz with Coremod and Stoiss with Evolution of Combat ;)
what about you ;) r ya working at a mod atm

Tinny 04-06-2010 07:22 AM

Working on trying to finish up version 2 of the old school mod i was making. Really trying to get it done by this summer.

Kimberly 04-06-2010 09:28 AM

a kewl :)

is force destruction and force blinding a complete new force or just a changed force (like lightning and rage to destruction and blinding)

Tinny 04-06-2010 10:05 AM

I tried to add new force powers, but the way the bases are defined in q_shared.h makes it hard to expand. I replaced force team heal and energize and integrated them into force heal and force drain when at full health. Ooh, read up on coremod, i was trying to implement some of the same stuff with lua script.

Kimberly 04-06-2010 03:31 PM

well i thought so ;)

but you can add new force level and implent so similar forces

Lightning Level 1
-> Force Bolt

Lightning Level 2
-> Force Shock

Lightning Level 3
-> Force Lightning

Lightning Level 4
-> Force Lightningstorm

Lightning Level 5
-> Force Lightningbomb

:P

-=*Raz0r*=- 04-06-2010 11:19 PM

* Raz0r blabs about a nice little community of the active coders for JA on IRC at irc.arloria.net/#JACoders

Kimberly 04-08-2010 05:28 AM

* slaps Raz0r around a bit with a large rainbow trout


All times are GMT -4. The time now is 11:47 PM.

Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
LFNetwork, LLC ©2002-2011 - All rights reserved.