GMod Custom ammo types.

First thing’s is first, don’t refer me to this:

Because I already know about it. My question is, is there a possibly way to recode some stuff to add new ammo types other than the ones listed there. I know it has to be valid Source/gmod ammo type, (E.g. CombineCannon, StriderMinigun, etc.) but is there a way to create your own? Or possibly use a mod to manipulate or get around this?

Thanks!


		// Give the collecting player some free health
		activator:GiveAmmo(20, "combinecannon")
	end
end

This was used to differ .50AE, from the .50BMG, now I am doing 12g, 16g, and 20g shells. But I have run out of ammo types I think.

I haven’t done a complete end-to-end solution for this, so I’m not sure whether simply recoding the ammo functions in the player object would solve this.

You’ll probably need to set up networked vars of some sort on your player objects and then implement http://wiki.garrysmod.com/?title=SWEP.CustomAmmoDisplay in your weapon code.

Someone tried this, but it got pretty extensive. It was prone to a ton of Lua problems from what I heard.

Thanks a lot though, I’ll see what I can do with this.

I don’t see how…

Store your ammo values, then update the HUD.

If you’re just doing a one-off or something, it’s not that bad, but if you’re trying to make an ammo system that also plays nice with existing code, it’s a little more complicated.

For example, functions like SWEP:GetPrimaryAmmoType() won’t work properly, so you’d need to replace those as well, and as a result, any functions (like SWEP:Ammo1() or SWEP:TakePrimaryAmmo()) that use these won’t work properly with the new ammo types either, and the default HUD won’t work, so you have to redo that also.

It’s not difficult per se, but a drop-in solution isn’t necessarily trivial either.

Does anyone have an existing script I could use? I don’t particularly want to try this as it might screw up. If there is none, I’ll do it myself probably. But an existing script/mod would be nice.

Just a script to be able to make new ammo types.