Adding a unit to the barracks

Have modding questions or discovered something new? Post here.
Post Reply
User avatar
Arisen
Mortar Man
Mortar Man
Posts: 33
Joined: Fri Feb 17, 2017 6:16 am
American Samoa

Adding a unit to the barracks

Post 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
User avatar
TommyCD1
Moderator
Moderator
Posts: 1144
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: Adding a unit to the barracks

Post 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.
I may not make the best maps, or be the best player, but I put a lot of time, effort, and care into my stuff. That counts for something, right? No.
Image
"Can we order a pizza?"
GameRanger ID: 913974
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests