Bloodlust : a condition given to a player where he'll spawn with more health and gain health by hitting enemies and (optionally) lose health over time
Features :
[Possibility]Give bloodlust automatically to choosen team(s).
[Possibility]Allow players to vote for a bloodlust round or a length of bloodlust rounds or time.
Allow admins to give bloodlust to specific player(s) or to enable a bloodlust round (current or upcoming) or a period of time where players will be bloodlusted.
[Possibility]Give more health on spawn to bloodlusted players.
[Possibility]Allow a new maximum HP over the usual maximum (buffed health in TF2 though).
I-believe-nice verbose.
As everything is optional you can use that plugin as an admin-command-only plugin too. You could also use it only for the health on spawn if your want.
Tested in CSS/TF2; should work in CSGO/DODS, as well as other mods.
Small "red blinking" screen when a player has low health.
It is possible to disallow killing players via bloodlust degeneration.
[Possibility]TF2-only : medic healing a target can be healed if both the medic and the target are bloodlusted.
How to install :
Place "bloodlustmod.phrases.txt" in "translation" folder.
Place the plugin (bloodlustmod.smx) in the plugin folder.
As with many other plugins, a config file is automatically created in MOD\cfg\sourcemod\bloodlustmod.cfg
Admin Commands :
<sm_bloodlust | say !bloodlust> <#userid|name|targets|[aimedTarget]> : enable bloodlust for the target.
<sm_removebloodlust | say !removebloodlust> <#userid|name|targets|[aimedTarget]> : removes bloodlust for the target.
<sm_spawnbloodlust | say !spawnbloodlust> <#userid|name|targets|[aimedTarget]> : gives bloodlust on next spawn to the target.
<sm_cancelspawnbloodlust | say !cancelspawnbloodlust> <#userid|name|targets|[aimedTarget]> : gives bloodlust on next spawn to the target.
---------------------
<sm_bloodlustround | say !bloodlustround> : enable bloodlust for the round.
<sm_bloodlustnextround | say !bloodlustnextround> : enable bloodlust for the upcoming round.
<sm_bloodlusttime | say !bloodlusttime> <time> : time is in minutes, enable bloodlust for a time.
<sm_cancelbloodlustround | say !cancelbloodlustround> : cancel bloodlust initiated by sm_bloodlustround or sm_bloodlusttime.
<sm_cancelbloolustnextround | say !cancelbloolustnextround> : cancel upcoming bloodlust rounds.
<sm_cancelbloodlustrounds | say !cancelbloodlustrounds> : cancel bloodlust initiated by sm_bloodlustround or sm_bloodlusttime, and upcoming rounds.
---------------------
In the various command, "bloodlust" can be replaced by "blust".
Non-admin Commands :
<sm_votebloodlust | say !votebloodlust> : vote to enable bloodlust for everyone.
// Ratio of the damage done going to health (1 = 100%; < 0 = lose life).
// -
// Default: "0.50"
bl_health_leech "0.50"
// Value is multiplied to the leeched amount before being applied to the healing medic(s).
// -
// Default: "0.5"
bl_health_leech_medigun_medic_ratio "0.5"
// Leeched HP given to the medics is split amongst them. 1=Yes (Def.), 0=No.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bl_health_leech_medigun_medic_split "1"
// Value is multiplied to the leeched amount before being applied to the healed target.
// -
// Default: "0.5"
bl_health_leech_medigun_target_ratio "0.5"
// Does at least one medic needs to be bloodlusted for the target to have its _ratio applied ? 1=Yes, 0=No.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bl_health_leech_medigun_target_ratio_type "1"
// Maximum HP players can get through HP leech. Excludes spawn. 1=100%=normal if relative.
// -
// Default: "2.0"
bl_health_max "2.0"
// 0=Absolute, 1=Relative to spawn health before bonus (Def).
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bl_health_max_type "1"
// Bonus HP players spawn with (or gets if admin command). 1= +100% if relative
// -
// Default: "25"
bl_health_spawn_bonus "25"
// Does dying remove non-automatic bloodlust (i.e. tf2 where you respawn; with bl gotten via admin command) ? 0=No (Def), 1=Yes.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bl_losebloodlustondeath "1"
// Minimum total players (no spec, includes bots) needed for auto/random bloodlust.
// -
// Default: "0"
// Minimum: "0.000000"
bl_minplayers "0"
// If _auto = 0, what is the chance for the next round to have bloodlust for everyone ? 0= 0%, 1= 100%.
// -
// Default: "0.0"
// Minimum: "0.000000"
// Maximum: "1.000000"
bl_round_chance "0.0"
// When the ticks can happen. 0=Always, 1=Only when the game is active (Def.).
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bl_tick_activegameonly "1"
// Set the time interval in seconds between each HP loss (0 = no degen).
// -
// Default: "2.0"
// Minimum: "0.000000"
bl_tick_delay "2.0"
// Fade color in R-G-B-A ? Every value must be between 0 and 255.
// -
// Default: "255 0 0 127"
bl_tick_fade_color "255 0 0 127"
// Maximum HP when red fading screen happens ? Updated hp is taken. 0=Disable.
// -
// Default: "5"
// Minimum: "0.000000"
bl_tick_fade_threshold "5"
// Set the HP loss per interval. 1=100% if relative.
// -
// Default: "0.02"
bl_tick_healthloss "0.02"
// Can a player die from bloodlust (if not, minimum hp = 1) ? 2=Yes but only when game is active (Def), 1=Yes, 0=No.
// -
// Default: "2"
// Minimum: "0.000000"
// Maximum: "2.000000"
bl_tick_healthloss_cankill "2"
// When bl_tick_healthloss is relative, how to round health loss? 0=Floor, 1=Nearest (Def), 2=Ceil.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "2.000000"
bl_tick_healthloss_relativerounding "1"
// 0=Absolute (Def), 1=Relative to max health on spawn before spawn bonus, 2=Relative to current health.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "2.000000"
bl_tick_healthloss_type "1"
// Minimum time between one 'spawn' advertisement and either another one or a minplayers update. Def '15.0'.
// -
// Default: "15.0"
// Minimum: "0.000000"
bl_verbose_minimumdelay "15.0"
// Advertise when there are enough players
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bl_verbose_minplayers "1"
// Mod name. Default is 'Bloodlust'.
// -
// Default: "Bloodlust"
bl_verbose_modname "Bloodlust"
// Prefix attached to verbose phrases. Default is '[SM] '.
// -
// Default: "[SM] "
bl_verbose_prefix "[SM] "
// Should the random round be announced ? 1=Yes (Def.), 0=No
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bl_verbose_randomround "1"
// How long (in spawns) will the plugin be advertised when automatically bloodlusting? Per user. 0=Don't.
// -
// Default: "2"
// Minimum: "0.000000"
bl_verbose_spawn "2"
// Should the player vote trigger be hidden (i.e. hide "!votebl")? 1=Yes, 0=No (Def).
// -
// Default: "0.0"
// Minimum: "0.000000"
// Maximum: "1.000000"
bl_vote_hide_trigger "0.0"
// How long will bloodlust-for-all be available. If _type=1 it is in time, if _type=0 it is in rounds (excludes current).
// -
// Default: "5.0"
// Minimum: "0.000000"
bl_vote_length "5.0"
// Is bloodlust-for-all length in time (=1, Def.) or in round amount (=0; excludes current round).
// -
// Default: "1.0"
// Minimum: "0.000000"
// Maximum: "1.000000"
bl_vote_length_type "1.0"
// Time in minutes after a vote passes before people can vote again. Def=1.0.
// -
// Default: "1.0"
// Minimum: "0.000000"
bl_vote_revote_delay "1.0"
--------------
I've gotten few problems while making this plugin.
Any suggestions/comments on code or the plugin are welcomed.
Credits to: mateo10 and bl4nk for their regeneration plugins, from which I took some pieces of code.
Changelog :
2.0.0 (29-03-2015)
Major overhaul
----- (Major changes)
From CSS to Any (SDKHooks @ SDKHook_OnTakeDamageAlive instead of player_hurt). Tested under CSS/TF2. Should work with all.
Damage is now post-reductions (i.e. doing 30 dmg reduced to 5 by armor will deal 5 and the leech calculation will be calculated on 5)
Changed/Renamed all ConVars & descriptions/constraints. Probable break : I did this since this plugin was pretty much unused anyway.
Possibility to change default HP relatively or in absolute (i.e. +10% health on spawn with bloodlust) on spawn. See bl_health_spawn_bonus and bl_health_spawn_bonus_type.
Possibility to set a maximum HP relative to HP you have on spawn. See bl_health_max and bl_health_max_type.
Possibility to remove relative HP (relative to Maximum or to current HP) instead of absolute. See bl_tick_healthloss and bl_tick_healthloss_type
Possibility for the players to vote for bloodlust (time/rounds). See command sm_votebloodlust, convar bl_vote, bl_vote_percent, bl_vote_length, bl_vote_length_type, bl_vote_revote_delay.
Possibility to have random bloodlust rounds.
Enable automatic/random bloodlust when a minimum amount of players are connected. See bl_minplayers
--- Admin-command related ---
Possibility to enable bloodlust rounds/time via admin commands. See sm_bloodlustround, sm_bloodlustnextround, and sm_bloodlusttime.
Possibility to cancel bloodlust rounds via admin commands. See sm_cancelbloolustnextround, sm_cancelbloodlustround, and sm_cancelbloodlustrounds.
Possibility to give bloodlust (or bloodlust-on-spawn) via admin commands. See sm_bloodlust and sm_spawnbloodlust.
Possibility to remove bloodlust (or bloodlust-on-spawn) via admin commands. See sm_removebloodlust and sm_cancelspawnbloodlust.
-----
Possibility to keep bloodlust when dying (for games when you respawn in a same round, as in TF2; untested though)
Possibility to prevent bloodlust ticks when game is active. See bl_tick_activegameonly.
Possibility to prevent bloodlust ticks from killing when the game is active or not. See bl_tick_healthloss_cankill.
Red tiny-fade on tick past a certain health. See bl_tick_fade_threshold, bl_tick_fade_length and bl_tick_fade_color.
Possibility to advertise the plugin when enough players are present to enable automatic bloodlust, or when spawning. See bl_verbose_spawn, bl_verbose_minplayers, and bl_verbose_minimumdelay.
Possibility to advertise when an upcoming round is randomly selected to be bloodlusted. See bl_verbose_randomround.
Possibility to change the verbose prefix. See ConVar bl_verbose_prefix
Possiblity to change the mod name in verbose. See ConVar bl_verbose_modname. (i.e. if you prefer 'Vampirism' instead of 'Bloodlust'.)
Possibility to Log admin & passed votes. See Convar bl_log_admin and bl_log_passedvote.
TF2-only : added possibility for the medic healing a target to be healed if both the medic and the target are bloodlusted. See convars bl_health_leech_medigun_target_ratio, bl_health_leech_medigun_target_ratio_type, bl_health_leech_medigun_medic_ratio, and bl_health_leech_medigun_medic_split.
Translation file changed. It must be redownloaded.
----- (Minor changes)
ConVar 'bl' is now bl_auto.
Removed restrictions on leech and tick; you can decide to win hp and lose some by attacking.
Creates a config file
Removed FCVAR_REPLICATED
Now uses transitional syntax (1.7 syntax).
A nice increase in the .sp size (from 5028 to 59335).
2.0.1 Fixed not logging passed votes when a player left. (31-03-2015)
2.1.0 (01-03-2015)
Added bl_vote_hide_trigger to hide the vote trigger. Disabled by default.
changed non-passed vote verbose. Instead of having an ugly ".75 needed"; you now have somethign similar to "rtv (Bob wants Bloodlust, 1 in favour, 3 more needed"). Phrases must be redownloaded.
Also added sm_voteblust and sm_votebl as vote command.
pre 2.0.0 (06-03-2011 and before) :
Spoiler
1.0.0 Initial release. (12-29-2009)
1.0.1 Fixed server-console error : attacker (in player_hurt) being world & spawned player leaving (due to timer). (12-30-2009)
1.0.2 Removed use of sdktools : ForcePlayerSuicide(iClient) --> FakeClientCommand(iClient, "kill"). (~12-31-2009)
1.0.3 Stopped using a variable to stock an offset. Also made sure that the attacker & victim aren't the same person (when bl_ff = 1), so that the person couldn't heal if bl_lp was high enough. (01-01-2010)
Same version; added missing CVar in the description.
1.0.4 Fixed 255 max health thing. I wasn't using the byte number in my SetEntData function which caused the problem. Searching for berni's way made me realise this. Thx berni ^^. New max is half a billion (spawn, max and loss HP). Still, the max showed HP is 511 (hardcoded). Reworked code indentation and fixed version problem. (06-03-2011)
1.1.0 Added translation file (en + fr) (06-03-2011)
First : I couldn't get the health of players to go over 255. 256 was the same as 0 (due to byte-coding and overflow flag). Strangly I know that HUD's health value is coded on 9 bits... but couldn't get it over 255... :/.
so that the person couldn't heal if bl_lp was high enough.
Why reinvent the wheel ? Download smlib with over 350 useful functions.
When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
If I was to write only 1 byte, I doubt it would work correctly. I tryed my current new version using 2 bytes but the given HP set/removed was wrong for high value, while it was ok on 4 bytes.
But thanx for your post, it bring me back to sourcemod coding xD lol.
EDIT : Added translation file.
RE-EDIT : Removed include (<sourcemod>... how's that ? Thought that was needed; and I think it didn't compile before...)
From CSS to Any (SDKHooks @ SDKHook_OnTakeDamageAlive instead of player_hurt). Tested under CSS/TF2. Should work with all.
Damage is now post-reductions (i.e. doing 30 dmg reduced to 5 by armor will deal 5 and the leech calculation will be calculated on 5)
Changed/Renamed all ConVars & descriptions/constraints. Probable break : I did this since this plugin was pretty much unused anyway.
Possibility to change default HP relatively or in absolute (i.e. +10% health on spawn with bloodlust) on spawn. See bl_health_spawn_bonus and bl_health_spawn_bonus_type.
Possibility to set a maximum HP relative to HP you have on spawn. See bl_health_max and bl_health_max_type.
Possibility to remove relative HP (relative to Maximum or to current HP) instead of absolute. See bl_tick_healthloss and bl_tick_healthloss_type
Possibility for the players to vote for bloodlust (time/rounds). See command sm_votebloodlust, convar bl_vote, bl_vote_percent, bl_vote_length, bl_vote_length_type, bl_vote_revote_delay.
Possibility to have random bloodlust rounds.
Enable automatic/random bloodlust when a minimum amount of players are connected. See bl_minplayers
--- Admin-command related ---
Possibility to enable bloodlust rounds/time via admin commands. See sm_bloodlustround, sm_bloodlustnextround, and sm_bloodlusttime.
Possibility to cancel bloodlust rounds via admin commands. See sm_cancelbloolustnextround, sm_cancelbloodlustround, and sm_cancelbloodlustrounds.
Possibility to give bloodlust (or bloodlust-on-spawn) via admin commands. See sm_bloodlust and sm_spawnbloodlust.
Possibility to remove bloodlust (or bloodlust-on-spawn) via admin commands. See sm_removebloodlust and sm_cancelspawnbloodlust.
-----
Possibility to keep bloodlust when dying (for games when you respawn in a same round, as in TF2; untested though)
Possibility to prevent bloodlust ticks when game is active. See bl_tick_activegameonly.
Possibility to prevent bloodlust ticks from killing when the game is active or not. See bl_tick_healthloss_cankill.
Red tiny-fade on tick past a certain health. See bl_tick_fade_threshold, bl_tick_fade_length and bl_tick_fade_color.
Possibility to advertise the plugin when enough players are present to enable automatic bloodlust, or when spawning. See bl_verbose_spawn, bl_verbose_minplayers, and bl_verbose_minimumdelay.
Possibility to advertise when an upcoming round is randomly selected to be bloodlusted. See bl_verbose_randomround.
Possibility to change the verbose prefix. See ConVar bl_verbose_prefix
Possiblity to change the mod name in verbose. See ConVar bl_verbose_modname. (i.e. if you prefer 'Vampirism' instead of 'Bloodlust'.)
Possibility to Log admin & passed votes. See Convar bl_log_admin and bl_log_passedvote.
TF2-only : added possibility for the medic healing a target to be healed if both the medic and the target are bloodlusted. See convars bl_health_leech_medigun_target_ratio, bl_health_leech_medigun_target_ratio_type, bl_health_leech_medigun_medic_ratio, and bl_health_leech_medigun_medic_split.
Translation file changed. It must be redownloaded.
----- (Minor changes)
ConVar 'bl' is now bl_auto.
Removed restrictions on leech and tick; you can decide to win hp and lose some by attacking.
Creates a config file
Removed FCVAR_REPLICATED
Now uses transitional syntax (1.7 syntax).
A nice increase in the .sp size (from 5028 to 59335).
This plugin is now more useful/usable than how it originally was =3.
Red
edit : random note : v2 coded from sunday night to satursday night
re-edit : re-uploaded plugin & translation (minor glitch with verbose); there was only 1 download so I didn't change the version
Added bl_vote_hide_trigger to hide the vote trigger. Disabled by default.
changed non-passed vote verbose. Instead of having an ugly ".75 needed"; you now have somethign similar to "rtv (Bob wants Bloodlust, 1 in favour, 3 more needed"). Phrases must be redownloaded.
Also added sm_voteblust and sm_votebl as vote command.
I also forgot to add the admin commands to the first post during 2.0.0 release. I apologize for that <.<.