Allow survivor automatically regenerate health when been incapacitated and get self revive when health reaches the max.
Cvars
PHP Code:
// default health when down
// -
// Default: "240"
// Minimum: "1.000000"
incap_self_revive_down_default_health "240"
// how long need to wait after health reaches the max when down
// -
// Default: "1.0"
// Minimum: "0.000000"
incap_self_revive_down_finish_time "1.0"
// how many health heal once when down
// -
// Default: "5"
// Minimum: "1.000000"
incap_self_revive_down_health "5"
// how long time will count to hit time if takedamage or pinned by special infected when down
// -
// Default: "1.0"
// Minimum: "0.000000"
incap_self_revive_down_hit_duration "1.0"
// if keeping takedamage or pinned by special infected longer than this, instantly failed. 0.0 or lower = disable
// -
// Default: "40.0"
incap_self_revive_down_hit_time_max "40.0"
// 1 = enable, 0 = disable. interrupt healing on hurt when down?
// -
// Default: "1"
incap_self_revive_down_interrupt_on_hurt "1"
// repeat interval after healing start when down
// -
// Default: "1.0"
// Minimum: "0.000000"
incap_self_revive_down_repeat_interval "1.0"
// how long need to wait to heal after takedamage or pinned by special when down
// -
// Default: "2.0"
// Minimum: "0.000000"
incap_self_revive_down_start_wait "2.0"
// default health when ledge
// -
// Default: "240"
// Minimum: "1.000000"
incap_self_revive_ledge_default_health "240"
// how long need to wait after health reaches the max when ledge
// -
// Default: "1.0"
// Minimum: "0.000000"
incap_self_revive_ledge_finish_time "1.0"
// how many health heal once when ledge
// -
// Default: "5"
// Minimum: "1.000000"
incap_self_revive_ledge_health "5"
// how many health will decay after revived from ledge
// -
// Default: "10"
// Minimum: "0.000000"
incap_self_revive_ledge_health_decay "10"
// how long time will count to hit time if takedamage or pinned by special infected when ledge
// -
// Default: "1.0"
// Minimum: "0.000000"
incap_self_revive_ledge_hit_duration "1.0"
// if keeping takedamage or pinned by special infected longer than this, instantly failed. 0.0 or lower = disable
// -
// Default: "40.0"
incap_self_revive_ledge_hit_time_max "40.0"
// 1 = enable, 0 = disable. interrupt healing on hurt when ledge?
// -
// Default: "1"
incap_self_revive_ledge_interrupt_on_hurt "1"
// repeat interval after healing start when ledge
// -
// Default: "1.0"
// Minimum: "0.000000"
incap_self_revive_ledge_repeat_interval "1.0"
// how long need to wait to heal after takedamage or pinned by special when ledge
// -
// Default: "2.0"
// Minimum: "0.000000"
incap_self_revive_ledge_start_wait "2.0"
Natives and Forwards
Spoiler
PHP Code:
/**
* @brief Called when a survivor has restored health from ledge revive
*
* @param client client index
*
* @noreturn
*/
forward void IncapSelfRevive_OnRestoredHealthFromLedgeRevived(int client);
/**
* @brief Return whether or not a survivor is waiting to restore health by manually ledge revive
*
* @param client client index to check
*
* @return true if is
*
* @error client index out of bound
*/
native bool IncapSelfRevive_IsWaitingForRestoreHealthFromLedgeRevived(int client);
2.12 (2024-03-24:
fix cvar "incap_self_revive_down_start_wait" not correctly load.
2.11 (2024-03-16:
-fix rare "client not in game" error.
2.10 (2024-03-15:
-remove unnecessary resetting variables in frame callbacks.
2.9 (2024-03-03:
-minor improve.
2.8 (2024-02-29:
-minor improve of revive id init.
2.7 (2024-02-25 | rollback:
-auto handle and block incapacitated bleed damage when round is alive.
2.6 (2024-02-25:
-minor improve of reseting player state.
2.5 (2024-02-24:
-add cvar "incap_self_revive_ledge_interrupt_on_hurt" and "incap_self_revive_down_interrupt_on_hurt".
-fix inaccuracy hit time calculating.
2.4 (2024-02-23 | re-upload 2024-02-24:
-restore native "IncapSelfRevive_IsWaitingForRestoreHealthFromLedgeRevived".
-add forward "IncapSelfRevive_OnRestoredHealthFromLedgeRevived".
-better compatibility with my other plugins.
2.3 (2024-02-23:
-minor improve.
2.2 (2024-02-23 | re-upload 2024-02-23:
-minor fix.
2.1 (2024-02-22:
-only force failed when take damage or pinned by special infected.
2.0 (2024-02-22:
-totally rewrite the code, much safer and faster.
-add cvar to control max hit time to prevent infinite healing.
1.22 (2023-02-10:
minor improve.
1.21 (2023-02-09:
add more check for survivor status in timers, events and every frame.
1.20 (2023-02-08:
prevent heartbeat stop after self revive from down.
1.19 (2023-02-08:
self revive from down will provide 1.0 health buffer at least.
1.18 (2023-02-07:
add native "IncapSelfRevive_IsWaitingForRestoreHealthFromLedgeRevived".
fix heartbeat stop after self revive from ledge.
1.17 (2023-01-27:
simplify detections in events.
1.16 (2023-01-02 | reupload 2023-01-22:
clean up code.
1.15 (2023-01-20:
fix "client not in game" error on sound hook if stop heartbeat on round start before entity spawn.
1.14 (2023-01-18:
no longer hook and lock "survivor_incap_hopeless_decay_rate" to 0.
set health to 1 when has released from edge.
1.13 (2022-01-16:
minor improve of code.
1.12 (2022-01-14:
no longer fire event "player_hurt" after revived from ledge and health decayed. and minor improve.
1.11 (2023-01-13:
minor improve.
1.10 (2022-12-24 | reupload 2023-01-07:
improve firing event "player_hurt".
1.9 (2022-12-23 | reupload 2022-12-24:
fire event "player_hurt" after revived from ledge and health decayed, better compatibility with other plugins.
1.8 (2022-12-19:
minor improve.
1.7 (2022-12-15 | reupload 2022-12-16:
minor improve.
1.6 (2022-12-12 | reupload 2022-12-15:
new version naming style.
1.5.5 (2022-12-10:
no longer hook and lock "survivor_incap_hopeless_decay_rate" to 0.
1.5.4 (2022-12-09:
minor improve.
1.5.3 (2022-12-08:
minor improve.
1.5.2 (2022-12-07:
"*_interrupt_on_hurt" now works if incapped health over than the max.
1.5.1 (2022-12-06:
heartbeat of thirdstrike now works better.
1.5.0 (2022-12-06:
mission will failed when every died or incapped, remove translation and commands.
1.4.5 (2022-11-16:
minor improve.
1.4.4 (2022-11-12:
change cvar default value and improve translations.
1.4.3 (2022-11-08:
add new cvar to control how many percent vote yes to pass vote.
1.4.2 (2022-11-08:
add a command to vote to end round.
1.4.1 (2022-11-05:
minor improve.
1.4.0 (2022-11-01:
improve code, rename many cvars. add 2 new cvar to control revive delay time after health reaches the max.
1.3.3 (2022-10-25:
minor improve.
1.3.2 (2022-07-24:
minor improve.
1.3.1 (2022-07-18:
minor improve.
1.3.0 (2022-07-17:
change ledge revived health scale to fixed health decay.
1.2.3 (2022-07-17:
change cvar default value.
1.2.2 (2022-07-16:
fix thirdstrike do not set on bot.
1.2.1 (2022-05-17:
health won't overflow than max when regen.
1.2.0 (2022-05-16:
remove features from 1.1.0 and minor improve.
1.1.2 (2022-05-16:
add missing convar change hook.
1.1.1 (2022-05-05:
minor improve.
1.1.0 ( 2022-05-01:
self revive is detected immediately at each health regen.
1.0.4 ( 2022-05-01:
init public release.
If I pause the game, the health regeneration continues. When unpause, they recover all the life that corresponds to them for the elapsed time of pause. If you fix it, it's will be a perfect mod
Bots do not pause regeneration when attacked. This is fine by me, as bots are clumsier than the player, but I would like it to be configurable with a separate command like incap_bot_reviveXXXX
Oh, what a pity that this mod was unapproved and deprecated. It was very useful for me because allows you to choose how much temporary health you start with when a Survivor get incapped on a ledge, including the corresponding animation. Then, survivor begins to fall down (80 HP), and gradually stands up on his own, with his own animations. It's very realistic like that and I've been playing that way for a year now.
On the other hand, since I am not interested on normal incapped autorecovery, I have edited the code so it allows for negative values of incap_self_revive_ledge_point, which I use to customize the rate at which a survivor loses life while incapacitated. Is mandatory to use incap_self_revive_down_default "299" instead of "300" or there will be a bug. I don't know how to disable the mod during normal incapacitation due to lack of cvars and so far I haven't really looked at the code much I was already satisfied with it.
I can post the source code if anyone is interested and the author or administrators allow it. In the meantime, I'll keep it as a little treasure.
- You should be putting the clients userid into timers and validating in the timer callback otherwise you're likely going to affect someone else.
- Alternatively since you're storing the timer handle in a client array you could delete that if they disconnect.
- Your OnGameFrame stuff is crazy, I don't think you need to be using this forward for these things, and other plugins of yours are also using it a lot.
- You have multiple client loops in OnGameFrame which could be consolidated into 1. You really should be optimizing stuff that goes inside OnGameFrame, Think hooks and SetTransmit, since these are called so often it can easily have an impact on the server if the code is doing a lot of stuff.
- You don't need "public" before callbacks that you have named yourself, only for SM forwards and 3rd party plugin forwards.