Page 1 of 1

Massive unit spawn glitch [Solved]

Posted: Tue Feb 17, 2015 6:22 pm
by icemember
Hi. Been awhile.

I ran into a problem. I added a unit unlock for player team upon completing an objective. It works, but too much lol. When the new class is unlocked, over 200 units spawn in.

I used this line
AddUnitClass(1, "p11_inf_officer", 10)
I assume the 1 is team 1, 10 means 10 units of this class.

Image

Re: Massive unit spawn glitch

Posted: Tue Feb 17, 2015 7:10 pm
by ZoomV
BF2 uses a minimum and maximum parameters for adding units, so what I think happened is that the game interpreted that line to mean "have at least 10" but with not set limit. Add a second argument.

Example
AddUnitClass (1, "com_inf_example", 5, 10)
Where 5 is the minimum and 10 is the maximum

Re: Massive unit spawn glitch

Posted: Tue Feb 17, 2015 7:47 pm
by icemember
It worked! Thx ZoomV. I owe you one.

Funny, never had a problem with this line before.