Jump to content

ForcePowerDebounce and Force drain rate


Recommended Posts

I'm trying to get powers like Lightning and Drain to drain your force reserves at a slower rate as you invest points into their levels, and so far, the only 'progress' that I've made is fucking around with Grip under WP_ForcePowerRun:

 

 

 

if (self->client->ps.forcePowerDebounce[FP_GRIP] < level.time)
{
//GEntity_PainFunc( gripEnt, self, self, gripOrg, 0, MOD_CRUSH );
if (!gripEnt->client
|| gripEnt->client->NPC_class != CLASS_VEHICLE
|| (gripEnt->m_pVehicle
&& gripEnt->m_pVehicle->m_pVehicleInfo
&& gripEnt->m_pVehicle->m_pVehicleInfo->type == VH_ANIMAL))
{//we don't damage the empty vehicle
gripEnt->painDebounceTime = 0;
int gripDmg;
if (self->client->ps.forcePowerLevel[FP_GRIP] > FORCE_LEVEL_5)
{
gripDmg = forceGripDamage[self->client->ps.forcePowerLevel[FP_GRIP]] + 3;
}
else
{
gripDmg = forceGripDamage[self->client->ps.forcePowerLevel[FP_GRIP]];
}
if (gripLevel != -1)
{
switch (gripLevel)
{
case 6:
gripDmg = floor((float)gripDmg * 1.5f);
break;
case 5:
case 4:
gripDmg = gripDmg;
break;
case 3:
case 2:
gripDmg = floor((float)gripDmg / 1.5f);
break;
case 1:
default:
gripDmg = floor((float)gripDmg / 3.0f);
break;
}
}
G_Damage(gripEnt, self, self, dir, gripOrg, gripDmg, DAMAGE_NO_ARMOR, MOD_FORCE_GRIP);//MOD_???
}
if (gripEnt->s.number)
{
if (self->client->ps.forcePowerLevel[FP_GRIP] > FORCE_LEVEL_2)
{//do damage faster at level 3
self->client->ps.forcePowerDebounce[FP_GRIP] = level.time + Q_irand(150, 750);
}
else
{
self->client->ps.forcePowerDebounce[FP_GRIP] = level.time + Q_irand(250, 1000);
}
}
else
{//player takes damage faster
self->client->ps.forcePowerDebounce[FP_GRIP] = level.time + Q_irand(100, 600);
}
if (forceGripDamage[self->client->ps.forcePowerLevel[FP_GRIP]] > 0)
{//no damage at level 1
if (self->client->ps.forcePowerLevel[FP_GRIP] > FORCE_LEVEL_4)
{
WP_ForcePowerDrain(self, FP_GRIP, 1);
}
else
{
WP_ForcePowerDrain(self, FP_GRIP, 3);
}
}
if (self->client->NPC_class == CLASS_KYLE
&& (self->spawnflags & 1))
{//"Boss" Kyle
if (gripEnt->client)
{
if (!Q_irand(0, 2))
{//toss him aside!
vec3_t vRt;
AngleVectors(self->currentAngles, NULL, vRt, NULL);
//stop gripping
TIMER_Set(self, "gripping", -level.time);
WP_ForcePowerStop(self, FP_GRIP);
//now toss him
if (Q_irand(0, 1))
{//throw him to my left
NPC_SetAnim(self, SETANIM_BOTH, BOTH_TOSS1, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD);
VectorScale(vRt, -1500.0f, gripEnt->client->ps.velocity);
G_Knockdown(gripEnt, self, vRt, 500, qfalse);
}
else
{//throw him to my right
NPC_SetAnim(self, SETANIM_BOTH, BOTH_TOSS2, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD);
VectorScale(vRt, 1500.0f, gripEnt->client->ps.velocity);
G_Knockdown(gripEnt, self, vRt, 500, qfalse);
}
//don't do anything for a couple seconds
self->client->ps.weaponTime = self->client->ps.torsoAnimTimer + 2000;
self->painDebounceTime = level.time + self->client->ps.weaponTime;
//stop moving
VectorClear(self->client->ps.velocity);
VectorClear(self->client->ps.moveDir);
return;
}
}
}
}

 

 

 

I found that deleting 'self->client->ps.forcePowerDebounce[FP_GRIP] < level.time' makes it so that using Grip eats through your force like a motherfucker. Other than that, I'd appreciate some help with this before I punch my monitor. >:|

Link to comment
Guest Redemption

Hello :) Now we all know that this isn't eez here but, from what I've stumbled in with coding I get this...

 

 

//The FP cost of Force Fall
#define FM_FORCEFALL 10

WP_ForcePowerDrain(pm->gent, FP_HEAL, FM_FORCEFALL + ForceManaModifier);

 

// removes force power at a rate of 0.1 secs * force jump level
pm->ps->forcePowerDebounce[FP_LEVITATION] = pm->cmd.serverTime + (pm->ps->forcePowerLevel[FP_LEVITATION] * 100);

 

 

When I altered the FP cost to 2, it made it really slow, you could probably edit this part ( * 100 ) to see if it gets you what you want :)

Like I said, just musings but, try it out with you're lightning/drain edits and see .

Link to comment

 

//The FP cost of Force Fall

#define FM_FORCEFALL 10

 

WP_ForcePowerDrain(pm->gent, FP_HEAL, FM_FORCEFALL + ForceManaModifier);

 

// removes force power at a rate of 0.1 secs * force jump level

pm->ps->forcePowerDebounce[FP_LEVITATION] = pm->cmd.serverTime + (pm->ps->forcePowerLevel[FP_LEVITATION] * 100);

 

 

I'm glad you posted that, because I found something similar:

 

 

 
if (WP_ForcePowerAvailable(self, FP_LEVITATION, 1))
{
if (self->client->ps.forcePowerDebounce[FP_LEVITATION] < level.time)
{
WP_ForcePowerDrain(self, FP_LEVITATION, forcePowerNeeded[FP_LEVITATION]);
self->client->ps.forcePowerDebounce[FP_LEVITATION] = level.time + 100;
}
self->client->ps.forcePowersActive |= (1 << FP_LEVITATION);
}

 

 

 

Again, thanks for the post... Needless to say, staying up all night isn't good for your mental health.

eezstreet likes this
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...