Welcome, Guest. Please login or register.
Did you miss your activation email?
November 23, 2024, 12:36:30 AM
Home Help Login Register
News: Zombie Master 2 discussion

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Custom ammo?
Pages: [1]
Author Topic: Custom ammo?  (Read 3786 times)
NinjaTuna
Poster

Posts: 3


« on: December 07, 2010, 07:38:47 PM »

I have been experimenting with making some new weapons for TTT and now I would like to create new ammo for some of them.
So I made a new folder in the correct place, grabbed myself a default ammo file, changed it a little (I think  ENT.AmmoType = "sg550" (= a non existant ammotype) might cause the problem) and saved it.
After that I changed the SWEP.Primary.Ammo and SWEP.AmmoEnt to the correct type in the weapon lua and went to test it ingame.
Ingame I experience that when I walk over the matching custom ammo for my weapon, the ammo disappears and nothing else happens.

Any info on this would be appreciated!
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #1 on: December 07, 2010, 08:32:29 PM »

The ammo type must be a valid Source/gmod ammo type. This is a gmod limitation. You can safely reuse any ammo type that TTT does not already use.
NinjaTuna
Poster

Posts: 3


« Reply #2 on: December 07, 2010, 08:43:00 PM »

I noticed myself alread :P, thanks anyways!
BTW, if I pick the ammo up now it prints #airboatgun_ammo or something similar, how to change this?
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #3 on: December 07, 2010, 09:38:54 PM »

Try adding this to the SWEP script:
if CLIENT then
  language.Add("airboatgun_ammo", "My cool SWEP ammo")
end
NinjaTuna
Poster

Posts: 3


« Reply #4 on: December 08, 2010, 03:50:21 PM »

Ok thanks again :D
Now one (hopefully last) question:
Would it be possible to let the amount of ammo you get depend on what weapon you have, so, when there is two weapons that need the same ammo, one of them would get 10 and the other one 20?
deathcon62
Poster

Posts: 8


« Reply #5 on: December 08, 2010, 04:21:48 PM »

the AK 47 on our server (modified m16) takes 30 round clips burst fire while the modified semi auto and full auto glock take 20. So its possible, but i didn't do this stuff so i have no idea. If no one responds by the time my coder gets online, ill ask him
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #6 on: December 08, 2010, 09:47:27 PM »

One way to do that would be to add a check for the weapon the player has in the ammo entity code, and vary the amount of ammo he is given. I don't know how proficient you are with Lua, but it shouldn't be too hard if you look at the base_ammo_ttt entity's code. Your custom ammo would just override ENT:Touch to do the special stuff.

There are some inconsistencies you'll get though: if a pistol and a primary use the same ammo, but for the pistol you only get 20 out of a box and for the primary you get 30, then players who have the primary suddenly have an easier time getting ammo for their pistol.

I would personally just have one of the guns use smaller clips (eg. 20 vs 30), so for one of the guns a box of 30 ammo just gives a little more than 1 clip of ammo. It's simpler and more consistent.
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Custom ammo? « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.011 seconds with 18 queries.