Left 4 Dead 2

Left 4 Dead 2

27 ratings
Weapon Pickup Limiter (Script)
   
Award
Favorite
Favorited
Unfavorite
Game Content: Scripts
File Size
Posted
2.402 KB
20 Jan @ 8:08am
1 Change Note ( view )

Subscribe to download
Weapon Pickup Limiter (Script)

In 1 collection by senzawa
Sourcemod ports to VScript
2 items
Description
All weapon spawns (and item spawns since Source jank but they are default 1 so who cares) limits you to 1 weapon per spawn.
This mod is made for people who want more realism or challenge: No more cloning 4 guns out of thin air/getting 4 god-tiers guns out of one spawn!

Heard someone say this was trending on Sourcemod or whatever, also it was an interesting idea so I decided to give a shot.
Whipped it up in 4 hours, most of which was spent browsing forums and wikis for obscure and arcane knowledge of spawnflags.

As usual the settings can be changed by editing the `OneGunVar` in the script:
countCap: upper limit on how many weapons/items you can pick up from a single weapon_spawn, default value is 1

------------

Note that the Weapon Unstay mod does something similar to this.
However, the two mods use different methods: Weapon Unstay kills the weapon spawn when you take a weapon, while this mod changes the entity data to allow only 1 weapon to spawn.
This leads to the following differences in their behavior:
(All "weapons" below refer to weapon AND items since the spawners of those two are grouped together)

Compatibility: (Pro)
With the kill method, it's impossible to change the number of weapons you can take since the spawn will be killed after anyone takes a weapon.
Meanwhile with the entity data method you can change weapon counts on the fly and it would work exactly as you expected (the script only fires once, upon map load)

Accordance with Vanilla: (Pro)
If you take a gun from a spawn then pick up another one near it, with the kill method, the old gun would drop to the ground.
But with the entity data method it would return to its old positions, in accordance with vanilla single-pickup spawns. Which leads into the next difference.

Reserve and Clip Ammo: (decide for yourself)
With the kill method, the old gun drops to the ground, keeping its reserve ammo count and clip ammo count in the process.
While with the entity data method it automatically refills, again, in accordance with vanilla single-pickup spawns.

Optimization: (Con but who cares)
Whe someone picks up a weapon, with the kill method, the weapon spawn is gone and frees up entity slots.
With the entity data method, the spawn is still there and takes up a entity slot. Which also leads into the next difference.

Corner Cases: (Pro)
If someone assigned a script to the spawn (say a melee that, when taken, spawns a horde), the kill method might render the script unable to execute.
While the entity data method would work fine.


-------Credits (sorted alphabetically by full URL)---------
Valve Developer Community for the awesome documentation
AlliedModders[forums.alliedmods.net] for letting me know how to edit Spawn Flags
Rayman1103 for an easy way to get all weapon spawns
devlos for a robust way of handling run-once entity manipulation
4 Comments
时空之轨迹 24 Jun @ 9:53pm 
I don't speak English, so it's machine translation.
[Hard-Mode] Random Ammo Pile Swapper
Replace the ammo pile guns and still get 4 of them.
Kaisy Adradum 9 Jun @ 4:48pm 
i love this mod, u need to make random ammo pile for this
Ain 16 Mar @ 8:30am 
you can make limited ammo pile?
Your_Host Cletus™ 3 Feb @ 9:37pm 
tbh i like this in the sense of realism