AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D2] Weapons Skins RNG [v1.1.1 | 05-February-2024] (https://forums.alliedmods.net/showthread.php?t=327609)

Marttt 09-29-2020 11:10

[L4D2] Weapons Skins RNG [v1.1.1 | 05-February-2024]
 
28 Attachment(s)
L4D2 ONLY

Description

With the L4D2 Last Stand update, some of the new things brought are new skins for weapons (e.g.: golden crowbar).

This plugin applies random skins to spawned weapons.

Features
  • Applies a random skin to weapon entities on spawn.
  • Allows equipping weapons with the same skin from the spawner entities. (e.g.: weapon_rifle_spawn)
  • Allows configuring which weapons should have RNG skin.
  • Ignore weapons that already have a skin different than default.

Preview

https://i.imgur.com/88GLqHq.jpg

Note: This video is not mine. (Credits: Lucarbuncle)



Cvars

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

PHP Code:

// Weapon skin RNG for Auto Shotgun.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_auto_shotgun "1"

// Weapon skin RNG for Cricket Bat melee.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_cricket_bat "1"

// Weapon skin RNG for Crowbar melee.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_crowbar "1"

// Enable/Disable the plugin.
// Note: Enabling this may glitch some plugins that checks the gascan skin to detect if is a scavenge one.
// 0 = Disable, 1 = Enable.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_enable "1"

// Weapon skin RNG for Gascan.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_gascan "1"

// Weapon skin RNG for Hunting Rifle.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_hunting_rifle "1"

// Ignore weapons that already have a skin different than default.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_ignore_skin "1"

// Weapon skin RNG for Pistol Magnum.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_pistol_magnum "1"

// Weapon skin RNG for Pump Shotgun.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_pump_shotgun "1"

// Weapon skin RNG for AK47 Rifle.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_rifle_ak47 "1"

// Weapon skin RNG for M16 Rifle.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_rifle_m16 "1"

// Weapon skin RNG for Chrome Shotgun.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_shotgun_chrome "1"

// Weapon skin RNG for SMG Uzi.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_smg_uzi "1"

// Weapon skin RNG for Silenced SMG.
// 0 = OFF, 1 = ON.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_wskin_rng_smg_silenced "1" 

Admin Commands
  • sm_wskin_rng => Scramble the weapon skins randomly in real time. (z flag required)
  • sm_print_cvars_l4d2_wskin_rng => Print the plugin related cvars and their respective values to the console. (z flag required)

Change Log

Spoiler


Notes
  • The skin change was achieved by changing the weapon "m_nSkin" netprop value.
  • For spawner entities the "m_nWeaponSkin" is also changed to the same value.
  • If the map, by default, changes the skin of a weapon, this plugin won't prevent it.
  • When the weapon is already equipped (active) I had to apply the skin also to the "m_hViewModel" netprop, otherwise there is some delay on skins changes.
  • Not all weapons have new skins and some aren't so different from the original one.
  • The currently supported weapons are:
    Melees: Crowbar, Cricket Bat
    Pistols: Magnum
    SMGs: Uzi; Silenced
    Shotguns: Pump; Chrome; Auto
    Rifles: M16; AK47
    Sniper: Hunting Rifle
    Gascan
  • These weapons have 2 new skins: Magnum; M16; AK47, the others just 1.
  • Total of 14 new skins from 11 weapons.
  • The gas can skin isn't affected by this plugin.
  • By now, 29-September-2020, there are no more skins available.
  • The plugin may not work properly for clients that use addons to change the weapon appearance.
  • Enabling gascan RNG skin may glitch some plugins that check the skin to detect if is a scavenge one.
  • I don't know if it conflicts with the "Golden Crowbar" achievement.

To Do
  • Create a config to select the % chance to apply a different skin.

Thank you!
  • Alex Alcalá - for testing in his server and reporting some bugs.
  • Tonblader - for testing in his server and reporting some bugs.
  • larrybrains - for requesting a cvar to control which weapons should RNG.
  • Krufftys Killers - for reporting an issue.
  • TrevorSoldier - for requesting the gascan skin.
  • Toranks - for reporting gascan skin not working on pickup.
  • ryzewash - for reporting skins not working on prop_physics gascans and for the snippet code to fix gascan skin on pickup.
  • HarryPotter - for reporting errors and requesting a cvar to ignore weapons with skin.

Related Plugins

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

Installation
  • Put the "l4d2_wskin_rng.smx" file (click Get Plugin) in your "\addons\sourcemod\plugins\" folder.

AlexAlcala 09-29-2020 11:13

Re: [L4D2] Weapons Skins RNG
 
Marttt <3 good plugin :D

Mi.Cura 09-29-2020 17:25

Re: [L4D2] Weapons Skins RNG [v1.0.0 | 29-September-2020]
 
Great job my friend..

Sev 09-29-2020 17:29

Re: [L4D2] Weapons Skins RNG [v1.0.0 | 29-September-2020]
 
One way this could be improved even further, either with this plugin or the menu plugin (probably makes more sense for the menu plugin) is adding a cookie similar to what's seen with survivor chat select for the characters. Only here, the server would remember what skin you chose for the weapons you decided to choose them for.

AK978 09-29-2020 18:58

Re: [L4D2] Weapons Skins RNG [v1.0.0 | 29-September-2020]
 
L 09/30/2020 - 06:45:43: [SM] Blaming: l4d_wskin_rng.smx
L 09/30/2020 - 06:45:43: [SM] Call stack trace:
L 09/30/2020 - 06:45:43: [SM] [0] GetEventInt
L 09/30/2020 - 06:45:43: [SM] [1] Line 345, l4d_wskin_rng.sp::Event_SpawnerGiveItem
L 09/30/2020 - 06:45:44: [SM] Exception reported: Invalid game event handle 0 (error 4)

HarryPotter 09-30-2020 09:30

Re: [L4D2] Weapons Skins RNG [v1.0.0 | 29-September-2020]
 
error.log
Quote:

L 09/30/2020 - 21:07:19: [SM] Exception reported: Invalid game event handle 0 (error 4)
L 09/30/2020 - 21:07:19: [SM] Blaming: l4d_wskin_rng.smx
L 09/30/2020 - 21:07:19: [SM] Call stack trace:
L 09/30/2020 - 21:07:19: [SM] [0] GetEventInt
L 09/30/2020 - 21:07:19: [SM] [1] Line 355, l4d_wskin_rng.sp::Event_SpawnerGiveItem
L 09/30/2020 - 21:07:19: [SM] Exception reported: Invalid game event handle 0 (error 4)
L 09/30/2020 - 21:07:19: [SM] Blaming: l4d_wskin_rng.smx
L 09/30/2020 - 21:07:19: [SM] Call stack trace:
L 09/30/2020 - 21:07:19: [SM] [0] GetEventInt
L 09/30/2020 - 21:07:19: [SM] [1] Line 355, l4d_wskin_rng.sp::Event_SpawnerGiveItem
Perhaps don't use EventHookMode_PostNoCopy?
PHP Code:

HookEvent("spawner_give_item"Event_SpawnerGiveItemEventHookMode_PostNoCopy); 


Psyk0tik 09-30-2020 09:59

Re: [L4D2] Weapons Skins RNG [v1.0.0 | 29-September-2020]
 
This is awesome, Marttt! I was waiting for someone to make a plugin like this. Great job! :D

foxhound27 09-30-2020 15:41

Re: [L4D2] Weapons Skins RNG [v1.0.0 | 29-September-2020]
 
great job Mart ♥

Mr. Man 10-01-2020 12:28

Re: [L4D2] Weapons Skins RNG [v1.0.2 | 30-September-2020]
 
FYI the .cfg file has a text error: should be 0 for disabled and 1 for enabled. You have the same small problem in the Weapon Skin Menu thread.

Smoak 10-20-2020 23:00

Re: [L4D2] Weapons Skins RNG [v1.0.2 | 30-September-2020]
 
It's not really working for me, like, it never chooses any skins for the tier 1 guns and the tier 2 guns rarely get their skins in either. Is there a way to like, configure the likeliness that one skin appears compared to the other??


All times are GMT -4. The time now is 22:42.

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