Skip to content

Crates

Places pickup crates on the map and gives one result to the infantry or vehicle that collects each crate.

Features & systemsScenarios & AIMaps & scenarios

Changed in 0.2.0

A crate is an overlay. Any OverlayType with Crate=yes is collected as a crate. Crates the engine places itself always use the overlay type named by WoodCrateImg. In a campaign, WoodCrateImg and CrateImg also decide which result a crate gives.

Outside a campaign, the engine places random crates, draws each crate’s result from weighted shares, and replaces crates as they expire or are collected. A campaign does none of this: its crates come only from the map and from destroyed vehicles, and each gives a fixed result.

Outside a campaign, when crates are enabled for the match, random crates are placed once as the scenario finishes loading. The number placed is the larger of CrateMinimum and the number of human players, capped at CrateMaximum. Both keys belong in [CrateRules] in rules.ini.

Network games and spawned matches record the number of human players. A skirmish started from the game’s menus does not, so it places CrateMinimum crates. A network game played earlier in the same session can leave a larger count behind.

Each random crate occupies one of 256 tracking slots until it is collected or expires. When all 256 slots are in use, no further random crate is placed, whatever CrateMaximum says.

A map can draw crates in its overlay layer. They appear in every match, including campaigns and matches with crates switched off. As with every other overlay, a crate drawn outside the playfield is dropped.

A drawn crate appears exactly where it was drawn, whatever occupies the cell or its terrain type. The only exception is the slope: a crate appears only on flat ground or on one of the four standard ramps. A standard ramp slopes toward one of the four map directions and has two of the cell’s corners raised. Corner, steep and double-ramp slopes never hold a crate, however it arrives.

A drawn crate takes no tracking slot, so it never expires. It stays on the map until something collects it.

Placing a random crate makes up to 1000 attempts. Each attempt draws a random cell anywhere on the map, including the border outside the playable area, then goes through these steps:

  1. If the cell lies outside the playable area, the attempt fails and the next attempt draws a new cell.

  2. If the cell holds an overlay, the engine draws a fresh random cell, then takes a nearby cell that is unoccupied, lies in the playable area and can be crossed by tracked vehicles. It repeats this until the cell has no overlay or has one that allows a crate. The new cell is not near the rejected one.

  3. The engine creates the WoodCrateImg overlay on that cell. It never places CrateImg.

  4. The crate appears only if the cell passes all of these tests, in this order:

    • the cell is flat or has one of the four standard ramps;
    • it holds no infantry, vehicle, building, landed aircraft, or terrain object such as a tree;
    • it has no wall;
    • tracked vehicles can cross its land type;
    • the overlay already in the cell, if there is one, does not set Overrides=yes.

In step 2, an overlay allows a crate only when its type sets BuildableOver=yes, it is not a wall, and the cell’s land type is passable to the Foot or the Float speed type. Any other overlay forces a redraw, including Tiberium, veins, walls, bridges and an existing crate. A crate placed on such a cell replaces the overlay, unless the overlay also sets Overrides=yes, in which case step 4 rejects the cell.

The wall test in step 4 never fails, because step 2 always moves away from a wall.

A random crate’s lifetime is chosen when it is placed. It is a random time between half of CrateRegen and twice CrateRegen, in minutes of game time. The shipped rules set CrateRegen=3, so a crate lasts between 1.5 and 6 minutes. With CrateRegen=10, it lasts between 5 and 20 minutes.

Outside a campaign, while crates are enabled for the match, a crate that reaches the end of its lifetime is removed and a new random crate is placed.

Collecting a crate also places a new random crate, outside a campaign, when crates are enabled for the match and Crates in [MultiplayerDefaults] is yes. This applies to every collected crate, including one drawn into the map or dropped by a vehicle.

A destroyed vehicle whose type sets CarriesCrate=yes can drop a WoodCrateImg crate. The crate lands on a nearby cell in the playable area that is unoccupied, has no overlay, and can be crossed by tracked vehicles. If no such cell is found, nothing drops.

The map’s [Basic] section decides whether drops happen. A type with IsTrain=yes drops a crate only when TrainCrate is enabled, and every other type only when TruckCrate is enabled. The Toggle Train Cargo trigger action changes the train setting during a mission.

A dropped crate takes no tracking slot, so, like a crate drawn into the map, it never expires.

Infantry, walkers, hovercraft and driven vehicles collect a crate when they move into its cell. These are the walking, mech, hovering and driving locomotors. Objects with any other locomotor never collect a crate: jump-jet infantry and flying aircraft pass over the cell, and buildings never move onto one.

A crate can be collected anywhere its collector can move. Crates placed by the engine always lie inside the playable area, so any crate in the map border was drawn there by the map.

Some objects refuse to enter a crate’s cell at all. The table shows which, by whether a human plays the object’s house and whether the match is a campaign:

The collectorIn a campaignOutside a campaign
A vehicle of a human-played houseEnters and collectsEnters and collects
Infantry of a human-played houseEnters and collectsEnters and collects
A vehicle of a house that is not human-playedRefuses the cellEnters and collects
Infantry of a house that is not human-playedRefuses the cellRefuses the cell

Outside a campaign, a house whose country sets MultiplayPassive=yes never collects a crate. Its vehicles still drive over crates, leaving them in place, and its infantry refuse crate cells as the table shows. In a campaign, MultiplayPassive does not affect crates.

When the overlay type sets CrateTrigger=yes, collecting the crate fires two trigger events:

  • Pickup Crate springs on the collector’s tag, if it has one, before the result is chosen. If that trigger destroys the collector, the crate stays on the map, gives no result, and Pickup Crate (any) does not fire.
  • Pickup Crate (any) fires on the next game frame.

Crates without CrateTrigger=yes fire neither event.

[Powerups] gives each crate result a share of the random draw, an animation, and one number that the result’s effect uses. The entry names are the result tokens on the crate result page, and Crate powerups owns the syntax. If you already write [Powerups] entries, skip to choosing the result.

Each value is a comma list of Share,Anim,Data. The animation can be <none> or none; an AnimType name the rules do not register also gives no animation. The third field is optional. Written with a percent sign, it is divided by 100: Armor=33,ARMOR,50% stores 0.5.

rules.ini
[Powerups]
Money=55,MONEY,2000 ; share 55, plays the MONEY animation, pays at least 2000 credits
Armor=33,ARMOR,2 ; share 33, plays ARMOR, halves incoming damage inside the radius
Explosion=38,<none>,500 ; share 38, no animation, 500 raw damage per blast
Veteran=15,VETERAN,1 ; share 15, plays VETERAN, one promotion step per object

In a campaign, a crate’s result depends only on its overlay type, and the shares in [Powerups] are ignored. The overlay is tested in this order:

  1. An overlay matching CrateImg gives the SilverCrate result.
  2. An overlay matching WoodCrateImg gives the WoodCrate result, replacing the result from step 1.
  3. Any other crate overlay gives money.

A campaign crate that is collected is not replaced. A Squad result becomes money, as described under results without effect.

Outside a campaign, the result is drawn at random, weighted by the shares in [Powerups]. Each result’s chance is its share divided by the total of all shares, so raising one share lowers the chance of every other result.

The drawn result is then replaced by a free MCV, delivered through the Unit result, when the collector’s house meets all of these conditions:

  • it owns no buildings;
  • it has more than 1500 credits available;
  • it owns no vehicle of any BaseUnit type;
  • bases are enabled for the match.

Six results are then converted to money. The conversions run after the MCV override, so a house with more than 50 vehicles receives money in place of its free MCV.

Drawn resultConverted to money when
Unitthe collector’s house owns more than 50 vehicles
Squadalways, in campaigns too
Armorthe collector’s armor multiplier was already changed by an earlier crate, unless ArmorCrateStacks=yes
Speedthe collector’s speed multiplier was already changed
Firepowerthe collector’s firepower multiplier was already changed, unless FirepowerCrateStacks=yes; or the collector has no primary weapon
Cloakthe collector can already cloak

The third field of a result’s [Powerups] row is the only per-result number the engine reads, and most results ignore it.

ResultWhat the third field sets
MoneyThe minimum credits paid outside a campaign; a random bonus of up to CrateMoneyBonus is added
UnitThe minimum credits paid outside a campaign when the vehicle cannot be placed
ExplosionRaw damage of the direct hit on the collector and of each of the five blasts
NapalmRaw damage of the direct hit on the collector and of the blast
GasRaw damage applied to each of the nine cells
VeteranHow many promotion steps each object takes
ArmorThe armor factor or additive amount
SpeedThe speed multiplier
FirepowerThe firepower factor or additive amount
Every other resultNot read

Outside a campaign, a money crate pays a random amount between the Money row’s third field and that figure plus CrateMoneyBonus credits, inclusive. In a campaign it pays SoloCrateMoney instead. If SoloCrateMoney is 0, a campaign crate uses the random range.

In a campaign, money from a crate collected by any house the local player controls goes to the player’s house, not to the collecting house.

The unit result chooses a vehicle type in these steps. A later step can replace an earlier choice. Steps 1 and 2 use the house’s preferred entry of a list: the first entry that the country the house acts as may own, or the list’s first entry if that country may own none.

  1. If the MCV override applied, the house’s preferred BaseUnit entry.

  2. If no type is chosen yet, and the house owns a structure of any BuildRefinery type but no vehicle of any HarvesterUnit type: the house’s preferred HarvesterUnit entry.

  3. If UnitCrateType names a type, that type, replacing any earlier choice.

  4. If no type is chosen yet, a random vehicle type that meets all of these conditions:

    • it sets CrateGoodie=yes;
    • the country the collector’s house acts as may own it;
    • Any of: bases are enabled for the match, or it is not a BaseUnit type.

If no vehicle type meets the step 4 conditions, the crate gives nothing: no vehicle and no money. It still plays the Unit row’s animation.

The vehicle appears on the crate’s cell or on a nearby cell it can occupy. Either way, the collector stops short of the crate’s cell.

If the vehicle cannot be placed in either location, the crate pays money instead. Outside a campaign, the amount is drawn from the Unit row’s third field up to CrateMoneyBonus credits more, not from the Money row.

Cloak, Veteran, Armor, Speed and Firepower affect objects on the ground within CrateRadius of the center of the crate’s cell. None of them checks ownership, so enemy and neutral objects inside the radius are affected along with the collector’s side.

  • Cloak makes each object able to cloak, which cloaking and detection then acts on.
  • Veteran promotes each object whose type sets Trainable=yes, as many steps as its third field says. Promotion without kills describes the steps.
  • Armor, Speed and Firepower each set a multiplier on the affected objects.

ArmorCrateStacks=yes allows armor upgrades for objects whose armor multiplier is no longer 1. FirepowerCrateStacks=yes does the same for firepower. Speed always requires a speed multiplier of exactly 1 and also skips buildings and aircraft.

Speed always multiplies the current speed multiplier by its third field. ArmorCrateStacksAdditively and FirepowerCrateStacksAdditively choose the calculation for their result:

  • At no, new multiplier = current multiplier × third field.
  • At yes, new multiplier = current multiplier + third field.

This calculation applies to the first pickup too. The added amount is the third field as written: 0.5 adds 0.5. The additive settings do not change the recipient checks or the conversions to money.

For example, these armor settings take an object’s multiplier from 1 to 1.5, then 2, then 2.5 after three armor crates. Keep the rest of your [Powerups] entries alongside the example so other results remain in the draw.

rules.ini
[CrateRules]
ArmorCrateStacks=yes
ArmorCrateStacksAdditively=yes
[Powerups]
Armor=33,ARMOR,0.5

An additive upgrade is skipped for an object if the new multiplier is not finite or is 0 or less. That object keeps its multiplier and does not trigger an upgrade EVA line. The crate is still consumed, and rejecting an upgrade does not suppress its configured animation. Zero and negative amounts are allowed when the resulting multiplier stays finite and above 0. This check applies only to additive upgrades.

Incoming damage is divided by the armor multiplier. Movement uses the speed multiplier, and firepower scales weapon damage. An armor multiplier of 2 halves ordinary incoming damage, and 0.5 doubles it.

HealBase restores every object of the collector’s house that is on the map to maximum strength. CrateRadius does not limit it. Passengers inside a transport are not healed. HealCrateSound plays at the collector when the collector belongs to the local player.

Darkness covers the whole map in shroud again, and Reveal reveals the whole map. Both act for the player who controls the collecting house, including, in a campaign, a house the scenario marks PlayerControl=yes. Collected by any other house, either crate is used up and plays its animation without changing anyone’s vision.

Darkness is the only crate result that restores shroud.

The ICBM result grants the collector’s house a one-time superweapon; that section explains which weapon it is. A house that already holds that weapon gains nothing. The sidebar button appears only when the collector belongs to the local player.

Explosion damages the collector with the C4Warhead warhead. It then sets off five blasts of the same damage and warhead at random points within two cells of the crate. Each blast has its own explosion animation and lighting flash, and can set off chain reactions.

Napalm damages the collector with the FlameDamage warhead. It then sets off a blast of the same damage halfway between the crate’s cell and the collector. The blast plays the first AnimType the rules register, whatever its name, and [Powerups] cannot change it.

Gas applies its damage with the warhead named GAS to the crate’s cell and each of its eight neighbors. The damage has no attacker, so its kills earn no one experience, and it sets off no chain reactions. If the rules define no warhead named GAS, the result does nothing.

Tiberium places one growth stage of a random Tiberium type on the crate’s cell, and at 10 to 20 random points within three cells of it. Two points can land on the same cell. A point that lands on a cell already holding that Tiberium grows it one stage. A cell that cannot take it is left unchanged.

The type is drawn from the registered Tiberium types, except that a draw of the second entry in [Tiberiums] becomes the first entry. The second type therefore never comes from a crate, and the first type is twice as likely as each of the others.

Three result tokens have no effect: Invulnerability, IonStorm and Pod. Drawing one uses up the crate and plays that row’s animation; nothing else happens. Pod shares its name with the Drop Pods superweapon but has no connection to it.

Squad always becomes money before its effect runs, so its share acts as extra weight on money. The payout uses the Money row’s third field.

FreeMCV is read from [CrateRules] but has no effect. The free MCV override applies whenever its conditions hold, whatever FreeMCV says.

The result’s animation, named by the second [Powerups] field, plays slightly above the center of the crate’s cell. It comes from the result that actually ran, so a converted crate plays the animation of what it became: a wasted firepower crate plays the money animation. A unit crate whose vehicle is placed plays no animation.

Armor, Speed and Firepower each play one EVA line per crate, and only when at least one affected object belongs to the local player.

When selected, an object whose armor or firepower multiplier is above 1 shows a different selection bracket. So does an infantry unit or vehicle whose speed multiplier is above 1. That bracket is the only lasting sign of the three multiplier crates. Buildings and IsCoreDefender=yes vehicles show a pip bar in place of a bracket, so they never show it.

A veterancy crate’s effect shows as the rank insignia, and a cloak crate’s effect shows when the object cloaks.

23 of 23

KeyDescriptionValueWhen omitted
ArmorCrateStacksglobal rulesbooleanno
ArmorCrateStacksAdditivelyglobal rulesbooleanno
CarriesCrateUnitTypeWhether a destroyed vehicle of this type drops a crate, when the scenario allows the drop.booleanno
CrateOverlayTypeWhether the overlay is a crate, which infantry and vehicles collect by entering its cell.booleanno
CrateGoodieUnitTypeWhether the vehicle type is in the random pool a unit crate draws from.booleanno
CrateImgglobal rulesThe OverlayType whose crates deliver the SilverCrate result in a campaign.classnone
CrateMaximumglobal rulesMost crates placed at the start of a non-campaign scenario.integer255
CrateMinimumglobal rulesFewest crates placed at the start of a non-campaign scenario.integer1
CrateMoneyBonusglobal rulesinteger900
CrateRadiusglobal rulesThe distance from an opened crate within which its sweeping results reach other objects, in cells.distance (cells)2.5
CrateRegenglobal rulesThe range, in minutes, of the random lifetime given to each random crate.floating point10
CrateTriggerOverlayTypeWhether collecting the overlay springs the crate pickup trigger events.booleanno
Cratesglobal rulesStarting state of the crates option for a multiplayer or skirmish match.booleanyes
FirepowerCrateStacksglobal rulesbooleanno
FirepowerCrateStacksAdditivelyglobal rulesbooleanno
HealCrateSoundglobal rulesSound played at the collector when it opens a heal crate for the local player.soundnone
SilverCrateglobal rulesThe crate result delivered by a CrateImg crate in a campaign.cratetypeHealBase
SoloCrateMoneyglobal rulesCredits a campaign crate pays when its result is money.integer2000
TrainCratescenariosWhether a destroyed train vehicle drops a crate in this scenario.booleanno
TruckCratescenariosWhether a destroyed non-train vehicle drops a crate in this scenario.booleanno
UnitCrateTypeglobal rulesThe single vehicle type every unit crate delivers.classnone
WoodCrateglobal rulesThe crate result delivered by a WoodCrateImg crate in a campaign.cratetypeMoney
WoodCrateImgglobal rulesThe OverlayType used for every crate the engine places itself.classnone

History

  1. Changed0.1.0

    Correct the armor crate multiplier

  2. Changed0.1.0

    Honor the crates option after pickup

  3. Changed0.1.0

    Keep repeated reveal crates revealing

  4. Changed0.2.0In development

    Set the random extra money a crate pays

  5. Changed0.2.0In development

    Judge the crate harvester rescue on the whole list

  6. Changed0.2.0In development

    Keep a map's crates in every game type

  7. Changed0.2.0In development

    Let armor and firepower crates stack