Raised This Month: $30 Target: $400
 7% 

[L4D2] Scripted HUD [v1.0.2 | 01-May-2021]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Plugin ID:
7553
Plugin Version:
1.0.2
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    69 
    Plugin Description:
    Display text for up to 4 scripted HUD slots on the screen
    Old 03-10-2021 , 14:49   [L4D2] Scripted HUD [v1.0.2 | 01-May-2021]
    Reply With Quote #1

    L4D2 ONLY

    Description

    Display text for up to 4 scripted HUD slots on the screen.

    You can check more detailed information at L4D2 EMS/Appendix: HUD.

    This plugin is not easy to install and has too many (unusual) conflicts.

    I hope that it can be used as an example to improve it by others and create new things on L4D2.

    You can help it to expand up to 15 HUDs by contributing on this SM issue. (EDIT: now is already included in SM1.11)

    BHaType provided another way to do it with gamedata but I didn't try.

    Features
    • Allow setting HUD text.
    • Allow setting the HUD horizontal text alignment (left/center/right).
    • Predefined HUD texts. (HUD2 = Survivors Name + HP, HUD3 = Tanks Name + HP, HUD4 [disabled by default] = Microphone Speaking)
    • Allow setting the HUD position (x,y).
    • Allow setting the HUD width and height.
    • Allow setting the HUD to blink from white to red while a tank is alive.
    • Allow setting the HUD to blink from white to red.
    • Allow setting the HUD to emit a beep sound. (only while blinking)
    • Allow setting the HUD to have a black transparent background.
    • Allow setting the HUD update frequency (seconds).
    • Allow show/hide the HUD.
    • Allow setting which teams (all/survivor/infected) should see the HUD.
    • Allow setting a movement speed to move the text (left/right/top/bottom).

    Video Demonstration (by Source)



    Preview



    Cvars

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

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

    // Shows the text inside a black transparent background.
    // Note: the background may not draw properly when initialized as "0", start the map with "1" to render properly.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud1_background "0"

    // Makes the text play a beep sound while blinking.
    // 0 = OFF, 1 = ON. Note: the blink cvar must be "1" to play the beep sound.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud1_beep "0"

    // Makes the text blink from white to red.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud1_blink "0"

    // Makes the text blink from white to red while a tank is alive.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud1_blink_tank "1"

    // Overwrite the HUD flag.
    // For debug purposes only.
    // 0 = OFF.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "32767.000000"
    l4d2_scripted_hud_hud1_flag_debug "0"

    // Text area Height.
    // -
    // Default: "0.026"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud1_height "0.026"

    // Which team should see the text.
    // 0 = ALL, 1 = SURVIVOR, 2 = INFECTED.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud1_team "0"

    // The text you want to display in the HUD.
    // Note: When cvar is empty "", plugin will use the predefined HUD text set in the code, check GetHUD*_Text functions.
    // -
    // Default: "HUD 1 TEXT"
    l4d2_scripted_hud_hud1_text "HUD 1 TEXT"

    // Aligns the text horizontally.
    // 1 = LEFT, 2 = CENTER, 3 = RIGHT.
    // -
    // Default: "1"
    // Minimum: "1.000000"
    // Maximum: "3.000000"
    l4d2_scripted_hud_hud1_text_align "1"

    // Makes the text visible.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud1_visible "1"

    // Text area Width.
    // -
    // Default: "1.5"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud1_width "1.5"

    // X (horizontal) position of the text.
    // Note: setting it to less than 0.0 may cut/hide the text at screen.
    // -
    // Default: "0.02"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud1_x "0.02"

    // Animated X (horizontal) direction that the text will move.
    // 0 = Right to Left, 1 = Left to Right.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud1_x_direction "0"

    // Animated X (horizontal) maximum position that the HUD can reach.
    // -
    // Default: "1.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud1_x_max "1.0"

    // Animated X (horizontal) minimum position that the HUD can reach.
    // -
    // Default: "0.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud1_x_min "0.0"

    // Animated X (horizontal) movement speed of the text.
    // 0 = OFF.
    // -
    // Default: "0.0"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud1_x_speed "0.0"

    // Y (vertical) position of the text.
    // Note: setting it to less than 0.0 may cut/hide the text at screen.
    // -
    // Default: "0.015"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud1_y "0.015"

    // Animated Y (vertical) direction that the text will move.
    // 0 = Top to Bottom, 1 = Bottom to Top.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud1_y_direction "0"

    // Animated Y (vertical) maximum position that the HUD can reach.
    // -
    // Default: "1.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud1_y_max "1.0"

    // Animated Y (vertical) minimum position that the HUD can reach.
    // -
    // Default: "0.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud1_y_min "0.0"

    // Animated Y (vertical) movement speed of the text.
    // 0 = OFF.
    // -
    // Default: "0.0"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud1_y_speed "0.0"

    // Shows the text inside a black transparent background.
    // Note: the background may not draw properly when initialized as "0", start the map with "1" to render properly.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud2_background "0"

    // Makes the text play a beep sound while blinking.
    // 0 = OFF, 1 = ON. Note: the blink cvar must be "1" to play the beep sound.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud2_beep "0"

    // Makes the text blink from white to red.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud2_blink "0"

    // Makes the text blink from white to red while a tank is alive.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud2_blink_tank "1"

    // Overwrite the HUD flag.
    // For debug purposes only.
    // 0 = OFF.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "32767.000000"
    l4d2_scripted_hud_hud2_flag_debug "0"

    // Text area Height.
    // -
    // Default: "0.026"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud2_height "0.026"

    // Which team should see the text.
    // 0 = ALL, 1 = SURVIVOR, 2 = INFECTED.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud2_team "0"

    // The text you want to display in the HUD.
    // Note: When cvar is empty "", plugin will use the predefined HUD text set in the code, check GetHUD*_Text functions.
    // -
    // Default: ""
    l4d2_scripted_hud_hud2_text ""

    // Aligns the text horizontally.
    // 1 = LEFT, 2 = CENTER, 3 = RIGHT.
    // -
    // Default: "1"
    // Minimum: "1.000000"
    // Maximum: "3.000000"
    l4d2_scripted_hud_hud2_text_align "1"

    // Makes the text visible.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud2_visible "1"

    // Text area Width.
    // -
    // Default: "1.5"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud2_width "1.5"

    // X (horizontal) position of the text.
    // Note: setting it to less than 0.0 may cut/hide the text at screen.
    // -
    // Default: "0.75"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud2_x "0.75"

    // Animated X (horizontal) direction that the text will move.
    // 0 = Left to Right, 1 = Right to Left.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud2_x_direction "0"

    // Animated X (horizontal) maximum position that the HUD can reach.
    // -
    // Default: "1.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud2_x_max "1.0"

    // Animated X (horizontal) minimum position that the HUD can reach.
    // -
    // Default: "0.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud2_x_min "0.0"

    // Animated X (horizontal) movement speed of the text.
    // 0 = OFF.
    // -
    // Default: "0.0"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud2_x_speed "0.0"

    // Y (vertical) position of the text.
    // Note: setting it to less than 0.0 may cut/hide the text at screen.
    // -
    // Default: "0.015"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud2_y "0.015"

    // Animated Y (vertical) direction that the text will move.
    // 0 = Top to Bottom, 1 = Bottom to Top.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud2_y_direction "0"

    // Animated Y (vertical) maximum position that the HUD can reach.
    // -
    // Default: "1.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud2_y_max "1.0"

    // Animated Y (vertical) minimum position that the HUD can reach.
    // -
    // Default: "0.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud2_y_min "0.0"

    // Animated Y (vertical) movement speed of the text.
    // 0 = OFF.
    // -
    // Default: "0.0"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud2_y_speed "0.0"

    // Shows the text inside a black transparent background.
    // Note: the background may not draw properly when initialized as "0", start the map with "1" to render properly.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud3_background "0"

    // Makes the text play a beep sound while blinking.
    // 0 = OFF, 1 = ON. Note: the blink cvar must be "1" to play the beep sound.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud3_beep "0"

    // Makes the text blink from white to red.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud3_blink "0"

    // Makes the text blink from white to red while a tank is alive.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud3_blink_tank "1"

    // Overwrite the HUD flag.
    // For debug purposes only.
    // 0 = OFF.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "32767.000000"
    l4d2_scripted_hud_hud3_flag_debug "0"

    // Text area Height.
    // -
    // Default: "0.026"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud3_height "0.026"

    // Which team should see the text.
    // 0 = ALL, 1 = SURVIVOR, 2 = INFECTED.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud3_team "0"

    // The text you want to display in the HUD.
    // Note: When cvar is empty "", plugin will use the predefined HUD text set in the code, check GetHUD*_Text functions.
    // -
    // Default: ""
    l4d2_scripted_hud_hud3_text ""

    // Aligns the text horizontally.
    // 1 = LEFT, 2 = CENTER, 3 = RIGHT.
    // -
    // Default: "1"
    // Minimum: "1.000000"
    // Maximum: "3.000000"
    l4d2_scripted_hud_hud3_text_align "1"

    // Makes the text visible.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud3_visible "1"

    // Text area Width.
    // -
    // Default: "1.5"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud3_width "1.5"

    // X (horizontal) position of the text.
    // Note: setting it to less than 0.0 may cut/hide the text at screen.
    // -
    // Default: "0.02"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud3_x "0.02"

    // Animated X (horizontal) direction that the text will move.
    // 0 = Left to Right, 1 = Right to Left.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud3_x_direction "0"

    // Animated X (horizontal) maximum position that the HUD can reach.
    // -
    // Default: "1.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud3_x_max "1.0"

    // Animated X (horizontal) minimum position that the HUD can reach.
    // -
    // Default: "0.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud3_x_min "0.0"

    // Animated X (horizontal) movement speed of the text.
    // 0 = OFF.
    // -
    // Default: "0.0"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud3_x_speed "0.0"

    // Y (vertical) position of the text.
    // Note: setting it to less than 0.0 may cut/hide the text at screen.
    // -
    // Default: "0.15"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud3_y "0.15"

    // Animated Y (vertical) direction that the text will move.
    // 0 = Top to Bottom, 1 = Bottom to Top.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud3_y_direction "0"

    // Animated Y (vertical) maximum position that the HUD can reach.
    // -
    // Default: "1.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud3_y_max "1.0"

    // Animated Y (vertical) minimum position that the HUD can reach.
    // -
    // Default: "0.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud3_y_min "0.0"

    // Animated Y (vertical) movement speed of the text.
    // 0 = OFF.
    // -
    // Default: "0.0"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud3_y_speed "0.0"

    // Shows the text inside a black transparent background.
    // Note: the background may not draw properly when initialized as "0", start the map with "1" to render properly.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud4_background "0"

    // Makes the text play a beep sound while blinking.
    // 0 = OFF, 1 = ON. Note: the blink cvar must be "1" to play the beep sound.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud4_beep "0"

    // Makes the text blink from white to red.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud4_blink "0"

    // Makes the text blink from white to red while a tank is alive.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud4_blink_tank "1"

    // Overwrite the HUD flag.
    // For debug purposes only.
    // 0 = OFF.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "32767.000000"
    l4d2_scripted_hud_hud4_flag_debug "0"

    // Text area Height.
    // -
    // Default: "0.026"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud4_height "0.026"

    // Which team should see the text.
    // 0 = ALL, 1 = SURVIVOR, 2 = INFECTED.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud4_team "0"

    // The text you want to display in the HUD.
    // Note: When cvar is empty "", plugin will use the predefined HUD text set in the code, check GetHUD*_Text functions.
    // -
    // Default: ""
    l4d2_scripted_hud_hud4_text ""

    // Aligns the text horizontally.
    // 1 = LEFT, 2 = CENTER, 3 = RIGHT.
    // -
    // Default: "1"
    // Minimum: "1.000000"
    // Maximum: "3.000000"
    l4d2_scripted_hud_hud4_text_align "1"

    // Makes the text visible.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud4_visible "1"

    // Text area Width.
    // -
    // Default: "1.5"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud4_width "1.5"

    // X (horizontal) position of the text.
    // Note: setting it to less than 0.0 may cut/hide the text at screen.
    // -
    // Default: "0.75"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud4_x "0.75"

    // Animated X (horizontal) direction that the text will move.
    // 0 = Left to Right, 1 = Right to Left.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud4_x_direction "0"

    // Animated X (horizontal) maximum position that the HUD can reach.
    // -
    // Default: "1.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud4_x_max "1.0"

    // Animated X (horizontal) minimum position that the HUD can reach.
    // -
    // Default: "0.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud4_x_min "0.0"

    // Animated X (horizontal) movement speed of the text.
    // 0 = OFF.
    // -
    // Default: "0.0"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud4_x_speed "0.0"

    // Y (vertical) position of the text.
    // Note: setting it to less than 0.0 may cut/hide the text at screen.
    // -
    // Default: "0.35"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud4_y "0.35"

    // Animated Y (vertical) direction that the text will move.
    // 0 = Top to Bottom, 1 = Bottom to Top.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud4_y_direction "0"

    // Animated Y (vertical) maximum position that the HUD can reach.
    // -
    // Default: "1.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud4_y_max "1.0"

    // Animated Y (vertical) minimum position that the HUD can reach.
    // -
    // Default: "0.0"
    // Minimum: "-1.000000"
    // Maximum: "1.000000"
    l4d2_scripted_hud_hud4_y_min "0.0"

    // Animated Y (vertical) movement speed of the text.
    // 0 = OFF.
    // -
    // Default: "0.0"
    // Minimum: "0.000000"
    // Maximum: "2.000000"
    l4d2_scripted_hud_hud4_y_speed "0.0"

    // Interval in seconds to update the HUD.
    // -
    // Default: "0.1"
    // Minimum: "0.100000"
    l4d2_scripted_hud_update_interval "0.1" 
    Admin Commands
    • sm_l4d2_scripted_hud_reload_data => Reload the HUD texts set in the data file. (z flag required)
    • sm_print_cvars_l4d2_scripted_hud => Print the plugin related cvars and their respective values to the console. (z flag required)

    Change Log

    Spoiler


    Known Issues
    • This plugin conflicts with the "Admin System" addon by Rayman1103 (GameMaps / Steam Workshop)
    • This plugin conflicts with any plugin that changes the <gamemode>.nut file. (check Related Plugins section)
    • This plugin conflicts with any addon or map that changes the <gamemode>.nut file. (check it by opening the .vpk and going to the "scripts\vscripts\" folder)
    • This plugin conflicts with any mutation that changes the <gamemode>.nut file. (e.g: holdout)
    • If your HUD is showing and hiding very fast probably you have some <gamemode>.nut file conflicting with the plugin.

    Notes
    • If you need set special characters in a static hud text slot, instead using the cvar for it, use the file located at the data folder (available in the attachments), because cvars don't read special characters from .cfg files.
    • There is no multi-language support, cause the text shown is not per client, the text will be the same for everyone.
    • You MUST have a file with your gamemode in the "\left4dead2\scripts\vscripts\" folder, if the folder doesn't exist, create it. (e.g. left4dead/scripts/vscripts/coop.nut)
    • The <gamemode>.nut file must exist because the HUD seems to initialize only during the "scripted mode" phase. (I don't have much info about that)
    • The position/width/height of the HUD may vary depending on the client screen resolution. (e.g. for 800x640 the best height value is 0.058, while for 1280x720 is 0.035, while for 1920x1080 is 0.026)
    • Since there is no option to align vertically, setting the HUD height to high values can make the text go down.
    • The limit of a HUD text is up to 127 characters.
    • The total # of avaliable HUDs are 15, but I was unable to set more than 4 (using SM + GameRules_SetPropString) because of a currently sourcemod limitation. (issue already open here)
    • Since I wasn't able to pass the HUD id to set the text, I fill it with spaces, so depending on the resolution or the HUD width it may show a "..." at the end. To hide this I increased the width size of all 4 HUDs.
    • Setting the background cvar from "0" to "1" in-game doesn't work, you have to restart the map with the cvar (on l4d2_scripted_hud.cfg) already initialized as "1" otherwise, the game won't render it properly.
    • Isn't possible to change the background or text color/alpha.
    • Predefined HUDs are not used when its relative "*_text" cvar has a value set.
    • The HUD4 text was made to show up who is speaking on the microphone, but since it uses an external extension (for SM1.10), the code is commented.

    To Do
    • Try to fix the background not rendering properly when changing from "0" to "1" in-game.
    • Add support to the other HUDs (5-15). (depends on this SM issue)
    • Support timers.
    • Make the voice hook extension optional while downloading the plugin.
    • Find a way to don't require a <gamemode>.nut file.
    • Add support for unicode characters. (txt)

    Thank you!

    Related Plugins

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

    IMPORTANT: <gamemode>.nut File

    You MUST have a file with your gamemode in the "\left4dead2\scripts\vscripts\" folder, if the folder doesn't exist, create it. (e.g. scripts/vscripts/coop.nut)

    Your <gamemode>.nut file content MUST have the following line otherwise, the plugin won't work:

    PHP Code:
    g_ModeScript 
    Code snippet inside the "l4d2_scripted_hud_rename.nut" file.

    Installation
    • Put the "l4d2_scripted_hud.cfg" file (click Get Plugin) in your "\addons\sourcemod\data\" folder.
    • Put the "l4d2_scripted_hud.smx" file (click Get Plugin) in your "\addons\sourcemod\plugins\" folder.
    • Download the "l4d2_scripted_hud.zip" file and extract in your "\left4dead2\scripts\vscripts\" folder, if the folder doesn't exist, create it. (don't forget to backup your <gamemode>.nut file if you already have one, e.g. coop.nut)
    • Rename the "l4d2_scripted_hud_rename.nut" file to your gamemode (<gamemode>.nut) and restart the map. (you can find your gamemode value by typing "!cvar mp_gamemode" in chat, e.g. if you are hosting a coop server the file should me renamed as "coop.nut")


    Since people often miss this last step (even being warned multiple times in the thread),
    Ensure that you renamed the l4d2_scripted_hud_rename.nut file to your gamemode. (<gamemode>.nut)

    • If you run a coop server. Rename it to "coop.nut"
    • If you run a versus server. Rename it to "versus.nut"
    • If you run a survival server. Rename it to "survival.nut"
    • If you run a scavenge server. Rename it as "scavenge.nut"
    • If you run some mutation gamemode. Rename it to "<mutation>.nut"

    Attached Files
    File Type: zip l4d2_scripted_hud.zip (468 Bytes, 876 views)
    File Type: cfg l4d2_scripted_hud.cfg (540 Bytes, 639 views)
    File Type: sp Get Plugin or Get Source (l4d2_scripted_hud.sp - 194 views - 82.4 KB)
    __________________

    Last edited by Marttt; 01-15-2023 at 13:20.
    Marttt is online now
    Psyk0tik
    Veteran Member
    Join Date: May 2012
    Location: Homeless
    Old 03-11-2021 , 02:07   Re: [L4D2] Scripted HUD [v1.0.0 | 10-March-2021]
    Reply With Quote #2

    This is pretty cool!
    __________________
    Psyk0tik is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Location: Brazil
    Old 03-13-2021 , 19:24   Re: [L4D2] Scripted HUD [v1.0.1 | 13-March-2021]
    Reply With Quote #3

    Updated 1.0.1

    Code:
    1.0.1 (13-March-2021)
    - Added cvars to make the next animated. (thanks "Source" for requesting)
    - Increased some cvars min/max bounds to fit more screen resolutions.
    __________________
    Marttt is online now
    Tank Rush
    Senior Member
    Join Date: May 2019
    Location: Argentina
    Old 03-13-2021 , 20:29   Re: [L4D2] Scripted HUD [v1.0.1 | 13-March-2021]
    Reply With Quote #4

    Great update!
    Here is a video demonstration of how the HUD1 text with animation looks like.
    __________________
    Sorry i don't speak english very well

    --->My name is Source and I'm on Steam<---
    Discord: Source#9382
    Tank Rush is offline
    RastA_RaTon
    New Member
    Join Date: Dec 2016
    Old 04-02-2021 , 23:49   Re: [L4D2] Scripted HUD [v1.0.1 | 13-March-2021]
    Reply With Quote #5

    Quote:
    Originally Posted by Tank Rush View Post
    Great update!
    Here is a video demonstration of how the HUD1 text with animation looks like.
    Hello, could you explain how was the configuration for the hud to move?
    I have tried but I don't understand much.
    RastA_RaTon is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Location: Brazil
    Old 04-03-2021 , 13:21   Re: [L4D2] Scripted HUD [v1.0.1 | 13-March-2021]
    Reply With Quote #6

    @RastA_RaTon,

    You have to check the "Animated" cvars, here are some from the "X" (HUD1)

    Basically you have to change the "l4d2_scripted_hud_hud1_x_speed" cvar to "0.0025" for example.

    Code:
    l4d2_scripted_hud_hud1_x_speed 0.0025
    PHP Code:
    // Animated X (horizontal) direction that the text will move.
    // 0 = Right to Left, 1 = Left to Right.
    l4d2_scripted_hud_hud1_x_direction "0"

    // Animated X (horizontal) maximum position that the HUD can reach.
    l4d2_scripted_hud_hud1_x_max "1.0"

    // Animated X (horizontal) minimum position that the HUD can reach.
    l4d2_scripted_hud_hud1_x_min "0.0"

    // Animated X (horizontal) movement speed of the text.
    // 0 = OFF.
    l4d2_scripted_hud_hud1_x_speed "0.0" 
    __________________

    Last edited by Marttt; 04-04-2021 at 01:24.
    Marttt is online now
    Sev
    Veteran Member
    Join Date: May 2010
    Old 04-03-2021 , 14:16   Re: [L4D2] Scripted HUD [v1.0.1 | 13-March-2021]
    Reply With Quote #7

    It would be cool if something like this could be expanded to include an all 8 survivor hud.
    Sev is offline
    BHaType
    Great Tester of Whatever
    Join Date: Jun 2018
    Old 04-03-2021 , 22:13   Re: [L4D2] Scripted HUD [v1.0.1 | 13-March-2021]
    Reply With Quote #8

    I'm not sure it will help but it's worth a try

    Spoiler
    __________________
    cry
    BHaType is offline
    Send a message via AIM to BHaType
    Striker black
    Member
    Join Date: Apr 2013
    Old 04-04-2021 , 10:18   Re: [L4D2] Scripted HUD [v1.0.1 | 13-March-2021]
    Reply With Quote #9

    fantastic plugin, just what I was looking for for the tank hud!

    the bad news is that my server stays hung up and no longer starts, needs a manual operation to turn it back on.

    this was on the records.

    Code:
    L 04/03/2021 - 23:50:54: SourceMod error session started
    L 04/03/2021 - 23:50:54: Info (map "c1m1_hotel") (file "/home/container/left4dead2/addons/sourcemod/logs/errors_20210403.log")
    L 04/03/2021 - 23:50:54: [SM] Exception reported: Couldn't find gamerules proxy entity.
    L 04/03/2021 - 23:50:54: [SM] Blaming: l4d2_scripted_hud.smx
    L 04/03/2021 - 23:50:54: [SM] Call stack trace:
    L 04/03/2021 - 23:50:54: [SM]   [0] GameRules_SetPropString
    L 04/03/2021 - 23:50:54: [SM]   [1] Line 613, C:\Users\ST\Downloads\sourcemod 1.10\addons\sourcemod\scripting - LEGACY\l4d2_scripted_hud.sp::OnPluginEnd
    __________________
    --------------------------------------

    Last edited by Striker black; 04-04-2021 at 10:21.
    Striker black is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Location: Brazil
    Old 04-04-2021 , 10:23   Re: [L4D2] Scripted HUD [v1.0.1 | 13-March-2021]
    Reply With Quote #10

    Thanks, I already fixed this error, try re-download.
    __________________
    Marttt is online now
    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 20:35.


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