local mgr = player:call('get_StaminaManager()'); ;mgr is a comprehensive class related to stamina for the player character of the game.
local max = mgr:get_MaxValue() ;max is collected by recording the maximum stamina value from mgr.
local recover = max * config.RegenPercentage / 100 / 60 ;recover refers to the recovery amount per tick and refers to the user-defined Percentage. The reason the max variable is used is because the player's maximum stamina can vary depending on the RPG training status.
local battleMgr = GetBattleManager(); if battleMgr:call("get_IsBattleMode()") then recover = recover * config.InBattleRatio; end ;battleMGr is used to determine whether the current combat situation is present or not. When in combat mode, the mode operates by multiplying the recover value defined above by the Ratio value.
mgr:call("add(System.Single, System.Boolean)", recover, true) ;mgr:call is the final statement that allows the above variables to be applied to the actual stamina recovery speed.
Did I understand it correctly? I want to double the stamina recovery speed in non-combat situations, and set it the same as in the vanilla game during combat.
I understand that in combat situations, the stamina recovery speed set in the mode is adjusted by multiplying the BattleRatio.
However, I don't understand how the method of calculating the recover variable set in the mode came about.
If I set the RegenPercentage variable to 1.0, is the stamina recovery speed the same as the vanilla game? case1) RegenPercentage 1.0 -> vanilla game stamina recovery speed = modded game stamina recovery speed
Or, is the recovery speed equal to the RegenPercentage variable added to the stamina recovery speed of the vanilla game? case2) RegenPercentage 1.0 -> moded game stamina recovery speed = vanilla game stamina recovery speed + (vanilla game stamina recovery speed * RegenPercentage 1.0)
I would appreciate it if you could tell me which one is correct.
local recover = max * config.RegenPercentage / 100 / 60 And I don't understand why it is divided by 60 in this statement. Please let me know this too. Sir.
Like what I said, the regen value is framerate related. In my environment, -14 makes my stamina regen almost zero. So I will set the regen percentage to 14, and battle ratio to 0 to implement your need.
/60 is because the function is called every frame to make the stamina bar smoother, it also makes the regen value framerate related.
Thanks for answering my trivial question. As written above, it was disabled during combat by passing the code through comment processing. It works as I want
You the best. I'm trying to balance out my sorcerer so I can't just spam spells.
Speaking of sorcerer, would you be able to make a mod that removes x% HP whenever the Galvanize sorcerer skill is used? I want the quick stamina regen to come at a cost.
18 comments
;mgr is a comprehensive class related to stamina for the player character of the game.
local max = mgr:get_MaxValue()
;max is collected by recording the maximum stamina value from mgr.
local recover = max * config.RegenPercentage / 100 / 60
;recover refers to the recovery amount per tick and refers to the user-defined Percentage.
The reason the max variable is used is because the player's maximum stamina can vary depending on the RPG training status.
local battleMgr = GetBattleManager();
if battleMgr:call("get_IsBattleMode()") then
recover = recover * config.InBattleRatio;
end
;battleMGr is used to determine whether the current combat situation is present or not.
When in combat mode, the mode operates by multiplying the recover value defined above by the Ratio value.
mgr:call("add(System.Single, System.Boolean)", recover, true)
;mgr:call is the final statement that allows the above variables to be applied to the actual stamina recovery speed.
--------------------------------------------------------------------------------------
Did I understand it correctly?
I want to double the stamina recovery speed in non-combat situations, and set it the same as in the vanilla game during combat.
I understand that in combat situations, the stamina recovery speed set in the mode is adjusted by multiplying the BattleRatio.
However, I don't understand how the method of calculating the recover variable set in the mode came about.
If I set the RegenPercentage variable to 1.0, is the stamina recovery speed the same as the vanilla game?
case1) RegenPercentage 1.0 -> vanilla game stamina recovery speed = modded game stamina recovery speed
Or, is the recovery speed equal to the RegenPercentage variable added to the stamina recovery speed of the vanilla game?
case2) RegenPercentage 1.0 -> moded game stamina recovery speed = vanilla game stamina recovery speed + (vanilla game stamina recovery speed * RegenPercentage 1.0)
I would appreciate it if you could tell me which one is correct.
local recover = max * config.RegenPercentage / 100 / 60
And I don't understand why it is divided by 60 in this statement. Please let me know this too. Sir.
local battleMgr = GetBattleManager();
if battleMgr:call("get_IsBattleMode()") then
------------------------------------------------------------------------------------------------------------------
--recover = recover * config.InBattleRatio;
recover = recover
------------------------------------------------------------------------------------------------------------------
else
mgr:call("add(System.Single, System.Boolean)", recover, true)
end
I modified the code like this:
Is this now working the way I want it to?
In my environment, -14 makes my stamina regen almost zero. So I will set the regen percentage to 14, and battle ratio to 0 to implement your need.
/60 is because the function is called every frame to make the stamina bar smoother, it also makes the regen value framerate related.
As written above, it was disabled during combat by passing the code through comment processing.
It works as I want
edit: updated
Speaking of sorcerer, would you be able to make a mod that removes x% HP whenever the Galvanize sorcerer skill is used? I want the quick stamina regen to come at a cost.
Also your mods are great, do you have a patreon??