Automatic Ammunition Suppliers Set

http://www.garrysmod.org/img/?t=dll&id=3144

Now can resupply theJ89’s Sentry Turrets! - http://forums.facepunchstudios.com/showthread.php?t=257194

[release]This set of SENTs are in addon format. Therefore, extract the contents of the .zip file to SteamApps/…/garrysmod/garrysmod/addons, then restart Garry’s Mod, for these SENTs to appear in the Scripted Entities section of your spawn (“Q”) menu.

The SENTs can be spawned in the spawn menu. They will resupply players with ammunition up to a limit (there are multiple SENTs all with their own ammunition to resupply players with).[/release]

[release]Ammunition Provider Types:

  • In Radius: Resupplies all nearby players slowly
  • On Use: Resupplies players quickly when USE is held on the resupplier

Supported Types of Ammunition:

  • Pistol
  • SMG1
  • AR2
  • Shotgun Buckshot
  • 357
  • RPG
  • Crossbow Bolt[/release]

http://img.garrysmod.org/cache/3/1/4/4/218d8d91a9620cebcc6e3f695433c0dd.jpg

Cool! Works great on making gun shops.

Can you at least make an option to make it be “used?”

Can I AT LEAST!

Well, yes, I can. Updated: The new download link (or the one I’ll put up in 30 seconds after this post) contains two versions of each ammunition supplier; an “In Radius” and an “On Use” version. The original, In Radius versions have faster resupply than they originally did, but the On Use ones resupply much faster (1 clip/half a second for all ammunition types). Also, all of them are now physically simulated - you can kill people with them if you want using the gravgun if that’s your cup of tea.

They are easy to edit: I’ll provide an example on the build of the On Use: SMG.

[lua]ENT.Model = “models/Items/BoxMRounds.mdl” --the model. I found all the models under HL2 items in the spawn menu.
ENT.PhysicsItem = true --whether the item should obey the laws of physics.

ENT.AmmoType = “smg1” --the ammunition type
ENT.Maximum = 225 --the maximum ammunition the supplier allows someone to get
ENT.Delay = 0.5 --the delay between each resupply
ENT.GiveAmount = 45 --how much ammo you get per resupply
ENT.PlaySound = true --whether to play the sound and tell the player “You Got Ammo!”

ENT.NeedsLookingAt = true --whether a player needs to look at it to get ammo
ENT.NeedsUseHeld = true --whether a player needs to hold use (only applies if NeedsLookingAt is true)
ENT.MaximumRange = 70 --the maximum distance away you can be (only applies if NeedsLookingAt is true)

ENT.LastIssue = 0 --never change[/lua]

This is very cool, nice work, I believe this deserves a useful.

Cool! :smiley: Is the open_crate animation possible? :S

finally some ammo to re-equip. Now in gmod10 you can’t click on weapon to get more ammo.

THAT’S FUCKING SWEET!
Thanks alot :smiley:

Awesome, sounds like an ammunition hub from BF2142.

Wow this is just what I’ve been looking for when I do my base wars. =)

Say, could you adapt this to work with the turret? I’ll even give you the code to show how to do this. This would be put in your base entity’s OnThink function along with the player.
[lua]
elseif v:GetClass()==“turret” then
v=v:GetTable()
ammo = v:GetAmmo(self.AmmoType)
if ammo < self.Maximum then
amt = self.GiveAmount
res = amt + ammo
if res > self.Maximum then amt = amt - (res - self.Maximum) end
v:AddAmmo(amt,self.AmmoType)
end
end
[/lua]

The turrets don’t have a method of resupplying lost ammo so I suppose this would work great.

Sure thing, I’ll throw in the code - I’ll have to reupload to garrysmod.org though, and lose my download count, because it won’t let you update your actual .zip contents :confused:

Just looking over your turret, it is incredibly impressive. To be a sole ammunition provider would be quite nice, although I now feel the SENTs should be a tad more complicated :S

UPDATE: Uploaded, link replaced, now I get to go play with the turret :wink:

UPDATE 2: Fixed the download, forgot to check the code before putting it in - couple of arguments the wrong way round.

Oops.

Wouldn’t that make it TAKE the ammo?

No the arguments are ammotype, amount.

Hmm, this is quite nice. I like it when different creators share thoughts and help eachother out, instead of competing all the time. I’ll probably be using both the turrets and this ammo supplier a lot (Yes, i like DMing a lot). I got some questions though, although it might be self-explanatory in your post:

Does this do 1 total refill of your clip and STOP refilling after 1 use?

If you set it to refill and quickly start wasting ammo, will it continue to refill until your clips gets filled?

This doesn’t refill the “current” clip, but the “reserve” ammo, right?

It will continuously give you reserve ammunition as long as you meet the conditions (either being nearby or holding E on it) until you have a certain amount of the reserve ammunition. For example, I have an On Use: SMG ammobox. If I hold E on it then my ammunition will continuously increase until I have 225 reserve ammunition. It does not at all take into amount how much ammunition you have in your weapon.

~
where is download link

Click it - it’s the download link.

Please make it so the crate can disappear when used, so it can be used for roleplay for those who want to. And make it resupply without having to hold down E, just press once and it will resupply you until you’re full.

Resupplying ALL weapons would also be nice.