PDA

View Full Version : Level.Time


count_coder
08-31-2004, 01:43 PM
How does this work in JA? Basically, I want the force regen to wait about 20 seconds or so then to regen 20 and repeat.. void WP_ForcePowerRegenerate( gentity_t *self, int overrideAmt )
{ //called on a regular interval to regenerate force power.
if ( !self->client )
{
return;
}

if ( overrideAmt )
{ //custom regen amount
self->client->ps.fd.forcePower += overrideAmt;
}
else
{ //otherwise, just 1
this is what i commented out//self->client->ps.fd.forcePower++;
self->client->ps.fd.forcePower = level.time + 10000;
self->client->ps.fd.forcePower += 20;
}

It doesn't seem to wait at all.. In fact I think the force power regens at + 10000 instead of waiting..

What about using self->nextThink? I tried that and it compiles but still it doesn't seem to work..

razorace
09-01-2004, 07:27 AM
Dude, ps.fd.forcePower is the current force power of that player, not the regen time.

count_coder
09-01-2004, 09:05 AM
i see.. then what is the regen time? I should say, where is the call to forcepowerRegen located? it seems to be automatic and no calls is made for it unless you have a force boon.. anyway.. can you please explain to me why self->nextthink "whatever" doesn't seem to make it wait at all?

I dont see anything else inside this function..

Where is the regen time? It must be set somewhere else, but where?



Anyway, Thanks for your reply

razorace
09-01-2004, 01:21 PM
I beleive this function is the one called to add the force power to the player instead of controlling the regen rate. The rate is determined in the function(s) that call this one.

self->nextthink controls the next time the self->think function is called. It has nothing to do with what you're trying to do.

count_coder
09-01-2004, 02:17 PM
do you happen to know which function calls this? i searched for WP_ForcePowerRegenerate and got a few results.. all of them were around the lines 5556.. it seems that if you are a jedi master they multiple the regen rate by 4 and 6.. and if you don't then its standered normal if (g_gametype.integer != GT_HOLOCRON || g_MaxHolocronCarry.value)
{
//if (!g_trueJedi.integer || self->client->ps.weapon == WP_SABER)
//let non-jedi force regen since we're doing a more strict jedi/non-jedi thing... this gives dark jedi something to drain
{
if (self->client->ps.powerups[PW_FORCE_BOON])
{
WP_ForcePowerRegenerate( self, 6 );
}
else if (self->client->ps.isJediMaster && g_gametype.integer == GT_JEDIMASTER)
{
WP_ForcePowerRegenerate( self, 4 ); //jedi master regenerates 4 times as fast
}
else
{
WP_ForcePowerRegenerate( self, 0 );
}
}

so if this updates every second.. how can i make it delay?

Thanks