CrateGoodie
| Flag: | CrateGoodie |
| File(s): | rules(md).ini |
| Values: | Boolean values: yes or no, true or false, 1 or 0 |
| Default: | no |
| Applicable to: | VehicleTypes |
Define whether this vehicle can be the result of the Unit CrateType random drawing process.
Notes
In multiplayer mode, when players open crates of Unit CrateType, there are other judgment rules[1] that occur before random behavior.
- First is the FreeMCV rule, and it is hard-coded to take effect in vanilla and does not follow the ini flag.
- Second, if the player has any building(s) listed in [AI]→BuildRefinery= but has no vehicles listed in [General]→HarvesterUnit=, a harvester unit from the HarvesterUnit list will be granted at this time.
- Next is the judgment for UnitCrateType. If it is set, then the filled object will be used directly. This flag is used to add the vehicle to the random pool when [CrateRules]→UnitCrateType=none.
At this point, it finally reaches the step of random selection. After selection is completed, it is filtered based on whether CrateGoodie=yes is satisfied[2], that is, it reaches the step controlled by this flag. However, this is not the end:
- If the drawn vehicle is not in BaseUnit=, then it is used directly;
- If the drawn vehicle is listed in BaseUnit=, then an additional check is performed. If owner is not a Human Player[3] and the current NeedBase check of the FreeMCV rule is not satisfied, then it will return to the random selection step to draw a new object.
Should not set CrateGoodie=yes for units that cannot move on land, such as naval ships. Otherwise, they will spawn to the nearest Land=water cell (including those where NoUseTileLandType=no is not set and that are occupied by Land=water overlays) or under the overhanging bridge body of an elevated bridge.
Bugs/Side-Effects/Unexpected Limitations
A loop that cannot be fully broken out of with a break statement is used in the random selection process. This means that if the process normally enters random selection but there is no vehicle with CrateGoodie=yes, or if in the step to prevent AI from acquiring BaseUnit, it repeatedly fails to select any vehicle that is not a BaseUnit, it will cause an infinite loop, leading to game freeze.
Footnotes
- ↑ Here, we temporarily do not consider situations such as when there are already 50 vehicles, it will be forced to switch to Money CrateType, etc., due to Crate behavior leading to other non-Unit branches.
- ↑ Yes, the selection is not only performed among objects with CrateGoodie=yes, but rather the selection is completed first, and then filtered through CrateGoodie=yes.
- ↑ Westwood attempts to prevent AI from having multiple bases in this way, perhaps hoping to avoid AI Factories Clone.
References
Starting from Phobos Build#41, a new flag named CrateGoodie.RerollChance was introduced, which determines the chance that if this type of unit is rolled, it will reroll again for another type of unit. Refer to Phobos documentation.