Skip to content

Producer

Trains units at a Building: select it and press a unit’s hotkey (or click its button) to queue one up. The team pays the unit’s cost straight away, and needs the supply for it. Finished units walk out to the rally point.

Part of the Strategy module: Real-time strategy: factions, units that walk around obstacles and fight, workers that gather and build, buildings that train units, fog of war, the computer playing a side, the player’s controls and HUD, playing online team against team, and the Strategy template.

Requires: Building

In a network game, it also sends values of its own besides its properties.

Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.

  • trains: text = “Worker”. The prefabs it trains, e.g. “Worker” or “Soldier, Archer”. Each needs a Unit. (Names prefabs: their names, separated by commas.) (Field: a name.)
  • queueLimit: a whole number = 5. How many it can have queued up at once. (Field: a number.)

What anything can make it do with no code: a Trigger’s do when its message arrives, a Contraptions Wire’s input as its signal comes on, a script’s Game.Do(entity, “Name”).

  • Train (done with a name, its unit: a trigger’s with). Queues up a unit it trains, one of Trains (the first without one), as its button does: its team pays for it and needs the supply. A trigger, a card or a wire can train an army.
  • Cancel. Cancels the last unit queued, giving back what it cost.

What anything can read with no code: a Counter’s, Bar’s or Text’s output, a Contraptions Wire’s output as its signal; Text shows names too, the rest read numbers, true as 1.

  • Queued (a whole number). How many units it has queued up, the one in training included.
  • Progress (a number). How far along the first in line is, from 0 to 1.

Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.

  • queue: lines of text: an array of strings, or one string with line breaks. What it’s training, first in line first.
  • queued: a whole number. How many units it has queued up, the one in training included.
  • progress: a number. How far along the first in line is, from 0 to 1. (Sent in a network game.)

Scripts use it as Producer: its methods, events and values that aren’t saved with the scene.