Page 1 of 1

Adding a unit to the barracks

Posted: Wed Aug 15, 2018 2:01 am
by Arisen
so, If I wanted to add a new unit to the barracks. For instance this new "blue spy" unit, or even an ant. How would I do that?


:PB been looking through the files and im just not figuring it out

Re: Adding a unit to the barracks

Posted: Wed Aug 15, 2018 2:36 am
by TommyCD1
In your unit's .cfg file, you'll want to have code that looks like this.

Code: Select all

    Constructor("army.building.barracks1");
    ConstructionTime(10);
    CreateSource("resource.blob.infantry1");
    CommandCost(1);
    ResourceCost()
    {
      Add("Plastic", 50);
      Add("Electricity", 0);
    }
    Prereqs()
    {
      Add("army.building.barracks1");
    }
This defines what builds a grunt, how much it costs, what is required to build it, etc.
  • Constructor("army.building.barracks1"); - This is what building will build your unit.
  • ConstructionTime(10); - This is how long in seconds it takes to build your unit.
  • CreateSource("resource.blob.infantry1"); - This is what plastic blob your unit will create upon death.
  • CommandCost(1); - This is how many points towards the unit limit your unit will count. Best to leave this at 1.
  • ResourceCost() - This is how much your unit costs to build.
  • Prereqs() - Anything listed here must be build before you are allowed to build your unit.
Remember that the build menu for a construction menu can have an indefinite amount of units in it, but once you have more than 8 slots filled, you'll need to scroll the build menu with the mouse wheel.