Random Prop Ammo?

Is it possible to make a gun shoot random props each shot, not the same one over and over? If so, whats the ammo type i put in the lua?

It isn’t as simple as changing the ammo type. The best way of doing this is creating a table of valid models that your weapon is able to fire, then each time the weapon is fired, create a prop_physics and set its model to a random model from the table.

[editline]10:36AM[/editline]

**[Table.Random

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Table.Random)**

what do i separate the models with in lua? a ;?

A comma.
[lua]local ModelsTable = {
“path/to/a/model.mdl”,
“another/path.mdl”,
“etc/etc/etc.mdl”
}
[/lua]

do you know where i can find a list of props i can use?

SpawnMenu.

In your Garry’s Mod directory (steam/steamapps/<your name>/garrysmod/garrysmod), navigate to settings/spawnlist. Take a look at the models in the Useful Construction Props list.

thanks

[editline]12:32PM[/editline]

im using a swep maker, where do i insert the table.random?

SWEP.Secondary.Model = local ModelsTable = {
“models/props_c17/FurnitureChair001a.mdl”,
“models/props_c17/FurnitureCupboard001a.mdl”,
“models/props_c17/oildrum001.mdl”,
“models/props_c17/FurnitureMattress001a.mdl”,
“models/props_c17/gravestone001a.mdl”,
“models/Combine_Helicopter/helicopter_bomb01.mdl”,
“models/props_c17/FurnitureDrawer001a.mdl”,
“models/props_lab/clipboard.mdl”,
“models/props_c17/TrapPropeller_Engine.mdl”
} // the model you want to fire.

This probably won’t work with a SWEP maker. I would suggest coding it from scratch for experience, or modifying the Chair Throwing SWEP.

May I ask what SWEP Maker you are using?

im not sure. i think it may have been deleted from gmod.org as i cant find it