Jump to content

Home

Adding variables called in ClientTimerActions


Aetherfunz

Recommended Posts

Hello there!

 

I want to make a Health-Regeneration for the players (and bots of course), so I coded a little into the ClientTimerActions function in JKIIgame:

// slowly increase health when under max
if (ent->health < client->ps.stats[sTAT_MAX_HEALTH]) 
{
         ent->health++;
}

 

This works fine, but the prob is that every second the player gets 1 Health, if he is already under 100. But I want it to get 1 Health after 10, or 5 seconds or so. So I need a new variable (probably within the client-structure), that increases every time when ClientTimerAction is performed.

 

My specific problem now is, where do I have to initialize this variable? I've put a new int regenRate; into the client structure, but I don't know where I have to set it to zero for the first time, so I can increase it every second and then after it hits 10 or so, I'll increase the Health of the player...

 

Help would be very appreciated

 

Peace & Respect

-- Aetherfukz

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...