Crate powerups
Sets each crate type's share of the crate draw, the animation it plays, and the figure its effect uses.
- Kind
- Record
- File
RULE*.INI,LANGRULE.INI,FIRESTRM.INI,LANGFS.INI,map file- Section
[Powerups]- Record form
<crate type>=<shares>,<AnimType ID>,<data>
Fields
| # | Field | Accepted value | Required |
|---|---|---|---|
| 1 | Shares | Integer weight in the crate draw | Yes |
| 2 | Animation | AnimType ID played where the crate was collected`<none>` for no animation | No |
| 3 | Data | Figure the crate's own effect interprets | No |
The crate types are fixed by the engine, and this section’s keys are their names. Nothing here registers a crate: the section is read by walking the engine’s own list of crate types and asking the file for each name in turn, so an entry whose key is not one of those names is never looked at. A misspelled name is inert rather than a new kind of crate, and no message says so.
[Powerups]Money=55,MONEY,2000 ; MONEY is an AnimType registered in rules.iniNapalm=25,<none>,600Reveal=8,REVEALEvery rules layer is offered the section in turn, and the map is offered it after them, so a map can reweight the draw for one scenario.
Reading an entry
Section titled “Reading an entry”The three fields are read in order and each one that is present replaces what that crate held. An entry that stops early leaves the remaining settings as they stand, which is how the two-field entries above keep their data figures.
The animation is named by its AnimType ID. <none> and none mean no animation, and so does a name that matches no registered AnimType — nothing distinguishes the two, and an ID that is registered only in a later rules layer counts as unmatched when the section is read. The data figure is read as a real number, and a percent sign anywhere in it divides the figure by one hundred.
Crates the section leaves out
Section titled “Crates the section leaves out”Because the section is read by asking for each crate name, a name it does not carry is not left alone. The answer to a name that is not there is the built-in 0,NONE, which takes that crate out of the draw and clears its animation, leaving only its data figure as it stands.
A layer that carries [Powerups] at all therefore has to list every crate it wants kept. Reweighting two crates in a map by writing a section with two entries in it silences the other seventeen for that scenario.
How the shares are used
Section titled “How the shares are used”The shares are weights rather than percentages. Collecting a crate adds up the shares of every crate type, picks a number from 1 to that total, and walks the types adding each share to a running total until the running total reaches the number picked, so a crate’s chance is its own share over the total of all of them. A share of zero takes a crate out of the draw without removing it from the game: a scenario can still hand it out directly, and crates collected in a campaign game ignore the shares entirely — those come from the rules settings that name a crate for each crate image.
Source files
Linked at revision 59fae722af8c.