Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSS[L4D2] Weapon Skin Manager (v1.0)


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Wow... It's been, what, almost two and a half years since I was here last? Time flies, I guess. At any rate, I'm here to present (and god I hope I'm doing this right):

Left 4 Dead 2 - Weapon Skin Manager

What does this plugin do?

As of The Last Stand Update, a handful of L4D2's weapons have alternate skins. The L4D1 weapons (minus the pump shotgun) look more worn, the pump and chrome shotguns swap furniture with each other, the magnum gets a blued steel finish with a wood grip, things like that. However, this system is pretty static, by default - weapon skins aren't randomized at runtime, they have to be set by the mapper in Hammer itself. That's where this plugin comes in.
The two most basic features provided by this plugin are simple: if enabled, it will randomize the skins of all valid weapon spawns on the map at the start of the round, and provide clients with a menu with which to select their weapon skins.
While I was working on this plugin, Marttt released plugins of his own that fulfill the same purposes, and in most cases, there's probably not much meaningful difference between his plugins and my own here. However, I've built mine with the intention of being easily extensible - Weapon Skin Manager pulls its skin info from files in the /sourcemod/configs/ folder, meaning that server hosts can easily add or remove weapons from the list without having to recompile the plugin. If, say, you want to remove the golden crowbar skin from the menu and prevent the plugin from randomizing crowbar spawns - all you have to do is open the l4d2_wsm_meleelist.txt file, delete the line for the crowbar, and rebuild the skin list in-game. Simple as that! Clients won't see the crowbar skins in the menu, and on the next map, crowbar spawns won't have their skins randomized.

However, that's not all this plugin does. It also fixes bugs where grenade launcher and M60 spawns don't properly skin the weapon that they give to the player, and where thrown grenades reset to the default model skin. It's also capable of managing pistol skins, so that the dual pistols a client is holding match the pistols they picked up in the world, when provided with an appropriate skin mod. Note that this doesn't refer to "RNG mods," wherein the pistol skins are randomized when the map loads - those technically don't even use alternate skins; they either select from a list of textures (it might sound pedantic, but there's a difference) or toggle transparency based on RNG. Pistol skins do have to be set up to work with this plugin, but they shouldn't be too complex.

How it works, basically, is by taking the number of skins a single pistol has, squaring it, and using the indices of the pistol the player already has equipped and the one they've picked up to calculate which dual pistol skin should be shown. This might be easier to understand when shown in action, so here's a link to a modified version of the pistols from Lt. Rocky's Overhauling the Originals mod (provided with permission), configured to work with this plugin on its default settings. Simply set l4d2_wsm_pistols to 1 in the config file (/cfg/sourcemod/l4d2_weaponskinmanager.cfg) to see it in action. Like the rest of this plugin, it's programmed to be extensible - you can set the number of pistol skins to cycle through with a cvar, as well as toggle which pistol cycles first when two are equipped.

Last but not least, the melee skin selection menu is compatible with the General Improvements mod from the Steam Workshop, or any other mods that move melee weapons into slot 7. I have no idea how widely used some of these features are going to be, but I wanted to make this plugin as flexible as I could.

Having said all this, it's probably worth stating up-front: I'm not a programmer. I understand (at least some of) the principles, but I'm far from trained in the field. I'm sure my code could be much better, and that there are better ways to do some of the things I've done with this. I'm more than open to suggestions on how to improve the code, and I'll do my best to implement them.

Features
  • Randomizes weapon spawn skins according to a list built from external text files. Supports firearms, melee weapons, and item spawns.
  • Gives clients a menu through which to set their weapons' skins. Options will only appear for weapons that have valid entries in the skin list, and if the player doesn't have any weapons with alternate skins, they'll receive a message informing them of such.
  • Fixes M60 and grenade launcher spawns not keeping their skins when picked up by a player.
  • Fixes grenades (pipe bombs, molotovs, bile jars) not keeping their skins when thrown.
  • Shows a message when the player joins a server, explaining the menu functionality to them.
  • Manages pistol skins, so that (when configured correctly) players will be able to see the pistols they've actually grabbed, instead of just seeing the skin they already had equipped.
  • Randomizes each survivor's pistol on the first map of a campaign.

CVARS/Admin Commands

CVARS:
PHP Code:

// Enable plugin functionality. Default: 1
l4d2_wsm_enabled

// Enable weapon spawn skin randomization. Default: 1
l4d2_wsm_rngskins

// Enable randomized firearm skins. Only works if l4d2_wsm_rngskins is set to 1, and requires the skin list to be reloaded if changed in-game (l4d2_wsm_reloadskins). Default: 1
l4d2_wsm_gunskins

// Enable randomized melee weapon skins. Only works if l4d2_wsm_rngskins is set to 1, and requires the skin list to be reloaded if changed in-game (l4d2_wsm_reloadskins). Default: 1
l4d2_wsm_meleeskins

// Enable randomized item skins. Only works if l4d2_wsm_rngskins is set to 1, and requires the skin list to be reloaded if changed in-game (l4d2_wsm_reloadskins). Default: 0
l4d2_wsm_itemskins

// Enable pistol/dual pistol skin management. Anything relating to non-magnum pistols is disabled unless this is set to 1. Default: 0
l4d2_wsm_pistols

// Enable grenade (molotov, pipe bomb, bile jar) skin management. Thrown grenades will always show the default skin if this is disabled. Default: 1
l4d2_wsm_grenades

// Enable weapon skin selection menus. Default: 1
l4d2_wsm_skinmenu

// Display a chat message explaining the plugin to clients after they join the game. Default: 1
l4d2_wsm_spawnmsg

// The mode to use for melee weapon skin handling. 0 = Secondary slot (default), 1 = Slot 7 (modded). Default: 0
l4d2_wsm_meleemode

// Enable randomized pistol skins per survivor at the beginning of a new campaign. Default: 0
l4d2_wsm_startpistols

// The number of skins each pistol has. This is NOT a 0-based index! Default: 4
l4d2_wsm_pistolskincount

// Which dual pistol skin calculation method to use. This should be set based on how the server's pistol skin addon is set up. If 1, the left-hand pistol cycles first, e.g.: (L1, R1), (L2, R1), (L1, R2), etc. Default: 0
l4d2_wsm_pistolskinmode

// How much detailed information to print to the server console. 0 = off, 1 = basic, 2 = detailed. Mainly for debugging purposes. Default: 1
l4d2_wsm_printtoconsole 

Admin Commands:
PHP Code:

// Reload the weapon/item skin list.
sm_wsm_reloadskins

// Reload the starting map list.
sm_wsm_reloadmaps

// Randomize weapon spawn skins without reloading the map.
sm_wsm_randomize

// Re-run code that normally only runs when a player first spawns into the game. Mainly for debugging purposes.
sm_wsm_rehook 

Client Commands

PHP Code:

// Manually select a skin for a slot's weapon. Does not work on pistols. Format: !wskin/!wsm_skin [slot] [skin]
sm_wsm_skinsm_wskin

// Manually select a skin for your right-hand pistol. Only works if you have a pistol (dual or singular) equipped. Format: !pistol_r/!wsm_pistol_r [skin ID]
sm_wsm_pistol_rsm_pistol_r

// Manually select a skin for your left-hand pistol. Only works if you have two pistols equipped. Format: !pistol_l/!wsm_pistol_l [skin ID]
sm_wsm_pistol_lsm_pistol_l

// Open the main skin selection menu.
sm_wsm_menusm_skins

// Open the pistol skin selection menu.
sm_wsm_pistolssm_pistols 

Installation
  1. Download the plugin and place it in your sourcemod/plugins folder.
  2. Download l4d2_wsm_translations.txt and place it in your sourcemod/translations folder.
  3. The plugin will automatically generate default lists for item/weapon skins and campaign start maps, as well as a configuration file (cfg/sourcemod/l4d2_weaponskinmanager.cfg).

Customization

To add a new firearm/item to the list:
  1. Open the relevant text file. All list files can be found in sourcemod/configs, beginning with l4d2_wsm.
  2. Add a new line to the text file. What you'll want to enter is the weapon/item's internal name, minus the weapon_ prefix (e.g. "rifle" for the M16, "rifle_desert" for the SCAR), followed by a semicolon, and then the total number of skins the weapon has MINUS ONE. If a weapon has three skins total - the default and two alternatives - you'll want to put 2, in other words.
  3. Save the file, and run the sm_wsm_reloadskins command from the server console or from in-game. The weapon should now be added to the skin list.

To add a melee weapon to the list:
  1. Open the relevant text file (l4d2_wsm_meleelist.txt).
  2. Add a new line to the text file. What you'll want to enter is the melee weapon's script name (e.g. "crowbar", "baseball_bat", etc.), followed by a semicolon and the total number of skins the weapon has minus one.
  3. Save the file, and run the sm_wsm_reloadskins command.

Note: This plugin has not been tested with custom melee weapons, but provided they meet these criteria, they should work fine:
  • The weapon model is located in the standard models/weapons/melee directory
  • The weapon model starts with the standard v_/w_ prefix
  • The weapon model shares its name with the weapon script
So, for instance, if you have an ice axe as a melee weapon, with the script named iceaxe.txt, the model should be located at models/weapons/melee/w_iceaxe.mdl. If the model name does not match, then you should still be able to select skins from the menu, but spawns in the world won't have their skins randomized.

To add a new starting map to the list:
  • Simply add a new line to l4d2_wsm_maplist containing the map's filename, and run the sm_wsm_reloadmaps command in-game.

Known Bugs
  • Defibrillators don't keep their skin all the time. The paddle-less version of the model on a survivor's back always resets to the default skin when equipped. I might be able to fix this, but I dunno if my approach is going to be a particularly good one, so I've held off for now. Looking into it.

Screenshots

68747470733a2f2f692e696d6775722e636f6d2f 68747470733a2f2f692e696d6775722e636f6d2f
68747470733a2f2f692e696d6775722e636f6d2f 68747470733a2f2f692e696d6775722e636f6d2f

Attached Files
File Type: sp Get Plugin or Get Source (l4d2_weaponskinmanager.sp - 55.1 KB)
File Type: txt l4d2_wsm_translations.txt (6.6 KB)

Wyświetl pełny artykuł

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...