Skip to content

Worker

Lets a Unit gather and build. Right-click a Resource and it fetches loads of it back to the nearest depot (a Building with Depot ticked) over and over; select it and press a building’s hotkey to place one of its Builds.

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: Unit

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.

  • carry: a whole number = 8. How much it carries back each trip. (Field: a number.)
  • gatherTime: a number = 1.5. Seconds it takes to gather a load. (Field: a number.)
  • builds: text = “Farm, Barracks”. The building prefabs it can put up, e.g. “Farm, Barracks, Tower”. Each needs a Building. (Names prefabs: their names, separated by commas.) (Field: a name.)

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

  • carrying: text. What it’s carrying, e.g. “Gold”, or empty.
  • load: a whole number. How much it’s carrying. (Sent in a network game.)
  • source: an entity: its name, id or path. The resource it goes back to after dropping off a load.

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