Page 2 of 2

RE: Re: RE: Re: RE: How to add unit customization (in-game)

Posted: Tue Aug 21, 2007 2:00 pm
by MasterSaitek009
What if you made different units with every possibility covered.
So if a person with a pistol walked into region rifle their unit would be switched to unit with a rifle and a pistol.
So instead of adding something to the existing class it would switch you to a whole new unit with the proper weapons.

This method would probably include a 400 line long if-then or a huge switch statement (does stripped down BF2 LUA even have switch?)
But who cares it would be awesome if it worked!

Posted: Tue Aug 21, 2007 2:23 pm
by Syth
As I said this
well my idea was that youd have 9 units-
3-4 units that would be customizable, and 6-5 would be pre-made units that would be primaraly AI.
would get around this...
I thought I heard that a script like this will cause all fellow units of your class to take on the weapon change

You see, youd have 3-4 units that would be affected by weapon regions. In the LUA you set the limit of each of these units to 1 (so the AI dont use them). Then there would be room for 5-6 more units on your team, which would be normal units that the AI would use, uneffected by what weapon regions you go to.

Posted: Tue Aug 21, 2007 3:20 pm
by [RDH]Zerted
Your ideas would work Syth. You would use SetClassProperty() to change the values. Instead of regions (or in addition to), you could make droppable weapon packs like those health/ammo packs.

The game crashes when you add too many units to the two human playable teams. There is a single method which lets a unit be used by all teams, but I have never looked into what this does to the unit selection screen.