AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D2] HP Regeneration V-1.63 (1/26/11) (https://forums.alliedmods.net/showthread.php?t=121920)

Mortiegama 03-21-2010 01:31

[L4D2] HP Regeneration V-1.63 (1/26/11)
 
1 Attachment(s)
General

This plugin requires Sourcemod 1.3 or higher


Description

This plugin will allow you to set custom values for HP Regeneration of either Survivors or the Infected team. They're set with default values but can be changed by editing the plugin.L4D2.HPRegen.cfg in the CFG\Sourcemod folder.

Credits

Credit for the original framework of this plugin goes to Bl4nk. He created a basic version of the plugin which I've modified to better serve the infected team in L4D2.

<*>http://forums.alliedmods.net/showthread.php?t=66154

Special thanks to Graveeater for helping clean up some of the code.

Cvars

<*>To change these values edit the plugin.L4D2.HPRegen.cfg in the CFG\Sourcemod folder.
<*>NOTE: Setting sm_hpregeneration_XX has three values, 0 will regenerate to a percent of the in-game cvar, 1 will go based upon what you set for a value in the CFG, 2 will regenerate based upon in-game cvar. (Survivors and Tanks do not have an option 2, they have no in-game cvars).
  • sm_hpregeneration_mortversion
  • sm_hpregeneration_enable (Enabled 1, Disabled 0), Allows the survivors and infected to regenerate HP.
  • sm_hpregeneration_enablesurvivor (Enabled 1, Disabled 0), Enables regeneration for the Survivor team.
  • sm_hpregeneration_enablebwhealing (Enabled 1, Disabled 0), Enables regeneration when the Survivor is Black and White.
  • sm_hpregeneration_enableinfected (Enabled 1, Disabled 0), Enables regeneration for the Infected team (this includes Tank).
  • sm_hpregeneration_enabletank (Enabled 1, Disabled 0), Enables regeneration for the Tank (this is disabled by default).
  • sm_hpregeneration_delayenable (Enabled 1, Disabled 0), Enables a delay in regeneration due to damage.
  • sm_hpregeneration_delaydamage (Default 2), How long after damage stops that regeneration begins.
  • sm_hpregeneration_tickrate1 (Default 3), Rate at which the survivors will regenerate their HP.
  • sm_hpregeneration_survivor (0 - Regenerate by %, 1 - Regenerate by Cvar), Sets Regeneration Mode.
  • sm_hpregeneration_survivorhealth (Default 100), Amount of health to regenerate to for survivors.
  • sm_hpregeneration_survivoramount (Default 1), Amount of health the survivors will receive each tickrate.
  • sm_hpregeneration_survivorpercent (Default 1.0), Percent of health to regenerate (1.0 = 100%).
  • sm_hpregeneration_tickrate2 (Default 1), Rate at which the infected team will regenerate their HP.
  • sm_hpregeneration_boomer (0 - Regenerate by %, 1 - Regenerate by plugin Cvar, 2 - Regenerate by In-game Health), Sets Regeneration Mode.
  • sm_hpregeneration_boomerhealth (Default 50), Amount of health to regenerate to for a Boomer.
  • sm_hpregeneration_boomerpercent (Default 1.0), Percent of health to regenerate to for a Boomer (1.0 = 100%).
  • sm_hpregeneration_boomeramount (Default 5), Amount of health the Boomer will receive each tickrate.
  • sm_hpregeneration_charger (0 - Regenerate by %, 1 - Regenerate by plugin Cvar, 2 - Regenerate by In-game Health), Sets Regeneration Mode.
  • sm_hpregeneration_chargerhealth (Default 600), Amount of health to regenerate to for a Charger.
  • sm_hpregeneration_chargerpercent (Default 1.0), Percent of health to regenerate to for a Charger (1.0 = 100%).
  • sm_hpregeneration_chargeramount (Default 5), Amount of health the Charger will receive each tickrate.
  • sm_hpregeneration_hunter (0 - Regenerate by %, 1 - Regenerate by plugin Cvar, 2 - Regenerate by In-game Health), Sets Regeneration Mode.
  • sm_hpregeneration_hunterhealth (Default 250), Amount of health to regenerate to for a Hunter.
  • sm_hpregeneration_hunterpercent (Default 1.0), Percent of health to regenerate to for a Hunter (1.0 = 100%).
  • sm_hpregeneration_hunteramount (Default 5), Amount of health the Hunter will receive each tickrate.
  • sm_hpregeneration_jockey (0 - Regenerate by %, 1 - Regenerate by plugin Cvar, 2 - Regenerate by In-game Health), Sets Regeneration Mode
  • sm_hpregeneration_jockeyhealth (Default 325), Amount of health to regenerate to for a Jockey.
  • sm_hpregeneration_jockeypercent (Default 1.0), Percent of health to regenerate to for a Jockey (1.0 = 100%).
  • sm_hpregeneration_jockeyamount (Default 5), Amount of health the Jockey will receive each tickrate.
  • sm_hpregeneration_smoker (0 - Regenerate by %, 1 - Regenerate by plugin Cvar, 2 - Regenerate by In-game Health), Sets Regeneration Mode.
  • sm_hpregeneration_smokerhealth (Default 250), Amount of health to regenerate to for a Smoker.
  • sm_hpregeneration_smokerhealth (Default 100), Amount of health to regenerate to for a Smoker.
  • sm_hpregeneration_smokerpercent (Default 1.0), Percent of health to regenerate to for a Smoker (1.0 = 100%).
  • sm_hpregeneration_spitter (0 - Regenerate by %, 1 - Regenerate by plugin Cvar, 2 - Regenerate by In-game Health), Sets Regeneration Mode.
  • sm_hpregeneration_spitterhealth (Default 100), Amount of health to regenerate to for a Spitter.
  • sm_hpregeneration_spitterpercent (Default 1.0), Percent of health to regenerate to for a Spitter (1.0 = 100%).
  • sm_hpregeneration_spitteramount (Default 5), Amount of health the Spitter will receive each tickrate.
  • sm_hpregeneration_tank (0 - Regenerate by %, 1 - Regenerate by plugin Cvar), Sets Regeneration Mode.
  • sm_hpregeneration_tankhealth (Default 6000), Amount of health to regenerate to for a Tank.
  • sm_hpregeneration_tankpercent (Default 0.0), Percent of health to regenerate to for a Tank (1.0 = 100%).
  • sm_hpregeneration_tankamount (Default 0), Amount of health the Tank will receive each tickrate.

Admin Commands
  • sm_hpsurvivor - Toggles HP Regeneration for the Survivors
  • sm_hpinfected - Toggles HP Regeneration for the Infected
  • sm_hptank - Toggles HP Regeneration for the Tank
  • sm_hpdelay - Toggles a delay in regeneration due to damage
Installation
  • Download and copy [L4D2] HP Regeneration.smx to Addons/Sourcemod/Plugins folder.
  • Delete the plugin.L4D2.HPRegen.cfg in the CFG/Sourcemod folder.
  • If you have Version 1.12 or earlier HP.Regeneration.cfg in the CFG/Sourcemod folder.

Version History

Version 1.63 - (1/26/11)
<*>Changed the name of the public cvar
Version 1.62 - (5/31/10) - 1236 Views
<*>Major cut down on code thanks to - Dirka Dirka's input
<*>Changed the way the Timers are closed
Version 1.61 - (5/26/10) - 42 Views
<*>Added new Cvar sm_regeneration_enablebwhealing
<*>Set a check to see if Survivor is B&W, now they will stop healing 1 point less than their max health
<*>Cleaned up some of the code calling the Max Infected HP
Version 1.6 - (5/18/10) - 97 Views
<*>Added Regeneration based upon percentage of HP
<*>Added Regeneration based upon in-game Cvar set Health (not Survivor or Tank)
<*>Improved the client detection for Valid Clients
<*>Changed some Cvar names so the CFG is more organized
Version 1.53 - (4/24/10) - 203 Views
<*>Very minor bug, made sure to ignore client if it is Client 0
Version 1.52 - (4/16/10) - 143 Views
<*>Set the call to check IfPlayerIsOnFire in the correct place to prevent errors
<*>Set a call to check if a player is InCapped, will now stop regen
Version 1.51 - (4/11/10) - 66 Views
<*>Fixed a minor bug when checking IfPlayerIsOnFire
Version 1.5 - (4/10/10) - 27 Views
<*>Added in-game Admin commands to toggle Enable commands
<*>Set a check if player is on fire so that regeneration is disabled if the Delay is enabled
<*>Cleaned up possible bugs in the coding for Infected
<*>Added a timer close if player disconnects
Version 1.4 - (4/6/10) - 87 Views
<*>Plugin can now disable/enable regeneration for Survivors/Infected/Tank
<*>Added Cvar sm_hpregeneration_enablesurvivor
<*>Added Cvar sm_hpregeneration_enableinfected
<*>Added Cvar sm_hpregeneration_enabletank
<*>Updated the HP check for the Infected team
<*>Cleaned up code to run plugin faster
Version 1.31 - (4/3/10) - 36 Views
<*>Cleaned up some of the code for the plugin (Credit to Graveeater)
Version 1.3 - (4/2/10) - 37 Views
<*>Added a check to verify how much temporary HP a survivor has before regenerating
<*>Added regeneration support for the Tank, default for the Tank is 0 so it won't be enabled unless the Cvar is changed
<*>Changed the names of the Infected Cvar to InfectedNameHealth for their health Cvars
<*>Changed the names of the Survivor Cvar to use Survivor instead of 1 for Health and Amount
<*>Added Cvar sm_hpregeneration_amountboomer
<*>Added Cvar sm_hpregeneration_amountcharger
<*>Added Cvar sm_hpregeneration_amountjockey
<*>Added Cvar sm_hpregeneration_amounthunter
<*>Added Cvar sm_hpregeneration_amountsmoker
<*>Added Cvar sm_hpregeneration_amountspitter
<*>Added Cvar sm_hpregeneration_amounttank
Version 1.2 - (3/25/10) - 102 Views
<*>Changed plugin to delay regeneration until the Cvar time period has passed
<*>Added Cvar sm_hpregeneration_delayenable
<*>Added Cvar sm_hpregeneration_damagedelay
<*>Added PlayerDeath and PlayerTeam events to kill the client timer
<*>Changed CFG file created to plugin.L4D2.HPRegen.cfg
Version 1.12 - (3/21/10) - 93 Views
<*>Changed the call for Survivor regeneration
<*>Minor bug fixes
Version 1.11 - (3/21/10) - 21 Views
<*>Fixed the plugin spamming the server with error messages
Version 1.1 - (3/21/10) - 1 View
<*>Fixed it so that when incapped your health does not reduce to the health1 cvar amount
<*>Changed it so that the bots will also regenerate HP
Version 1.0 - (3/20/10) - 23 Views
<*>Original launch of the plugin


Known Issues
<*>None

alexip121093 03-21-2010 01:48

Re: [L4D2] HP Regeneration
 
can you add a CVAR about the player not take any damage for a period of time then start regeneration

marvel 03-21-2010 05:29

Re: [L4D2] HP Regeneration
 
Nice job! I'm going to test this :)

marvel 03-21-2010 05:48

Re: [L4D2] HP Regeneration
 
Wohoo I love this plugin, it works great! Although I think the tickrate of 3 for survivors makes it a little too easy for them so I've set it to 1 hp every 5 seconds:wink:

Great work!

marvel 03-21-2010 06:01

Re: [L4D2] HP Regeneration
 
Found a couple of bugs already.

1. The tickrate isn't working, if you set it to 5 it will still re-generate every 3 seconds.

2. Bots are not re-generating as far as I could see.

3. This is the most nasty one, I have set incapped health to 500 on my server, with this plugin incapped survivors will have only 100 incap health and die pretty fast if not helped.

4. I have seen some cases where it just stopped re-generating. Then you get attacked, lose health and suddenly it starts working again.

Mortiegama 03-21-2010 13:35

Re: [L4D2] HP Regeneration
 
@Alex - That would make it incredibly overpowered and you wouldn't be killing anything.

@Marvel

1) You need to edit the HP.Regeneration.cfg file in the Sourcemod folder to change the values.

2) Bots are now regenerating

3) It was not calculating incapped properly and has now been changed.

4) It's hooked to players being hurt but it should be working better now

Mortiegama 03-21-2010 13:51

Re: [L4D2] HP Regeneration V-1.11 (3/21/10)
 
Ok, fixed the problem with it spamming the server when calling the ClientTeam. Was changing stuff on the wrong line.

LTR.2 03-21-2010 14:20

Re: [L4D2] HP Regeneration V-1.11 (3/21/10)
 
can you make it so, only SI regenrate health?

Mortiegama 03-21-2010 15:33

Re: [L4D2] HP Regeneration V-1.11 (3/21/10)
 
@LTR - Just set the Amount1 value to 0 and the survivors will not get any HP.

Skorpion1976 03-21-2010 16:46

Re: [L4D2] HP Regeneration V-1.11 (3/21/10)
 
I run 8vs8 and activated this plugin for both teams.
SI: every 3 seconds 20 HP, SURV: every 3 seconds 1 HP up to max. 70 HP
But despite the barrier of 70 HP, the survivors gain 1 HP every 3 secs, infinitely. I cannot stop that, it runs over 160 HP... example: my survivors have 150 HP at start. cvarSurvivorHP = 70, meaning, the plugin should heal up survs only to 70, not further, 1 HP every 3 seconds. In line 118 the code does this:
Code:

if (70 + 1 < (1 + 150)).
If true, add 1 HP. The same "if" statement 3 seconds later:
Code:

if(70 + 1 < (1 + 151))
and so on... you see what I mean? Because of this it does not stop healing.

I replaced the 2 "ifs" by only 1 "if":
Code:

if (sHP < sMaxHP)
{
    SetEntProp(client, Prop_Send, "m_iHealth", sHP + sHPRegen, 1);
}

This should mean: Only if current survivor HP < 70, heal him up. In all other cases it does nothing, as intented.

AND please fix this:
L 03/21/2010 - 21:37:26: [SM] Native "KillTimer" reported: Invalid timer handle 0 (error 4)
L 03/21/2010 - 21:37:26: [SM] Displaying call stack trace for plugin "hp_regeneration.smx":
L 03/21/2010 - 21:37:26: [SM] [0] Line 238, L4D2 HP Regeneration.sp::KillClientTimer()
L 03/21/2010 - 21:37:26: [SM] [1] Line 228, L4D2 HP Regeneration.sp::OnMapEnd()


All times are GMT -4. The time now is 16:29.

Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.