Raised This Month: $81 Target: $400
 20% 

[L4D1 & L4D2] Random Beam Item [v1.0.3 | 29-May-2022]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Plugin ID:
7774
Plugin Version:
1.0.3
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    40 
    Plugin Description:
    Gives a random beam to items on the map
    Old 08-29-2021 , 15:13   [L4D1 & L4D2] Random Beam Item [v1.0.3 | 29-May-2022]
    Reply With Quote #1

    Description

    This plugin applies a random beam to some items making them easier to identify on the map.

    Creates a similar effect applied to loot items on Borderlands/Diablo.

    Based on the workshop addon Borderlands Loot Beams [Server Mod] (With Sprites) by ReneTM, which inspired and helped me a lot on doing this.

    Warning

    Use carefully. This plugin may spawn too many entities depending on the number of items on the map and can cause a "ED_Alloc: no free edicts" crash.

    Features
    • Allow configuring the beam by classname.
    • Allow configuring the beam color (random or specific).
    • Allow configuring the beam length/width.
    • Allow configuring the hdr color multiplier.
    • Allow enabling/disabling the halo glow.
    • Allow to replicate the glow color. L4D2 only. ([L4D2] Random Glow Item)

    Preview



    Cvars

    A configuration file named "l4d_random_beam_item.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"
    l4d_random_beam_item_enable "1"

    // Algorithm value to detect the beam minimum brightness for a random color (not accurate).
    // -
    // Default: "0.5"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_random_beam_item_min_brightness "0.5"

    // Delete *_spawn entities when its count reaches 0.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_random_beam_item_remove_spawner "1"

    // (L4D2 only) Apply the same color from glow.
    // 0 = OFF, 1 = ON.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_random_beam_item_use_glow_color "1" 
    Data file (data/l4d_random_beam_item.cfg)
    PHP Code:
    // Attributes explained:
    //  "enable"   -> Apply plugin beam to entity. "0" = Disable, "1" = Enable.
    //  "random"   -> Apply a random beam color. "0" = OFF, "1" = ON.
    //  "color"    -> Item beam color. Use three values between 0-255 separated by spaces. "<0-255> <0-255> <0-255>", e.g: "255 255 255". Ignored when "random" is "1".
    //  "length"   -> Length of the spotlight beam.
    //  "width"    -> Width of the spotlight beam. Max 102.3.
    //  "hdr"      -> Multiplier for sprite color by when running in HDR mode. Value is divided by 10, e.g: "20" becomes "2.0".
    //  "halo"     -> Enable halo glow. "0" = OFF, "1" = ON. Note: Depending on the color it may look too bright.

    "l4d_random_beam_item"
    {
        
    "default"
        
    {
            
    "enable"        "1"
            "random"        "1"
            "color"         "255 255 255"
            "length"        "70"
            "width"         "5"
            "hdr"           "20"
            "halo"          "0"
        
    }

        
    "classnames"
        
    {
            
    // Primary Weapons - Slot 1
            // Tier 1
            // SMGs
            
    "weapon_smg"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    "weapon_smg_silenced"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    "weapon_smg_mp5"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    // Shotguns
            
    "weapon_pumpshotgun"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    "weapon_shotgun_chrome"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }

            
    // Tier 2
            // Rifles
            
    "weapon_rifle"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    "weapon_rifle_desert"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    "weapon_rifle_ak47"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    "weapon_rifle_sg552"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    // Shotguns
            
    "weapon_autoshotgun"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    "weapon_shotgun_spas"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    // Snipers
            
    "weapon_hunting_rifle"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    "weapon_sniper_military"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    "weapon_sniper_scout"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    "weapon_sniper_awp"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    // Tier 3
            
    "weapon_rifle_m60"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    "weapon_grenade_launcher"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }

            
    // Secondary Weapons - Slot 2
            // Pistols
            
    "weapon_pistol"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }
            
    "weapon_pistol_magnum"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 255"
            
    }

            
    // Throwables - Slot 3
            
    "weapon_molotov"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 100 0"
            
    }
            
    "weapon_pipe_bomb"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 100 0"
            
    }
            
    "weapon_vomitjar"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 100 0"
            
    }

            
    // Upgrade Packs - Slot 4
            
    "weapon_upgradepack_explosive"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "0 255 0"
            
    }
            
    "weapon_upgradepack_incendiary"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "0 255 0"
            
    }

            
    // Health Items - Slot 4
            
    "weapon_first_aid_kit"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "0 255 0"
            
    }
            
    "weapon_defibrillator"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "0 255 0"
            
    }

            
    // Health Items - Slot 5
            
    "weapon_pain_pills"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "0 255 0"
            
    }
            
    "weapon_adrenaline"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "0 255 0"
            
    }

            
    // Carryables
            
    "weapon_gnome"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "weapon_cola_bottles"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "weapon_gascan"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "weapon_propanetank"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "weapon_oxygentank"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "weapon_fireworkcrate"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }

            
    // Upgrades
            
    "upgrade_laser_sight"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "0 255 255"
            
    }
            
    "upgrade_ammo_incendiary"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "0 255 255"
            
    }
            
    "upgrade_ammo_explosive"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "0 255 255"
            
    }

            
    // Others
            
    "weapon_ammo"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 255 255"
            
    }
            
    "survivor_death_model"
            
    {
                
    "enable"        "0"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "prop_health_cabinet"
            
    {
                
    "enable"        "0"
                "random"        "1"
                "color"         "0 255 0"
            
    }
            
    "prop_fuel_barrel"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "prop_car_alarm"
            
    {
                
    "enable"        "0"
                "random"        "1"
                "color"         "255 255 255"
            
    }
            
    "prop_physics"
            
    {
                
    "enable"        "0"
                "random"        "1"
                "color"         "255 255 255"
            
    }

            
    // Miniguns
            
    "prop_minigun"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 255 255"
            
    }
            
    "prop_mounted_machine_gun"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 255 255"
            
    }
            
    "prop_minigun_l4d1"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 255 255"
            
    }

            
    // Melees - Slot 2
            
    "weapon_chainsaw"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "weapon_melee"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
        }

        
    "melees"
        
    {
            
    "fireaxe"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "frying_pan"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "machete"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "baseball_bat"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "crowbar"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "cricket_bat"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "tonfa"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "katana"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "electric_guitar"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "knife"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "golfclub"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "pitchfork"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "shovel"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
            
    "riotshield"
            
    {
                
    "enable"        "1"
                "random"        "1"
                "color"         "255 0 0"
            
    }
        }

    Admin Commands
    • sm_beaminfo => Outputs to the chat the beam info about the entity at your crosshair. (z flag required)
    • sm_beamreload => Reload the beam configs. (z flag required)
    • sm_beamremove => Remove plugin beam from entity at crosshair. (z flag required)
    • sm_beamremoveall => Remove all beams created by the plugin. (z flag required)
    • sm_beamadd => Add a beam (with default config) to entity at crosshair. (z flag required)
    • sm_print_cvars_l4d_random_beam_item => Print the plugin related cvars and their respective values to the console. (z flag required)

    Change Log

    Spoiler


    Notes
    • This plugin creates an extra beam_spotlight entity for each item enabled in the config.
    • The halo config (when enabled) may look too bright sometimes, because of this is disabled by default.
    • This plugin was made focusing mainly on weapons so the beam may not follow another type of entities. (for performance reasons was not implemented)
    • There isn't an option to make the glow team-based (and I won't support it, only works with cl_fullupdate command while changing team).
    • The color brightness algorithm maybe need a better calculation. It is used to minimize the number of entities with a weak color that you almost can't see.

    To Do
    • Add beam limit.

    Thank you!

    Recommended Plugins
    Related Plugins

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

    Installation
    • Put the "l4d_random_beam_item.cfg" file in your "\addons\sourcemod\data\" folder.
    • Put the "l4d_random_beam_item.smx" file (click Get Plugin) in your "\addons\sourcemod\plugins\" folder.
    Attached Files
    File Type: cfg l4d_random_beam_item.cfg (10.9 KB, 349 views)
    File Type: sp Get Plugin or Get Source (l4d_random_beam_item.sp - 85 views - 46.9 KB)
    __________________

    Last edited by Marttt; 12-02-2023 at 11:33.
    Marttt is offline
    HarryPotter
    Veteran Member
    Join Date: Sep 2017
    Location: Taiwan, Asia
    Old 08-29-2021 , 17:16   Re: [L4D1 & L4D2] Random Beam Item [v1.0.0 | 28-August-2021]
    Reply With Quote #2

    Maybe put a warning, this plugin could spawn many entities if there are too many items on the map
    Be careful to use or server gets a "ED_Alloc: no free edicts" crash.

    Anyway, masterpiece work, Marttt
    __________________
    HarryPotter is offline
    KRUTIK
    Senior Member
    Join Date: Feb 2019
    Location: Мос
    Old 09-02-2021 , 03:58   Re: [L4D1 & L4D2] Random Beam Item [v1.0.0 | 29-August-2021]
    Reply With Quote #3

    Super, thanks for the plugin.
    KRUTIK is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 09-23-2021 , 01:11   Re: [L4D1 & L4D2] Random Beam Item [v1.0.1 | 12-September-2021]
    Reply With Quote #4

    Looks brilliant!

    Do you think there is easy way to blacklist Gun's Cabinet by Silvers?
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Location: Brazil
    Old 09-23-2021 , 09:36   Re: [L4D1 & L4D2] Random Beam Item [v1.0.1 | 12-September-2021]
    Reply With Quote #5

    Thanks,

    I checked the "Gun's Cabinet" plugin and there isn't much info stored in the spawned weapons that I could use to blacklist them.
    I would have to ask Silvers to add some kind of hammerid or targetname to the weapons so I could filter.

    But I did a test and didn't notice any issues in using it together with this plugin.
    In the latest release I disabled the halo parameter as default since it brights a lot depending on the color and the map.

    What aspect you (or your players) dislike using both together?
    __________________

    Last edited by Marttt; 09-23-2021 at 09:38.
    Marttt is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 09-23-2021 , 10:56   Re: [L4D1 & L4D2] Random Beam Item [v1.0.1 | 12-September-2021]
    Reply With Quote #6

    Thanks.

    No conflicts.
    I think it is useless to highlight weapons within Cabinet. Also, visually it looks not that perfect.
    Better to exclude to decrease server loading since it's usually too many entities located there.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    Striker black
    Member
    Join Date: Apr 2013
    Old 09-27-2021 , 18:41   Re: [L4D1 & L4D2] Random Beam Item [v1.0.1 | 12-September-2021]
    Reply With Quote #7

    This plugin does not give any errors and works wonderfully on my server, execelente plugin.
    __________________
    --------------------------------------
    Striker black is offline
    Hawkins
    Senior Member
    Join Date: Jul 2021
    Old 03-03-2022 , 14:08   Re: [L4D1 & L4D2] Random Beam Item [v1.0.2 | 04-October-2021]
    Reply With Quote #8

    Feature request: Cvar to limit amount of beams allowed to spawn.
    And a Cvar to remove beams, starting from the first, if max. number of beams is exceeded.

    Last edited by Hawkins; 03-03-2022 at 14:14.
    Hawkins is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Location: Brazil
    Old 03-03-2022 , 22:09   Re: [L4D1 & L4D2] Random Beam Item [v1.0.2 | 04-October-2021]
    Reply With Quote #9

    I don't think that request would work as you might think.
    Probably will need a timer running every X sec, using the survivors' position to order by the nearest entities to apply the beam.
    Not that simple maybe someday when I have more time. (added to "To Do" list)
    __________________

    Last edited by Marttt; 03-03-2022 at 22:11.
    Marttt is offline
    ItsJustMeh
    Junior Member
    Join Date: Feb 2022
    Old 03-15-2022 , 09:17   Re: [L4D1 & L4D2] Random Beam Item [v1.0.2 | 04-October-2021]
    Reply With Quote #10

    After picking up items the beams sometimes won't dissappear.

    Edit: I restarted the round and then it started working normally.

    Last edited by ItsJustMeh; 03-15-2022 at 09:39. Reason: updated report
    ItsJustMeh 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 06:03.


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