Percentage/chance of weapon spawn

leemo

New Member
Right, I've been tweaking the NPC's on my server and I've added quite a variety of gear, the only downside is they always seem to spawn with the Gucci gear (a squad of bandits took over cherno ALL of them armed with M60's) I'd like to limit the chance of some of the higher end weapons (.50's MG's etc) I've had a guess at the code, but I'd like to hear confirmation of it too..

So the weapon code as we all know goes like:

Code:
["AK_107_pso","M4A1","MG36"]

Now say I'd like to change the chance of the MG36 spawning, am I right in thinking it would work like the items? for istance:

Code:
["AK_107_pso","M4A1","MG36",25]


Would that affect the percentage the MG will spawn?

Thanks :)
 
Also, an afterthought how would I go about restricting the amount of snipers/riflemen are in a particular group,

I know how to change the amount of units in a group but say I have a bandit group of ten, how can I stop that bandit group from being 8 snipers 1 rifleman and 1 leader?
 
You need to do weapons differently than items. Items have the drop chance as a %, whereas weapons are a chance from the "pool" you create. So, in your first example:

Code:
["AK_107_pso","M4A1","MG36"]

Each of those weapons has a 33% chance to be picked as the primary AI weapon for a unit. Say you wanted to give the MG36 a 10% chance to drop, you could do something like this:

Code:
["AK_107_pso","AK_107_pso","AK_107_pso","AK_107_pso","AK_107_pso","M4A1","M4A1","M4A1","M4A1","MG36"]

In that example, the AK_107_pso has a 50% chance (5/10), the M4A1 has a 40% chance (4/10) and the MG36 a 10% chance (1/10). Make sense?

For your 2nd question, I don't think you can define roles for dynamic spawns. You can for static spawns though, just check the syntax in the map file (number of riflemen vs snipers). To make the dynamic spawns nicer overall though, just make sure not to give the non-snipers sniper rifles in their weapons pool :)
 
Back
Top