Welcome, Guest. Please login or register.
Did you miss your activation email?
September 19, 2024, 11:58:52 PM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Custom ammo not spawning randomly?
Pages: [1]
Author Topic: Custom ammo not spawning randomly?  (Read 3068 times)
Willdy
Poster

Posts: 57


« on: March 23, 2011, 08:50:36 PM »

My server uses a new custom type of ammo, and we quite often use random ammo spawners to add a mix to the map as set weapon/ammo spawns are boring. What do I need to edit to make my custom ammo spawn randomly?
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #1 on: March 23, 2011, 09:12:12 PM »

The smallest edit would be to modify the ttt_random_ammo entity. It calls ents.TTT.GetSpawnableAmmo(), which is returns a hardcoded table of ammo entity classnames. You could replace that with your own hardcoded list that includes your ammo entity, for example. You could also add your entity name to that table, eg.:
local ammos = ents.TTT.GetSpawnableAmmo()
ammos = table.Copy(ammos) -- don't want to edit this table directly
table.insert(ammos, "my_custom_ammo")

-- leave rest alone


A much better solution would be for me to make random ammo find entities to spawn by looking at ENT.AutoSpawnable like weapons, which is something I'll put on my list.

edit: The latest SVN build of TTT now has this implemented. If you run that version, you can just set ENT.AutoSpawnable = true, and random ammo spawns will use that ammo entity.
« Last Edit: March 23, 2011, 09:30:35 PM by Bad King Urgrain »
Willdy
Poster

Posts: 57


« Reply #2 on: March 23, 2011, 09:43:02 PM »

Thanks :P
A good feature for TTT :D

Ill run it in a minute :D
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Custom ammo not spawning randomly? « 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.012 seconds with 18 queries.