Raised This Month: $51 Target: $400
 12% 

[L4D] Varying Ammunition Reserves


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Luke Penny
Senior Member
Join Date: Jan 2010
Location: Canada
Plugin ID:
1437
Plugin Version:
1.1.0
Plugin Category:
General Purpose
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Randomizes the amount of ammunition stored in guns picked up in the map
    Old 01-30-2010 , 00:58   [L4D] Varying Ammunition Reserves
    Reply With Quote #1

    This plugin will help add some realism and variety to Left 4 Dead, by randomizing the amount of ammunition in the guns around the map, as well as right away when you start in the saferoom.

    The default minimum and maximum amount of ammunition the guns can have them are:

    Shotguns (Both pump and auto) = 64 min, 158 max
    Assault Rifle = 180 min, 450 max
    Uzi = 240 min, 680 max
    Huntingrifle = 90 min, 230 max

    The plugin changes the ammunition stores of all guns on the map every 120 seconds. These are guns that are placed by the director or statically in the map, and the amount of ammo the survivors have in their gun is not changed every 120 seconds, only if they pick up a new gun, it will have the different ammo reserve. This does not change how much ammo you have per clip, just how much ammo is in the gun. This can make games more interesting, as sometimes you may have lots of ammo, and other times you may have to start using nothing but pistols.


    Please give feedback and suggestions!

    Cvars:

    l4d_smgammo_min
    l4d_smgammo_max
    l4d_rifleammo_max
    l4d_rifleammo_min
    l4d_huntingrifleammo_min
    l4d_huntingrifleammo_max
    l4d_shotgunammo_min
    l4d_shotgunammo_max

    They should be pretty self explanitory, the minimum and maximum amount of ammo that the guns can have.

    ChangeLog

    1.0 - Initial Release
    1.1 - Added cvars (thanks to M249-M4A1)
    Attached Files
    File Type: sp Get Plugin or Get Source (VaryingAmmo.sp - 2776 views - 3.6 KB)

    Last edited by Luke Penny; 01-30-2010 at 20:38.
    Luke Penny is offline
    M249-M4A1
    I <3 Mac
    Join Date: May 2005
    Location: Not interested
    Old 01-30-2010 , 12:34   Re: [L4D] Varying Ammunition Reserves
    Reply With Quote #2

    What exactly do you mean by "use cvars for the min and max values of GetRandomInt"?

    Do you mean create a convar with the min and max defined? (see API)

    or did you mean use GetConvarInt for the GetRandomInt function (have a min and max convar for each weapon cat.)
    __________________
    M249-M4A1 is offline
    Luke Penny
    Senior Member
    Join Date: Jan 2010
    Location: Canada
    Old 01-30-2010 , 17:35   Re: [L4D] Varying Ammunition Reserves
    Reply With Quote #3

    To use a GetConvarInt for the GetRandomInt function. I tried a couple tests but could not get that to work.
    Luke Penny is offline
    M249-M4A1
    I <3 Mac
    Join Date: May 2005
    Location: Not interested
    Old 01-30-2010 , 17:43   Re: [L4D] Varying Ammunition Reserves
    Reply With Quote #4

    Thats's because you have variables like Shotgun defined as floats, when GetRandomInt and GetConvarInt return integers (notice all the tag mismatch errors when compiling)

    i uploaded a version of what i think u were trying to get at. i created a min and max convar (named it differently to avoid conflicts) and removed tag mismatch errors from your original post. i havent tested this, but it should work and do what u were trying to do
    Attached Files
    File Type: sp Get Plugin or Get Source (VaryingAmmo.sp - 1453 views - 3.6 KB)
    __________________

    Last edited by M249-M4A1; 01-30-2010 at 18:01.
    M249-M4A1 is offline
    Luke Penny
    Senior Member
    Join Date: Jan 2010
    Location: Canada
    Old 01-30-2010 , 20:34   Re: [L4D] Varying Ammunition Reserves
    Reply With Quote #5

    The version you posted there had some issues, you got some of your min and max's messed up, hah. Fixed, corrected, and tested, uploaded new version.
    Luke Penny is offline
    M249-M4A1
    I <3 Mac
    Join Date: May 2005
    Location: Not interested
    Old 01-31-2010 , 08:08   Re: [L4D] Varying Ammunition Reserves
    Reply With Quote #6

    Yeah I hadn't had the time to test it because there were so many convars confusing me haha, glad it helped
    __________________
    M249-M4A1 is offline
    triggerman
    Senior Member
    Join Date: Jun 2009
    Old 01-31-2010 , 13:50   Re: [L4D] Varying Ammunition Reserves
    Reply With Quote #7

    is the maximum amount of ammo i can get from an ammo pile changed?
    __________________
    triggerman is offline
    Luke Penny
    Senior Member
    Join Date: Jan 2010
    Location: Canada
    Old 01-31-2010 , 17:20   Re: [L4D] Varying Ammunition Reserves
    Reply With Quote #8

    I do believe so, the plugin changes the maximum amount of ammo a gun can carry periodically, so the maximum ammo you can get from an ammo pile is also changed. I may add something so that ammo piles always fill weapons up to a certain level.
    Luke Penny is offline
    birno
    Senior Member
    Join Date: Mar 2010
    Old 04-28-2010 , 13:42   Re: [L4D] Varying Ammunition Reserves
    Reply With Quote #9

    Hi,

    I want to use this plugin in L4D2, but gives me an error message:
    Code:
    L 04/28/2010 - 18:54:18: [SM] Native "SetConVarInt" reported: Invalid convar handle 0 (error 4)
    L 04/28/2010 - 18:54:18: [SM] Displaying call stack trace for plugin "VaryingAmmo.smx":
    L 04/28/2010 - 18:54:18: [SM]   [0]  Line 95, /home/groups/sourcemod/upload_tmp/phpN8WyKg.sp::GunTimer()
    Maybe you can do compatible with that game?

    Last edited by birno; 04-28-2010 at 14:04.
    birno is offline
    birno
    Senior Member
    Join Date: Mar 2010
    Old 04-29-2010 , 16:34   Re: [L4D] Varying Ammunition Reserves
    Reply With Quote #10

    Please somebody fix this.
    As I see the code I really don't understand why doesn't work.
    birno is offline
    Reply



    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 11:55.


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