In my addon. Black Mesa NPCs, I have the NPCs spawn with random bodygroups. It works fine and all. But the I have too many Marines spawning with Medic helmets. So I set the NPCs to have a 1 in 1000 or higher chance of spawning with NV Goggles/ Medic Helmets. The codes looks like this: [IMG]http://i.imgur.com/YowNyy1.jpg[/IMG] But yet the NPCs look like this when I spawn them: [IMG]http://i.imgur.com/ybmjvVL.jpg[/IMG] I set them to have a 1/1000 chance of spawning with Medic hat. Yet it happens frequently. Also for the Holster I set them to always spawn with one, Yet they still spawn without it. I'm new to Lua and I have no idea what to do. No errors in console.
First argument is a number, not string. So you'll have to find out which bodygroup name is which number.
[editline]6th June 2013[/editline]
[url]http://wiki.garrysmod.com/page/Entity/GetBodygroupName[/url]
[editline]6th June 2013[/editline]
Second argument is not a chance, it is literally which of, for example, helmets you want to use.
[QUOTE=Robotboy655;40927592]First argument is a number, not string. So you'll have to find out which bodygroup name is which number.
[editline]6th June 2013[/editline]
[url]http://wiki.garrysmod.com/page/Entity/GetBodygroupName[/url]
So If
[editline]6th June 2013[/editline]
Second argument is not a chance, it is literally which of, for example, helmets you want to use.[/QUOTE]
So if a model has 4 body groups then I should write something like( 1 ,math.random(0,1,2,3) )?