Monthly Target: $400 Donations: $147
 36% 

HpRegeneration


Post New Thread Reply   
 
Thread Tools Display Modes
Author
bl4nk
SourceMod Developer
Join Date: Jul 2007
Plugin ID:
263
Plugin Version:
1.1.0
Plugin Category:
Fun Stuff
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    67 
    Plugin Description:
    When a player gets hurt, they regenerate 'x' amount of life every 'y' seconds until they reach 'z' health.
    Old 01-24-2008 , 18:08   HpRegeneration
    Reply With Quote #1

    HpRegeneration
    When a player gets hurt, they regenerate 'x' amount of life every 'y' seconds until they reach 'z' health.

    Commands:

    sm_hpregeneration_enable <0/1> - Enables the HpRegeneration plugin.
    sm_hpregeneration_amount <amount> - Amount of life to heal per regeneration tick.
    sm_hpregeneration_health <amount> - Health to regenerate to, based on the control mode.
    sm_hpregeneration_tickrate <time> - Time, in seconds, between each regeneration tick.
    sm_hpregeneration_respawn <0/1> - Enables healing through respawns.
    sm_hpregeneration_bots <0/1> - Enables bots regenerating their life.
    sm_hpregeneration_mode <1/2> - Controls the regeneration mode (see the "control modes" section for more info).

    Note: Take a look at the commented section in the plugin's source for examples on how the CVars are to be used.

    Installation:
    • Download hpregeneration.smx to your ~/addons/sourcemod/plugins folder.
    • Change the map, manually load the plugin, or restart the server to use the plugin.
    • Edit the cvars for the plugin in the created config file (~/cfg/sourcemod/plugin.hpregeneration.cfg).
    Control Modes:

    Note: This section describes the purpose and uses of the sm_hpregeneration_mode cvar.

    The mode cvar is pretty simple, but can be confusing unless you know what it does. The cvar has two modes; 1 and 2.
    1. The first mode will make it so a player will regenerate life until they reach the amount set by the health cvar.
    2. The second mode will make it so that the player will regenerate life until they reach their default max health plus the amount specified by the health cvar.
    Here's an example of mode #2:
    Player A spawns with 200 life (soldier in TF2) and the health cvar is set to 350. Player A takes damage, and begins to regenerate life. Player A regenerates life up up 550 and then stops.

    As you can see, this mode differs from mode #1, but not by much. I mainly added this for multi-class use in TF2. If you are unsure on which mode to use, here's some simple directions: If you're using this plugin for TF2, use mode #2. If you're using it for any other mod, use mode #1.

    Note: If the mod is TF2 and you use an amount above the player's default max life, their max life will then change to accomodate what they're regenerating to. So instead of draining back down to their default max life, they will retain the new max until they die or take damage again.


    Changelog:
    • 1.0.0
      • Initial release.
    • 1.0.1
      • Added CVar 'sm_hpregeneration_respawn'.
    • 1.0.2
      • Fixed health regeneration stopping when the respawn cvar is enabled and a player spawns in late.
      • Regeneration is now halted on all players when the enable cvar is set to disable.
      • Added a check for the respawn cvar for when the enable cvar is enabled any time after startup.
    • 1.0.3
      • Fixed a problem with the respawn cvar check where it would cause an error if the event wasn't hooked, but the plugin tried to unhook it anyways.
    • 1.0.4
      • Bots can no longer regenerate life due to errors.
    • 1.0.5
      • Closes regeneration timers on clients who have disconnected from the server.
    • 1.0.5b
      • Too many bug fixes in one day can get to you. I forgot to include the 'public' keyword on the OnClientDisconnect(); function.
    • 1.0.6
      • Readded bot support and created a new cvar to control whether or not they will receive the HpRegeneration bonus (sm_hpregeneration_bots - see commands section).
      • Changed the way checking the major cvars are handled. They no longer hook/unhook the events, but control whether or not the events do anything. I did this to prevent lots of confusion and unnecessary coding on my part.
      • Cleaned up the coding a bit so there aren't so many unneeded brackets.
      • All timers are closed upon map end.
      • Added a few log messages for when the Enable & Respawn cvars are changed.
    • 1.1.0
      • Added a new cvar, sm_hpregeneration_mode to control what the clients' health should regenerate to. See the "control modes" section for more info.
      • Added a check for a change in tickrate.
        • If a client had an active regeneration timer, their timer will continue with the new tickrate. If they didn't, they will still not have a timer.
      • The maxhealth cvar has been renamed to sm_hpregeneration_health to avoid confusion with the mode cvar.
      • A config file is automatically created in the /cfg/sourcemod/ directory. Use that from now on for this plugin's cvars.
    • 1.1.1
      • Fixed a few bugs with the max health not being set properly.
      • Changed around the way health is set on the coding side (you won't notice a difference while in-game).
      • Cleaned up the coding a bit by merging a few functions.
    Attached Files
    File Type: sp Get Plugin or Get Source (hpregeneration.sp - 5239 views - 9.1 KB)

    Last edited by bl4nk; 02-28-2008 at 14:49.
    bl4nk is offline
    TheLaser
    Senior Member
    Join Date: Jan 2008
    Location: USA VA
    Old 01-24-2008 , 18:33   Re: HpRegeneration
    Reply With Quote #2

    All I have to say Is WOW !!!! You did that fast ... OMG you ROCK and even more after I test it ... in a few but I have some players online so i have to wait a few but im hoping it will do the job also I like to set it to 200... is that tough to change if so no worries.. be happy to have 150 if I get no crap in the console..
    TheLaser is offline
    TheLaser
    Senior Member
    Join Date: Jan 2008
    Location: USA VA
    Old 01-24-2008 , 19:39   Re: HpRegeneration
    Reply With Quote #3

    Hi and ya know what no more console spam ... there is a small problem thought .. it works fine untill your killed then when you respawn no more count up ??? maybe this is good for CSS or DOD but for DM we want it to keep working till end of map and thats 30min... unless extended.

    other then that nice work and I can see my console again whoohoo
    TheLaser is offline
    bl4nk
    SourceMod Developer
    Join Date: Jul 2007
    Old 01-24-2008 , 20:43   Re: HpRegeneration
    Reply With Quote #4

    Hmm, I thought you would want exactly the opposite. I can add in another cvar to control whether or not healing goes through deaths or not.

    [edit]

    Updated to Version 1.0.1

    Last edited by bl4nk; 01-24-2008 at 20:56.
    bl4nk is offline
    bl4nk
    SourceMod Developer
    Join Date: Jul 2007
    Old 01-24-2008 , 21:57   Re: HpRegeneration
    Reply With Quote #5

    Updated to Version 1.0.2

    Yaay for bug fixes and stuff. Hopefully this is the last of the problems.

    [edit]

    Updated to Version 1.0.3

    Looks like I forgot one. :>

    Last edited by bl4nk; 01-24-2008 at 23:21.
    bl4nk is offline
    TheLaser
    Senior Member
    Join Date: Jan 2008
    Location: USA VA
    Old 01-24-2008 , 23:34   Re: HpRegeneration
    Reply With Quote #6

    bl4nk you are da-man OMG it works awesome , and no more spam, spam, spam, spam ........... lol dammm Im speachless no ever did anything this fast for me or for anyone elts in such a short period of time.. yes Im sure to you it was an easy scripts to write I can just imagine what your capeable of... damm your good ~~~~> oh and whats in 1.0.3 since 2 seem to work like a charm ???
    TheLaser is offline
    bl4nk
    SourceMod Developer
    Join Date: Jul 2007
    Old 01-24-2008 , 23:39   Re: HpRegeneration
    Reply With Quote #7

    1.0.3 was just a big fix version. I just implemented a bunch of checks to make sure that things wouldn't be hooked or unhooked when they shouldn't be. It was quite confusing, so it's possible I messed something up. I JUST uploaded a second version of 1.0.3 so download it again to make sure you have the newest (I didn't expect someone to download it in the 3 minutes I was editing it).
    bl4nk is offline
    TheLaser
    Senior Member
    Join Date: Jan 2008
    Location: USA VA
    Old 01-24-2008 , 23:47   Re: HpRegeneration
    Reply With Quote #8

    Oh not sure what you ment by :
    "I thought you would want exactly the opposite"
    This is my theory of operation.... my Bots are murderous and unforgiving ... if you can stay alive you derserve to be givin a gift of health up too 200 for just surviving... This is for many maps that dont supply enough health packs or machines. and new players have a chance with my fake clients because those bots just stand as targets so they feel they killed someting and they stay longer .... sort of an equal oppertunity fun server with alot of bells anf whistles. also 200 health reduces the advanced players from a one shot kill to 2 or 3 to take someone out . a fair balance.

    ~~~~~~~~~~~~~~~~>
    TheLaser is offline
    bl4nk
    SourceMod Developer
    Join Date: Jul 2007
    Old 01-24-2008 , 23:54   Re: HpRegeneration
    Reply With Quote #9

    What I meant by that was that if you weren't running a Deathmatch server, you would want exactly the opposite. The way I originally had it was so that when you would respawn, you wouldn't regenerate life. I had it do this so that you wouldn't continually regenerate because you hadn't taken damage yet on that life. Once you took damage though, you would start healing once again. It just seems weird to spawn and all of a sudden have your life start to go up when nothing has happened to you since the previous round. Since you're running a Deathmatch server, I can understand why you would want what you have.
    bl4nk is offline
    TheLaser
    Senior Member
    Join Date: Jan 2008
    Location: USA VA
    Old 01-25-2008 , 00:06   Re: HpRegeneration
    Reply With Quote #10



    No the way it is right now is you respawn at 100 and it doesnt tick till the 1st hit ... say the 1st hit sent you back to 20HP well now if you can stay alive a while it starts healing you up to 200... thats what you did and thats what I wanted and I bet since you but in the option to turn that on and off feature all will love it and I can now also use this in out DOD server..... whoohoo !!!!! and it just shows that people can author scripts that not only work but work silently without console noise, sort of like creating music .. the less noise the sweeter it sounds )

    ~~~~~~~~~~~~~~~~~~~~~>
    TheLaser is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 09:41.


    Powered by vBulletin®
    Copyright ©2000 - 2017, vBulletin Solutions, Inc.
    Theme made by Freecode