• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Stamina Regeneration when offline

Red

Cyntara.org & Evolunia.net
Staff member
Global Moderator
Premium User
Joined
Aug 9, 2008
Messages
4,495
Solutions
2
Reaction score
952
Location
Ohio, USA
I was wondering if anybody knew how to make stamina only regenerate up to the 40th hour while being offline instead of hour 42.

For example: If a player is offline and has 41 hours 20 minutes of stamina, they won't regenerate any stamina.
If a player is offline and has 37 hours of stamina, they will regenerate 3 hours over time and no more.

I've checked player.cpp / player.h and couldn't figure it out.
Red
 
I'm gonna find a bunch of possibilities and name them, I can't promise if they work.

Let's start off with:

configmanager.cpp
Code:
m_confNumber[STAMINA_LIMIT_TOP]			= getGlobalNumber("staminaRatingLimitTop", 2460);
to
Code:
m_confNumber[STAMINA_LIMIT_TOP]			= getGlobalNumber("staminaRatingLimitTop", 2400);

---------------------------------
 
I'm gonna find a bunch of possibilities and name them, I can't promise if they work.

Let's start off with:

configmanager.cpp
Code:
m_confNumber[STAMINA_LIMIT_TOP]			= getGlobalNumber("staminaRatingLimitTop", 2460);
to
Code:
m_confNumber[STAMINA_LIMIT_TOP]			= getGlobalNumber("staminaRatingLimitTop", 2400);

---------------------------------

This didn't work :(

in config change
LUA:
staminaRatingLimitTop = 41 * 60
to
LUA:
staminaRatingLimitTop = 40

No results either :(
Red
 
Last edited:
player.h
Code:
#define STAMINA_MAX (42 * 60 * 60 * 1000)
to
#define STAMINA_MAX (40 * 60 * 60 * 1000)
This perhaps?
Not tested but it seems like the thing you're looking for.
(if your character has 40> stamina you'd might want to decrease them manually or w/e. Not sure tho)
 
player.h
Code:
#define STAMINA_MAX (42 * 60 * 60 * 1000)
to
#define STAMINA_MAX (40 * 60 * 60 * 1000)
This perhaps?
Not tested but it seems like the thing you're looking for.
(if your character has 40> stamina you'd might want to decrease them manually or w/e. Not sure tho)

I've tried this once before, this makes it so not even my luascript can add stamina to players. :(
Thanks for the help though <3

Red
 
I've tried this once before, this makes it so not even my luascript can add stamina to players. :(
Thanks for the help though <3

Red
Oh, I misunderstood you completely. Anyway, if that's the case.

@player.h
Add:
Code:
#define MAX_STAMINA_SLEEP (40 * 60 * 60 * 1000)

@player.cpp
ctrl+f "onCreatureAppear"
Search for:
Code:
if(lastLogout && stamina < STAMINA_MAX)
and change it to:
Code:
if(lastLogout && stamina < MAX_STAMINA_SLEEP)
Also change every "STAMINA_MAX" to "MAX_STAMINA_SLEEP" inside that code section.

There are other functions that requires editing depending on what exactly do you want to do, for instance: when you die. But I'm pretty sure you can handle on your own with ctrl+f/lua.

Btw: Again, I didn't test it.
 
Last edited:
@Migxxx

This seems to be the working solution! Thank you so much! Rep+ :)

Red
 
Back
Top