Jump to content

How to add Mercenary to the village phase


vpereira
 Share

Recommended Posts

Hi, doing some experiments to try to understand how to mod, I was trying to add Mercenaries to the "cart" civilization already in the village phase. I was able to add it to the Town phase, But looking the templates "merc_inf" and "mercenary" it wasn't clear to me where I can change it.

 

I tried to add: 

Quote

<Requirements>
      <Techs datatype="tokens">phase_village</Techs>
  </Requirements>

To my simulation/templates/units/cart/infantry_swordsman_merc_b.xml but then when my Barrack is done, i get the following error:

 

Quote

 

ERROR: RelaxNGValidator: Validation error: units/cart/infantry_swordsman_merc_b:1: Did not expect element Requirements there

ERROR: RelaxNGValidator: Validation error: units/cart/infantry_swordsman_merc_b:1: Element Entity has extra content: Requirements

ERROR: RelaxNGValidator: Validation failed for '(null)'

ERROR: Failed to validate entity template 'units/cart/infantry_swordsman_merc_b'

ERROR: Errors executing script event "SimulationUpdate"

 

Removing the "Requirements" block everything works as expected, but I cannot build the mercenaries from the barracks in the village phase as I wanted... any hint?

 

Thank you!

Link to comment
Share on other sites

It failed again

 

 

Quote

 

WARNING: [ParamNode] Could not remove token 'phase_town' from node 'Techs'; not present in list nor inherited (possible typo?)

ERROR: RelaxNGValidator: Validation error: units/cart/infantry_swordsman_merc_b:1: Did not expect element Requirements there

ERROR: RelaxNGValidator: Validation error: units/cart/infantry_swordsman_merc_b:1: Element Entity has extra content: Requirements

ERROR: RelaxNGValidator: Validation failed for '(null)'

Looks like Requirements isnt allowed inside entity? My code looks like:

 

Quote

<?xml version="1.0" encoding="utf-8"?>
<Entity parent="merc_inf|template_unit_infantry_melee_swordsman">

  <Identity>
    <Civ>cart</Civ>
    <GenericName>Gallic Mercenary Swordsman</GenericName>
    <SpecificName>Gallikós Mistophorós</SpecificName>
    <SelectionGroupName>units/ptol/infantry_swordsman_merc_b</SelectionGroupName>
    <Icon>units//infantry_swordsman.png</Icon>
    <Requirements>
      <Techs datatype="tokens">-phase_town phase_village</Techs>
    </Requirements>
  </Identity>
  <Promotion>
    <Entity>units/ptol/infantry_swordsman_merc_a</Entity>
  </Promotion>
  <VisualActor>
    <Actor>units/carthaginians/infantry_swordsman_b.xml</Actor>
  </VisualActor>
</Entity>



 

Quote

 

 

Link to comment
Share on other sites

Since they come from the embassies, you could just let the embassies be built in p1. If you want them to be available from barracks, you will just need to add them to the barracks template.

also, what version is the mod for? I recall the ‘techs data type’ approach is new for a27/current version. So if you are using this approach for an a26 mod I think that causes the error “Did not expect requirements”.

for a26 I think you have to use requiredTechs or something similar 

Edited by real_tabasco_sauce
Link to comment
Share on other sites

@real_tabasco_sauce 

 

Quote

also, what version is the mod for? I recall the ‘techs data type’ approach is new for a27/current version. So if you are using this approach for an a26 mod I think that causes the error “Did not expect requirements”.

This can be indeed the problem. I'm looking up github master branch.. i should make sure I'm https://github.com/0ad/0ad/tree/A26. I think the idea of having the embassy is a valid one, if I just wanted to fix the problem. I want however to understand where the problem is coming.. I don't know which parent from mercenaries is limiting it to the phase town.

Quote

<Trainer>
    <BatchTimeModifier>0.8</BatchTimeModifier>
    <Entities datatype="tokens">
      units/cart/infantry_swordsman_merc_b
      units/cart/infantry_archer_b
      units/cart/infantry_spearman_b
    </Entities>
  </Trainer>

That's what I have on my barracks.. Without the Requirements block, it works as expected, I can train it in the Town phase, but not in the Village phase

Link to comment
Share on other sites

I see now, thank you for the hint.. in the A26, we have the following:

 

Quote

<Identity>
    <Civ>ptol</Civ>
    <GenericName>Gallic Mercenary Swordsman</GenericName>
    <SpecificName>Gallikós Mistophorós</SpecificName>
    <SelectionGroupName>units/ptol/infantry_swordsman_merc_b</SelectionGroupName>
    <Icon>units/cart_infantry_swordsman.png</Icon>
    <RequiredTechnology>phase_town</RequiredTechnology>
  </Identity>

 

Quote

<RequiredTechnology>phase_town</RequiredTechnology>

Is what I was looking for

  • Like 2
Link to comment
Share on other sites

Unfortunately, didn't work out. If I drop the "merc_inf" mixin from the parent, and have 

Quote

<Entity parent="template_unit_infantry_melee_swordsman">

instead of 

Quote

<Entity parent="merc_inf|template_unit_infantry_melee_swordsman">

 

Then I'm able to train the mercenary in the barracks. However looking the mixins merc_inf.xml and mercenary.xml, I dont see what could be enforcing the "phase_town" ? I'm running version A26.

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...