Monthly Target: $400 Donations: $147
 36% 

[L4D & L4D2] Single Gun Spawns


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Dont Fear The Reaper
Member
Join Date: Nov 2011
Plugin ID:
2689
Plugin Version:
0.2
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    1 
    Plugin Description:
    Replaces all gun spawns with single guns
    Old 11-27-2011 , 14:25   [L4D & L4D2] Single Gun Spawns
    Reply With Quote #1

    This is a plugin i made for our servers to have single instances of every gun that spawns in versus instead of infinite. The reason i made it is that i didn't find anything that did what i wanted, so please let me know if there is something like that already.
    I'm posting it here in case someone else has a use for it too, but also (since i'm new to this) to get some feedback from more experienced people about how to improve this plugin in any aspect and if there are possible conflicts with other plugins or the game mechanic itself, every constructive suggestion is welcome.

    Besides many others, credits to this thread especially:
    http://forums.alliedmods.net/showthread.php?t=142963

    The difference to already existing plugins (i found) for the same purpose is that those either remove the weapon spawn after it has been used or they set the "count" keyvalue of the weapon spawn to "1". The problem with the "count" keyvalue is that the ai director of l4d2 ignores it in competitive game modes and makes the weapon spawn an infinite supply regardless of the "count". To remove the weapon spawn after it has been used works in competitve game modes of course, but the problem with that approach is the behaviour of weapon spawns basically preventing you to drop your old weapon if it's the same as the one you pick up and some weapon spawns are even set to prevent every old gun to be dropped (like in the gun shop on map 2 of dead center).


    Details

    On every round start after a certain delay (10 seconds at the moment due to compatibility with other plugins that modify weapon spawns) it will replace all found gun spawns with single instances of guns. During that delay the survivor bots will be set inactive and the use button will be blocked to prevent early pickup. The survivor bots will be set inactive until only one person is still in the loading process (like after a map change), but for a maximum of 60 seconds, which is configurable since version 0.2.


    Cvars

    l4d_1gunspawns_version - "Version of the '[L4D & L4D2] Single Guns Spawns' plugin"

    (All other cvars are not included in version 0.1, but with those cvars left to default, version 0.1 basically behaves like version 0.2)

    Code:
    // Amount of guns to replace a weapon spawn with
    // -
    // Default: "1"
    // Minimum: "1.000000"
    // Maximum: "16.000000"
    l4d_1gunspawns_count "1"
    
    // Maximum time (in seconds) the survivor bots will be halted on round start
    // -
    // Default: "60"
    // Minimum: "0.000000"
    // Maximum: "900.000000"
    l4d_1gunspawns_maxbothalt "60"
    
    // Maximum number of loading clients to ignore on bot reactivation
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "32.000000"
    l4d_1gunspawns_maxloading "1"
    
    // Disable/Enable hint message while use is blocked
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_1gunspawns_message "1"
    
    // Sum of gun types to get replaced (1: Tier 2, 2: Tier 1, 4: Magnum, 8: Pistol, 15: All)
    // -
    // Default: "15"
    // Minimum: "0.000000"
    // Maximum: "15.000000"
    l4d_1gunspawns_types "15"
    (automatically written (if not already existing) to ".../cfg/sourcemod/l4d_1gunspawns.cfg")


    Reminder

    This plugin is made for versus, but it works in all game modes at the moment, there's no game mode check yet. It's much easier to achieve what this plugin does in non-competitive game modes in a different way though.

    Since all gun spawns will be single guns, you will usually only have 2 or 3 guns in the saferooms. I solved this by adding extra gun spawns to saferooms with stripper. I can upload my stripper configs aswell if there is a need for them.


    Changelog

    Version 0.1:
    • Initial release
    • Will be kept as a simple solution for default settings
    Version 0.2:
    • Added the possibility to set the gun types that get replaced
    • Added the possibility to set the count of guns replacing a weapon spawn
    • Added configuration options to turn the message while use is blocked off or on and to adjust the behaviour for reactivating the survivor bots
    • Added an auto-created configuration file (".../cfg/sourcemod/l4d_1gunspawns.cfg")
    • Removed checking for L4D2 weapon spawns in L4D1

    I changed the naming of the plugin file and fixed the mentioned minor bug that halting the survivor bots didn't work and also added a version cvar and allowed it to run in L4D1. Besides that, version 0.1 is the same as the previous version.

    For those who use the plugin for L4D1, it would be nice to get some feedback if it's working fine or not because i don't have a server set up to test it.

    I hope i didn't forget to mention anything, just ask if something is not clear enough.

    If you have installed the previous version named "l4d2_single_gun_spawns.smx", please delete it before installing one of the new versions, so they don't interfere.
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d_1gunspawns_0.1.sp - 787 views - 6.5 KB)
    File Type: sp Get Plugin or Get Source (l4d_1gunspawns.sp - 1282 views - 10.9 KB)

    Last edited by Dont Fear The Reaper; 01-28-2012 at 13:12. Reason: new version
    Dont Fear The Reaper is offline
    Elektramode
    Senior Member
    Join Date: Mar 2010
    Old 11-27-2011 , 15:31   Re: [L4D2] Single Gun Spawns
    Reply With Quote #2

    Its great that your learning to code source pawn and simple plugins like these are good starts, but I believe there are 2 other instances of this plugin around... so this is now the 3rd
    Elektramode is offline
    Dont Fear The Reaper
    Member
    Join Date: Nov 2011
    Old 11-27-2011 , 15:40   Re: [L4D2] Single Gun Spawns
    Reply With Quote #3

    Would be nice if you could post the links so i can have a look, i searched quite a bit and didn't find anything that did what i wanted as i said
    Dont Fear The Reaper is offline
    Ulrich
    Member
    Join Date: Mar 2010
    Location: In a box
    Old 11-28-2011 , 00:00   Re: [L4D2] Single Gun Spawns
    Reply With Quote #4

    http://forums.alliedmods.net/showthread.php?p=1254023
    There's one of them, if the ConVar is just set to 0. If I recall correctly, that's the one I use, and it seems to work fairly well.

    https://forums.alliedmods.net/showpo...5&postcount=16
    I don't remember how well this one works, but I think it only applies to tier 2 weapons.

    Hope those help. Good luck with future programs.
    __________________
    Ulrich is offline
    Dont Fear The Reaper
    Member
    Join Date: Nov 2011
    Old 11-28-2011 , 07:27   Re: [L4D2] Single Gun Spawns
    Reply With Quote #5

    Thanks

    The problem with them which i didn't like is that you can "remove" guns if they are the same like the one you are already carrying. The one from the first link only if you shot at least one bullet and with the second one you can even remove them when u got a fully loaded gun.

    This is due to the behaviour of gun spawns usually preventing you to drop your gun if the one you want to pick up is the same. It just refills your ammo and disappears (or with the second one you mentioned you don't even have to shoot a single bullet before, means you have no effect except the gun will disappear which is due to how the plugin itself works). And some gun spawns even prevent you from dropping any gun (of the same slot). For example it's possible for one player to empty the whole gun shop on map 2 of dead center without leaving a single gun behind. That's what i want to prevent with my approach, there will just be a mess afterwards

    Last edited by Dont Fear The Reaper; 11-28-2011 at 11:40. Reason: added a note
    Dont Fear The Reaper is offline
    Jоnny
    Senior Member
    Join Date: Jun 2007
    Old 12-02-2011 , 07:18   Re: [L4D2] Single Gun Spawns
    Reply With Quote #6

    good job!
    Jоnny is offline
    Dont Fear The Reaper
    Member
    Join Date: Nov 2011
    Old 12-04-2011 , 16:41   Re: [L4D2] Single Gun Spawns
    Reply With Quote #7

    Thanks
    Dont Fear The Reaper is offline
    asto
    Member
    Join Date: Aug 2010
    Old 12-12-2011 , 09:34   Re: [L4D2] Single Gun Spawns
    Reply With Quote #8

    Finally! Finally someone has made a workable plugin for this! Fantastic. This works perfectly.

    But why you disabled it for L4D1?

    Ulrich
    I reported bugs in "Weapon Remove" plugin's forum, and the other plugin also has bugs. Only this plugin is workable.
    asto is offline
    Dont Fear The Reaper
    Member
    Join Date: Nov 2011
    Old 12-12-2011 , 11:39   Re: [L4D2] Single Gun Spawns
    Reply With Quote #9

    The main reason i made the plugin L4D2 only is that i didn't test if it works fine for L4D1 too. Besides that it's checking for some weapon entities that don't exist in L4D1 (which isn't much of a problem), it should work though i think.

    If you wanna try it in L4D1, i'll make a version of it with the L4D2 check disabled for you (in case you didn't do it yourself already ). And if you can confirm me that it works without problems for L4D1 too, i'll remove the L4D2 only check.
    Dont Fear The Reaper is offline
    Dont Fear The Reaper
    Member
    Join Date: Nov 2011
    Old 01-22-2012 , 08:42   Re: [L4D & L4D2] Single Gun Spawns
    Reply With Quote #10

    I removed the L4D2 only check, but since i don't have a L4D1 server set up, please let me know if it works fine.

    Besides that, i changed a few things and added some new options for the new version. And what i mentioned earlier about checking for non-existant weapons in L4D1, since version 0.2 it will only check for L4D1 weapons in L4D1.

    Took a bit long though, i know, sorry for that

    Last edited by Dont Fear The Reaper; 01-22-2012 at 08:42.
    Dont Fear The Reaper 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 09:41.


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