Raised This Month: $95 Target: $400

HP Balance 1.5.1

Post New Thread Reply   
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Gameplay        Approver:   VEN (29)
Veteran Member
Join Date: Mar 2004
Old 01-23-2007 , 07:29   HP Balance 1.5.1
Reply With Quote #1

HP Balance v1.5.1

This plugin tries to balance the game between players by changing players hp in function of their death-kill-ratio on player spawn.

This plugin should work with any mod.

To install it, just put the hp_balance.sma into the scripting folder, the hp_balance.amxx into the plugins folder and the hp_balance.txt into the data/lang folder. Add hp_balance.amxx to the end of your plugins.ini. Enable the fun-module in your modules.ini.

HP Balance supports multilanguage, so feel free to translate it and post the translation here.

Default is a max. difference of 50% from initial health, and a ratio-multiplier of 10, so that 4 deaths and 3 kills would result in (4-3)*10+100=110% of the initial health. More than 150% and less than 50% would be set to 150% or 50% percent. If you want to change this, open the sma-file in a text-editor of your choice, and change those lines:
#define SPAWNS_CONSIDERED  10  // Number of respawns considered for calculation of ratio
#define MULTIPLIER         10  // Percentage-multiplier for death-kill-ratio
#define MAX_INC_PERCENTAGE 50  // Max percentage health is increased from base
#define MAX_DEC_PERCENTAGE 50  // if >= 100, min hp is set to 1
#define MAX_PLAYERS        32  // Change this, if your mod and your server are supporting more than 32 players
Compile the plugin using the web compiler or the compiler you downloaded with amxx. Put the new amxx-file into your plugins-folder and change map.
Tip: If you want to award good players instead of balancing the game, just choose a negative multiplier.


Version 1.0:
  • fully working version
Version 1.1:
  • Fixed playerSpawn being launched at demo record and other ResetHUD-events being unequal to spawn
Version 1.2:
  • No more static basic health, but health on spawn as calculation basis, this should take in count those mods with different races with different basis health
Version 1.3:
  • The hp-difference is now fully calculated in %, you may even choose a max. difference of more than 99%, min hp is set to 1 if hp would be 0 or below.
Version 1.4:
  • Plugin now only counts kills-death-ratio within a certain spawn-period. Default is ten respawns. This should prevent players from staying at their level forever on mods as day of defeat.
Version 1.5:
  • Plugin won't make giant steps between each round, but make follow players health only by MULTIPLIER (default 10 %) steps to the real ratio.
  • Min-Health and Max-Health may be adjusted separately.
Version 1.5.1:
  • Little bug at round start, players were starting with only 10 HP ... thx to schlumpf2005 for reporting this

Known Issues:
Due to the rolling kill-death-ratio-deadline, the attributed health points are sometimes not reflecting the actual gaming situation instantly. This is intended, but might confuse players and testers. If you know a better formula than the one used, let me know, and I will look what it's impact is. If you want k-d to be considered without rolling dead line, please use tirvial version.

  • Deutsch/German by Isobold
  • Francais/French by Isobold
  • English/English by Isobold
  • Danish translation by Pagh (aKa Phire Nuk3r)

Which version to choose?
If you just want to have hp changed by kill-death-ratio, choose trivial version. If you want the rolling deadline where older kills and deathes are not considered and hp may not change in huge steps, use hp_balance. Both versions need hp_balance.txt .
Attached Files
File Type: sma Get Plugin or Get Source (hp_balance.sma - 1645 views - 7.8 KB)
File Type: txt hp_balance.txt (259 Bytes, 601 views)
File Type: sma Get Plugin or Get Source (hp_balance_trivial.sma - 1325 views - 6.3 KB)

Last edited by Isobold; 03-08-2007 at 15:43. Reason: New version
Isobold is offline
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-23-2007 , 08:16   Re: HP Balance
Reply With Quote #2


I've tried with some bots.

I'm not sure that it's a good way to show the messages of all players ratio to everyone.
Perhaps by adding a say command like /ratio which gives the possibility to the player to show or not his own message.

Also it seems that it works fine. ;)

Last edited by Arkshine; 01-23-2007 at 08:22.
Arkshine is offline
Veteran Member
Join Date: Mar 2004
Old 01-23-2007 , 10:43   Re: HP Balance
Reply With Quote #3

Your right, that wasn't made intentionally, I changed the 0 to id ;-)

I will test this plugin some days on my own server. If I consider it useful, I will probably add some more functions (like adjusting some of the defines, or a say command instead of per round announcement)
Isobold is offline
Join Date: Jan 2007
Location: Ontario, Canada
Old 01-24-2007 , 00:13   Re: HP Balance
Reply With Quote #4

Reset HUD can be called more then once by a user. block it out... i learned this the hard way...
Trent-Resnor is offline
Send a message via MSN to Trent-Resnor
Veteran Member
Join Date: Mar 2004
Old 01-24-2007 , 08:28   Re: HP Balance
Reply With Quote #5

Could you plz give me some more details (or a link, where I can read more about this topic?)?

Is there any function like client_spawn which is generic and not NS only?

I would not like to do a redundant plugin for DoD, CS, NS and so on ...

edit: Did found it by myself: http://forums.alliedmods.net/showthread.php?t=42159

Last edited by Isobold; 01-24-2007 at 11:58.
Isobold is offline
Join Date: Jan 2007
Location: Ontario, Canada
Old 01-25-2007 , 01:28   Re: HP Balance
Reply With Quote #6

Heh, yea sorry i didn't get to show you what i ment. Glad you found it. and Glad i noticed it before VEN. or else this would have gone to unapproved instantly.
Trent-Resnor is offline
Send a message via MSN to Trent-Resnor
Junior Member
Join Date: Jan 2007
Location: Sunshine State
Old 01-25-2007 , 01:47   Re: HP Balance
Reply With Quote #7

Ah, damn you=)

I was just making somthing similar to this, good job.

+Karma If I helped you.
DuraLast is offline
Veteran Member
Join Date: Mar 2004
Old 01-25-2007 , 11:24   Re: HP Balance
Reply With Quote #8

Thx for your hint Trent-Resnor, when I was scripting for amxx the last time, this issue wasn't known that well, and afaik not that well documented. One of my other plugins, afk_kisss has this problem too, I'll fix it soon there even so I never heard about problems with my plugin due to this issue ...

Edit: I consider the development of this plugin terminated. Some of the defines could be cvars, but this would cost some performance without any advantage, as once configured you might not want to change the values all the time. For some maps you might want to disable this plugin, but amxx already give you a handy mechanism o do this.

Last edited by Isobold; 01-25-2007 at 13:16.
Isobold is offline
Veteran Member
Join Date: Nov 2006
Location: Wisconsin
Old 01-26-2007 , 18:52   Re: HP Balance
Reply With Quote #9

Lol i made something liek this one too, it gave rewards also... but it was too damn sloppy . Nice job though.
"Now safe beneath their wisdom and their feet.
Here I will teach you truly how to sleep."
soccdoodcss is offline
Send a message via AIM to soccdoodcss
Veteran Member
Join Date: Mar 2004
Old 01-27-2007 , 08:55   Re: HP Balance
Reply With Quote #10

I tried this plugin for some hours now, seems to be bug free, but I will soon release a version 1.5 which will take in count the number of players in each team ...

The balancing by hp works quite well, it's lot's more fun, when each player has to give his best. Really good players have to watch harder for not getting injured, medium an bad players get more time to shoot accurate and to finally kill something and train their skills ...
Isobold is offline

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 01:57.

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