vpereira Posted November 23, 2023 Report Share Posted November 23, 2023 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! Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted November 23, 2023 Report Share Posted November 23, 2023 Perhaps: <Requirements> <Techs datatype="tokens">-phase_town phase_village</Techs> </Requirements> Remove the old requirement too. May work 1 Quote Link to comment Share on other sites More sharing options...
vpereira Posted November 23, 2023 Author Report Share Posted November 23, 2023 Thank you @wowgetoffyourcellphone! Question, I couldn't find in which parent it is defined at all.. and I thought that just adding it to my instance, would "monkey patch" (overwrite) the previous definition no? Quote Link to comment Share on other sites More sharing options...
vpereira Posted November 23, 2023 Author Report Share Posted November 23, 2023 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 Quote Link to comment Share on other sites More sharing options...
real_tabasco_sauce Posted November 23, 2023 Report Share Posted November 23, 2023 (edited) 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 November 23, 2023 by real_tabasco_sauce Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted November 23, 2023 Report Share Posted November 23, 2023 Ah yes. In SVN, tech requirements are moved to their own component. Just move this out of Identity: <Requirements> <Techs datatype="tokens">phase_village</Techs> </Requirements> 1 Quote Link to comment Share on other sites More sharing options...
vpereira Posted November 23, 2023 Author Report Share Posted November 23, 2023 @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 Quote Link to comment Share on other sites More sharing options...
vpereira Posted November 23, 2023 Author Report Share Posted November 23, 2023 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 2 Quote Link to comment Share on other sites More sharing options...
vpereira Posted November 24, 2023 Author Report Share Posted November 24, 2023 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.