Massive unit spawn glitch [Solved]

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
icemember
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 318
Joined: Thu Jun 11, 2009 3:02 am
Projects :: Designated Days Chapter 1
Games I'm Playing :: SWBF2 Mortal Komabt
xbox live or psn: icemember x
Location: 6 planet of the Hoth system

Massive unit spawn glitch [Solved]

Post 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
ZoomV
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 308
Joined: Thu Aug 15, 2013 11:27 am
Projects :: Old Republic Map pack
Games I'm Playing :: BF2 SWTOR and GW2
xbox live or psn: No gamertag set
Location: Belsavis, Maximum Security Ward

Re: Massive unit spawn glitch

Post 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
icemember
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 318
Joined: Thu Jun 11, 2009 3:02 am
Projects :: Designated Days Chapter 1
Games I'm Playing :: SWBF2 Mortal Komabt
xbox live or psn: icemember x
Location: 6 planet of the Hoth system

Re: Massive unit spawn glitch

Post by icemember »

It worked! Thx ZoomV. I owe you one.

Funny, never had a problem with this line before.
Post Reply