Raised This Month: $51 Target: $400
 12% 

[L4D1 & L4D2] HP Laser [v1.0.9 | 14-November-2021]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Plugin ID:
7495
Plugin Version:
1.0.9
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    159 
    Plugin Description:
    Shows a laser beam at the client head based on its HP
    Old 02-11-2021 , 12:41   [L4D1 & L4D2] HP Laser [v1.0.9 | 14-November-2021]
    Reply With Quote #1

    Description

    This plugin shows a laser beam at the client's head that from green to red based on its HP.

    It's similar to my [L4D1 & L4D2] HP Sprite plugin.

    Features
    • Automatically sets the laser beam color (from green to red) in a gradient way.
    • Automatically sets the laser beam color to white for black and white survivors.
    • Allow setting the Z axis based on the client position.
    • Allow setting the visibility by team.
    • Allow setting the survivor visibility based on sight and last hit.
    • Allow setting the laser beam model/alpha/fade/size.
    • Allow setting a different laser beam width for Survivor and Infected.
    • Allow setting a laser beam that fills the bar.
    • Allow setting an outline to the laser beam.
    • Allow setting which SI should have a laser beam (except Witch).
    • Allow the client to hide/show the laser beam through a menu or command (client preferences).
    • Show laser beam for incapacitated survivors.

    Preview



    Cvars

    A configuration file named "l4d_hp_laser.cfg" will automatically be created for you upon the first run in the "\cfg\sourcemod\" folder.

    PHP Code:
    // 0 = Align the laser left-to-right per client eye angles. (lower performance)
    // 1 = Align the laser to center. (better performance)
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_hp_laser_align_center "1"

    // Alpha of the laser beam HP.
    // 0 = Invisible, 255 = Fully Visible.
    // -
    // Default: "240"
    // Minimum: "0.000000"
    // Maximum: "255.000000"
    l4d_hp_laser_alpha "240"

    // Show the laser beam HP to the survivor attacker, by this amount of time in seconds, after hitting a special infected.
    // 0 = OFF.
    // -
    // Default: "0.0"
    // Minimum: "0.000000"
    l4d_hp_laser_attack_delay "0.0"

    // Show a laser beam HP in white on "black and white" survivors.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_hp_laser_black_and_white "1"

    // Maximum render alpha that a client must be to hide the laser beam HP.
    // Useful to hide it on invisible/transparent clients.
    // -1 = OFF.
    // -
    // Default: "0"
    // Minimum: "-1.000000"
    // Maximum: "255.000000"
    l4d_hp_laser_client_alpha_max "0"

    // Allow cookies for storing client preferences.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_hp_laser_cookies "1"

    // Enable/Disable the plugin.
    // 0 = Disable, 1 = Enable.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_hp_laser_enable "1"

    // Minimum distance that a client must be from another client to see the laser beam HP.
    // 0 = Always visible.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    l4d_hp_laser_fade_distance "0"

    // Display a laser beam HP to fill the bar.
    // Note: Disable this if you intend to show a lot of laser beams HP. The game limits the number of beams rendered at the same time when limit exceeds it may not draw then all.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_hp_laser_fill "1"

    // Alpha of the laser beam HP that fills the bar.
    // 0 = Invisible, 255 = Fully Visible
    // -
    // Default: "40"
    // Minimum: "0.000000"
    // Maximum: "255.000000"
    l4d_hp_laser_fill_alpha "40"

    // Should the laser beam HP on survivors render in gradient color. 
    // 0 = OFF. (Game colors: Green 40HP+, Yellow 39HP~25HP, Red 24HP-), 1 = Gradient Mode.
    // Note: The Yellow color is defined by the "survivor_limp_health" game cvar.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_hp_laser_gradient_color "0"

    // Height of the laser beam HP.
    // -
    // Default: "2.0"
    // Minimum: "0.000000"
    l4d_hp_laser_height "2.0"

    // Which teams infected can see a laser beam HP.
    // 0 = NONE, 1 = SURVIVOR, 2 = INFECTED, 4 = SPECTATOR, 8 = HOLDOUT.
    // Add numbers greater than 0 for multiple options.
    // Example: "3", enables for SURVIVOR and INFECTED.
    // -
    // Default: "3"
    // Minimum: "0.000000"
    // Maximum: "15.000000"
    l4d_hp_laser_infected_team "3"

    // Width of the infected laser beam HP.
    // -
    // Default: "25.0"
    // Minimum: "0.000000"
    l4d_hp_laser_infected_width "25.0"

    // Model of the laser beam HP.
    // -
    // Default: "vgui/white_additive.vmt"
    l4d_hp_laser_model "vgui/white_additive.vmt"

    // Which teams should multiply the laser beam HP alpha based on the client render alpha.
    // 0 = NONE, 1 = SURVIVOR, 2 = INFECTED, 4 = SPECTATOR, 8 = HOLDOUT.
    // Add numbers greater than 0 for multiple options.
    // Example: "3", enables for SURVIVOR and INFECTED.
    // -
    // Default: "2"
    // Minimum: "0.000000"
    // Maximum: "15.000000"
    l4d_hp_laser_multiply_alpha_team "2"

    // Render type used to draw the laser beams.
    // 0 = Timer (0.1 seconds - less expensive), 1 = OnGameFrame (by frame - more expensive).
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_hp_laser_render_frame "0"

    // Which special infected should have a laser beam HP.
    // 1 = SMOKER, 2 = BOOMER, 4 = HUNTER, 8 = SPITTER, 16 = JOCKEY, 32 = CHARGER, 64 = TANK.
    // Add numbers greater than 0 for multiple options.
    // Example: "127", enables laser beam HP for all SI.
    // -
    // Default: "64"
    // Minimum: "0.000000"
    // Maximum: "127.000000"
    l4d_hp_laser_si "64"

    // Show a laser beam HP to the survivor only if the special infected is on sight.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_hp_laser_sight "1"

    // How many frames should skip while using l4d_hp_laser_render_type = "1" (OnGameFrame). Frames may vary depending on your tickrate. Using a higher value than 2 becomes slower than with the timer on default tick rate (30)
    // -
    // Default: "1"
    // Minimum: "0.000000"
    l4d_hp_laser_skip_frame "1"

    // Which teams spectators can see a laser beam HP.
    // 0 = NONE, 1 = SURVIVOR, 2 = INFECTED, 4 = SPECTATOR, 8 = HOLDOUT.
    // Add numbers greater than 0 for multiple options.
    // Example: "3", enables for SURVIVOR and INFECTED.
    // -
    // Default: "3"
    // Minimum: "0.000000"
    // Maximum: "15.000000"
    l4d_hp_laser_spectator_team "3"

    // Which teams survivors can see a laser beam HP.
    // 0 = NONE, 1 = SURVIVOR, 2 = INFECTED, 4 = SPECTATOR, 8 = HOLDOUT.
    // Add numbers greater than 0 for multiple options.
    // Example: "3", enables for SURVIVOR and INFECTED.
    // -
    // Default: "3"
    // Minimum: "0.000000"
    // Maximum: "15.000000"
    l4d_hp_laser_survivor_team "3"

    // Width of the survivor laser beam HP.
    // -
    // Default: "15.0"
    // Minimum: "0.000000"
    l4d_hp_laser_survivor_width "15.0"

    // Which teams should have a laser beam HP.
    // 0 = NONE, 1 = SURVIVOR, 2 = INFECTED, 4 = SPECTATOR, 8 = HOLDOUT.
    // Add numbers greater than 0 for multiple options.
    // Example: "3", enables for SURVIVOR and INFECTED.
    // -
    // Default: "3"
    // Minimum: "0.000000"
    // Maximum: "15.000000"
    l4d_hp_laser_team "3"

    // Additional Z axis distance of laser beam HP based on client position.
    // -
    // Default: "85"
    // Minimum: "0.000000"
    l4d_hp_laser_z_axis "85" 
    Public Commands
    • sm_hplaser => Open a menu to toogle the laser beam HP for the client.
    • sm_hidehplaser => Disable laser beam HP for the client.
    • sm_showhplaser => Enable laser beam HP for the client.

    Admin Commands
    • sm_print_cvars_l4d_hp_laser => Print the plugin related cvars and their respective values to the console. (z flag required)

    Change Log

    Spoiler


    Notes
    • L4D1 and L4D2 behave differently for some values (e.g: alpha transparency).
    • The laser beam may have a blinking effect. Probably there is nothing that can be done.
    • There is no different appearance between normal and temporary health.
    • I use a TraceRay/TraceHull to determine the laser beam visibility on sight. This may not work in all cases (e.g. transparent windows).
    • Every laser beam is drawn using TE_SetupBeamPoints.
    • Due to game engine limitations (nothing I can do), the amount of laser beams that can be drawn at the same time is limited to 32, so in case you have many clients some beams may not appear.
    • To reduce this issue you can set some cvars (l4d_hp_laser_fill / l4d_hp_laser_outline) to "0".

    To Do
    • Enable visibility through transparent glasses.
    • Add laser beam for Witch.
    • Hide from SI when the survivor is in a "hidden" state.
    • Add cooldown ability bar.
    • Add list with client settings.

    Thank you!
    • lugui - for helping me and his [Any] Simple HealthBars plugin.
    • GsiX - for helping me with some code snippets.
    • HarryPotter - for reporting a render bug in L4D1.
    • 3aljiyavslgazana - for requesting the laser alpha being based on client render alpha.
    • RA - for reporting the bar showing on SIs while in ghost mode and requesting the frame render option.
    • LexNBR - for requesting a menu/command to hide/show the laser beam.
    • TrueDarkness - for reporting a bug with the Last Boss plugin.
    • xZk - for providing the code to center align the laser.

    Related Plugins

    Post Reply
    • Any feedback, bug reports, fixes, improvements, translations or suggestions for the plugin are welcome.

    Installation
    • Put the "l4d_hp_laser.smx" file (click Get Plugin) in your "\addons\sourcemod\plugins\" folder.
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d_hp_laser.sp - 1041 views - 53.1 KB)
    __________________

    Last edited by Marttt; 01-30-2023 at 07:11.
    Marttt is offline
    KasperH
    Senior Member
    Join Date: Apr 2016
    Location: Hungary
    Old 02-11-2021 , 13:19   Re: [L4D1 & L4D2] HP Laser [v1.0.0 | 11-February-2021]
    Reply With Quote #2

    So many cool plugins Marttt, well done!
    __________________

    "I've Got You In My Sights!"
    KasperH is offline
    user2000
    Member
    Join Date: Nov 2015
    Location: Peru - Lima
    Old 02-11-2021 , 13:22   Re: [L4D1 & L4D2] HP Laser [v1.0.0 | 11-February-2021]
    Reply With Quote #3

    thanks for sharing this plugin
    user2000 is offline
    TypicalType
    Member
    Join Date: Mar 2020
    Location: Brazil
    Old 02-12-2021 , 07:55   Re: [L4D1 & L4D2] HP Laser [v1.0.1 | 12-February-2021]
    Reply With Quote #4

    This is even better than the previous one!
    TypicalType is offline
    HarryPotter
    Veteran Member
    Join Date: Sep 2017
    Location: Taiwan, Asia
    Old 02-12-2021 , 10:07   Re: [L4D1 & L4D2] HP Laser [v1.0.1 | 12-February-2021]
    Reply With Quote #5

    perfect cool plugin
    __________________
    HarryPotter is offline
    HarryPotter
    Veteran Member
    Join Date: Sep 2017
    Location: Taiwan, Asia
    Old 02-12-2021 , 10:48   Re: [L4D1 & L4D2] HP Laser [v1.0.1 | 12-February-2021]
    Reply With Quote #6

    I think l4d1 is still not working
    __________________
    HarryPotter is offline
    ReCreator
    Member
    Join Date: Nov 2017
    Location: Ukraine,Kyiv
    Old 02-13-2021 , 03:01   Re: [L4D1 & L4D2] HP Laser [v1.0.2 | 12-February-2021]
    Reply With Quote #7

    L4D1, using for tank hp only.
    So far so good, thank you Marttt for a nice plugin!
    __________________
    Sorry for my pure English...
    ReCreator is offline
    BlackSabbarh
    Senior Member
    Join Date: Sep 2018
    Old 02-14-2021 , 15:42   Re: [L4D1 & L4D2] HP Laser [v1.0.2 | 12-February-2021]
    Reply With Quote #8

    Host_Error: CVEngineServer:recacheModel:
    "materials/vgui/white_additive.vmt" overflow, too many models
    BlackSabbarh is offline
    3aljiyavslgazana
    Member
    Join Date: Dec 2018
    Old 02-18-2021 , 03:27   Re: [L4D1 & L4D2] HP Laser [v1.0.3 | 16-February-2021]
    Reply With Quote #9

    Hey Marttt, this is a beautiful plugin you have here ;D
    do you think it's possible to make a small compatibility with Crasher's Mutant Tanks so that the HP Laser can be synced (can fade in and out) with a Tank that has the Ghost Ability
    and with that the HP Laser doesn't easily give away the location of an invisible tank.
    3aljiyavslgazana is offline
    3aljiyavslgazana
    Member
    Join Date: Dec 2018
    Old 02-18-2021 , 11:10   Re: [L4D1 & L4D2] HP Laser [v1.0.4 | 18-February-2021]
    Reply With Quote #10

    Quote:
    Originally Posted by Marttt View Post
    @3aljiyavslgazana, thanks for the feedback.

    I added an option to render the alpha based on the client alpha (default only to infected) check if that makes more compatible now.

    Updated (1.0.4)

    Code:
    1.0.4 (18-February-2021)
        - Added cvar to multiply the laser beam alpha based on client render alpha. (thanks "3aljiyavslgazana" for requesting)
    
    New cvar:
    • l4d_hp_laser_multiply_alpha_team
    Yep, it fades with the invisible tank until both the Tank and HP Laser are completely invisible ;P
    only one problem, the HP Laser doesn't decrease in size (or doesn't have animation) with the "l4d_hp_laser_multiply_alpha_team" set to "2",
    it decreases just fine if it's set to "0" , do you think you can fix this?
    3aljiyavslgazana is offline
    Reply



    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:24.


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