Jump to content

Help! How do you teach your workers to build new structures?


krt0143
 Share

Recommended Posts

Where does 0 A.D. define what structures units can build - or not? (for instance the fact champion units don't build anything, others do?)

I've looked and looked and didn't find anything, yet it has to be somewhere...  :huh:

 

I've made a brand new structure (copy of the roman Army Camp), and it works just fine in the game (if I place it in a map using the editor), but my builder units don't know how to build it: It doesn't appear in their list.
I guess I have to declare it somewhere as "buildable" first, isn't it. Where?

(I've put a "<Civ>brit</Civ>" line inside the structure's "<Identity>" tag, that's all I could think of, but apparently this isn't enough.)

Link to comment
Share on other sites

What you're looking for is the Builder component (<Builder></Builder>).

Notably, the following mixin file, which is included into the definition of every unit that can build buildings: https://code.wildfiregames.com/source/0ad/browse/ps/trunk/binaries/data/mods/public/simulation/templates/mixins/builder.xml

Note that this does provide civ-specificity: if your new structure template is named, say, brit/camp_example.xml, then adding it to the above file as structures/{civ}/camp_example will cause it to only appear in the build list of Britannic builders (builder units belonging to other civs - e.g. in-game allies - will be able to assist with construction once the foundation has been laid). The absence of, say, a mace/camp_example.xml template is silently ignored.

That said, Athenian builders have an additional mixin for Athenian-only buildings: https://code.wildfiregames.com/source/0ad/browse/ps/trunk/binaries/data/mods/public/simulation/templates/mixins/civ/athen.xml

You can also add it to specific unit templates, like how the Roman Army Camp is listed at the top of the "Basic"-rank variant of the Roman units that can build it: https://code.wildfiregames.com/source/0ad/browse/ps/trunk/binaries/data/mods/public/simulation/templates/units/rome/infantry_swordsman_b.xml

 

Edited by s0600204
Clarify a point.
Link to comment
Share on other sites

Thank you for the quick reply!

 

14 minutes ago, s0600204 said:

/simulation/templates/mixins/builder.xml

!!! How could I have missed it?... :banger:

 

11 minutes ago, s0600204 said:

add it to specific unit templates, like how the Roman Army Camp is listed

Yes, that sounds better for this specific case.

Thanks, I'm back modding... :yahoo:

Link to comment
Share on other sites

Unrelated but won't spam the forum with new threads: It worked, I got my little palisade fort, and asked it to train a unit. It spawned an error like "WARNING: Trainer without Production Queue found: 13699." but apparently still started training that unit (according to the icon on top right of the screen). There is no queue shown for the building though.

This is the relevant tag in the building.xml:

<Trainer>
    <Entities datatype="tokens">
      units/{civ}/infantry_spearman_b
      units/{civ}/infantry_pikeman_b
      units/{civ}/infantry_maceman_b
      units/{civ}/infantry_axeman_b
      units/{civ}/infantry_swordsman_b
      units/{civ}/infantry_javelineer_b
      units/{civ}/infantry_slinger_b
      units/{civ}/infantry_archer_b
      units/{civ}/cavalry_javelineer_b
    </Entities>
</Trainer>

Pretty much vanilla, I don't see why it bugs.  :huh:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...