ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

100 Units Bug: Difference between revisions

From ModEnc
Jump to navigation Jump to search
Note about 9-2^2
Striker (talk | contribs)
No edit summary
Line 88: Line 88:
  138=XCOMET
  138=XCOMET
Note the allied stuff is first, next soviet and yuri, then there's a gap between 41 and 101 before civilian units are listed. The numbers don't really matter, only the order of the list does. Now I see that I have 41 buildable units, and can still make 60 extra ones without screwing up.  
Note the allied stuff is first, next soviet and yuri, then there's a gap between 41 and 101 before civilian units are listed. The numbers don't really matter, only the order of the list does. Now I see that I have 41 buildable units, and can still make 60 extra ones without screwing up.  
The [[RockPatch:Main|RockPatch]] fixes this bug.


=== Note about the list enumeration ===
=== Note about the list enumeration ===

Revision as of 19:49, 9 October 2006

RA2 and YR (and probably TS and FS as well) are coded in a way that limits the number of total buildable VehicleTypes, InfantryTypes, and probably AircraftTypes as well, to 100 units each. If you have a buildable object on a place after 100, the AI will think that is the only unit buildable and create it over and over again. Literally. It will continue building until there is no money left or you stop it. This bug can partly be avoided, see below for details.

Avoiding the 100 unit bug (by DCoder)

Look at your [InfantryTypes] and [VehicleTypes]. How many entries do they have? If there's more than 101 buildable units (those without TechLevel=-1) and the're not all in the first 101 lines of the list, the AI will go nuts - it'll build the last unit in the list non-stop, and won't attack. To avoid it, you'll need to rearrange these lists, put buildable units first and the civilian and dummy units in the very end. I personally sorted it like this:

[VehicleTypes]
1=AEGIS
2=AMCV
3=BFRT
4=CARRIER
5=CMIN
6=DEST
7=DLPH
8=FV
9=LCRF
10=MGTK
11=MTNK
12=ROBO
13=SHAD
14=SREF
15=TNKD

16=APOC
17=DISK
18=DRED
19=DRON
20=DTRUCK
21=HARV
22=HYD
23=HTK
24=HTNK
25=SAPC
26=SCHP
27=SMCV
28=SQD
29=SUB
30=TTNK
31=V3
32=ZEP

33=BSUB
34=CAOS
35=YHVR
36=YTNK
37=LTNK
38=MIND
39=PCV
40=SMIN
41=TELE

;notice the gap here
102=AMBU
103=BCAB
104=BUS
105=CAR
106=CBLC
107=CDEST
108=CIVP
109=CMON
110=CONA
111=COP
112=CRUISE
113=DDBX
114=DeathDummy
115=DOLY
116=EUROC
117=FTRK
118=HORV
119=HOWI
120=YCAB
121=YDUM
122=JEEP
123=LIMO
124=PICK
125=PROPA
126=PTRUCK
127=SCHD
128=STANG
129=SUVB
130=SUVW
131=TAXI
132=TRUCKA
133=TRUCKB
134=TUG
135=UTNK
136=VLAD
137=WINI
138=XCOMET

Note the allied stuff is first, next soviet and yuri, then there's a gap between 41 and 101 before civilian units are listed. The numbers don't really matter, only the order of the list does. Now I see that I have 41 buildable units, and can still make 60 extra ones without screwing up.

The RockPatch fixes this bug.

Note about the list enumeration

Note, the numbers on the left can really be anything. The engine doesn't pay any attention to it, it discards everything to the left of the = sign, and uses its own enumeration, starting at 1 (or possibly zero, but the numeration doesn't make the slightest difference in this case). You can even use stuff like

ALLIEDMCV=AMCV
H4RV3S73R=HARV
7^3-4^2=CMIN

and similar if you want, it makes no difference. But, obviously, using a proper 1-based ordinal enumeration gives you ideas of how many "slots" you stil have available for buildable units.