LordStark Posted June 12, 2022 Report Share Posted June 12, 2022 Hi team, I have really put a lot of effort in to trying to figure this out myself but I am at a complete loss and suspect what I want to do is impossible with the engine. As far as I can tell you can limit the number of times a unit can be built in a game. You can also make the unit a hero - resulting in it only being able to be built once. But you can't edit "hero" parameters. Even if you could modify hero and set population cap to 5, it would work across all the heros and so would limit you to 5 heros combined - rather than 5 of your particular unit. The problem is, I have the following units that I need to impose limits on: Lord x 1 (represents you, the player). Lessor Lord x 3 Bailiff x 2 Sheriff x 1 Lady x 1 ("marriage" upgrade for female citizen) Marshal x 1 Steward x 1 Master at Arms x 1 Captain of House Guard x 1 I don't mind not having the declared as a hero. I just need to find a way to limit the number of the units and have them able to be retrained if they day (actually all these units are appointed (upgraded) from elite citizens or Men at Arms (which are themselves appointed from citizens). Is there any way to do it? Quote Link to comment Share on other sites More sharing options...
Silier Posted June 12, 2022 Report Share Posted June 12, 2022 You need unique class for every one of them and put them under entitylimits in this file https://github.com/0ad/0ad/blob/master/binaries/data/mods/public/simulation/templates/template_player.xml Quote Link to comment Share on other sites More sharing options...
LordStark Posted June 12, 2022 Author Report Share Posted June 12, 2022 The problem I am having is that I can't find where to create a new class. I already have 9 unique units so if I was to use the default classes I would have very few left for normal units. Quote Link to comment Share on other sites More sharing options...
Silier Posted June 12, 2022 Report Share Posted June 12, 2022 You can just add any custom string ( e.g. MyNewCustomClass) you want into Classes or VisibleClasses in template of specific unit. For example like it is added here https://github.com/0ad/0ad/blob/master/binaries/data/mods/public/simulation/templates/template_unit_cavalry_ranged_crossbowman.xml Quote Link to comment Share on other sites More sharing options...
LordStark Posted June 12, 2022 Author Report Share Posted June 12, 2022 Thanks, this didn't work for me - and it actually prevented the game from starting. Can I just confirm that these are the only changes I need to make: So in my Vassal_b units file I put the following code: Quote <Identity> <GenericName>Cavalry Crossbowman</GenericName> <VisibleClasses datatype="tokens">Noble</VisibleClasses> </Identity> And then in templates\special\player\player I add: Quote <Limits> <Noble>3</Noble> <Animal>50</Animal> <CivilCentre>1</CivilCentre> <Gladiator>0</Gladiator> <Hero>1</Hero> <Juggernaut>1</Juggernaut> <Library>1</Library> <Lighthouse>1</Lighthouse> <Monument>5</Monument> <Palace>2</Palace> <Pillar>0</Pillar> <PyramidLarge>2</PyramidLarge> <TempleOfAmun>1</TempleOfAmun> <TempleOfVesta>1</TempleOfVesta> <Theater>1</Theater> <WarDog>20</WarDog> <Wonder>1</Wonder> </Limits> And this will result in me only able to appoint three Vassal Lords at a time? Please note the difference in file path (special/player/player) which I assume is because I have a different version of the game - Alpha 25. Quote Link to comment Share on other sites More sharing options...
Silier Posted June 12, 2022 Report Share Posted June 12, 2022 Can you share the whole vasal_b file? Also there should be interestinglog file with errors that should tell you what went wrong https://trac.wildfiregames.com/wiki/GameDataPaths Quote Link to comment Share on other sites More sharing options...
LordStark Posted June 12, 2022 Author Report Share Posted June 12, 2022 When I went to check the error logs they had already been cleared due to me starting the game after deleting the player file. The game is working again, so I made the adjustments again and the second time around the game started but the changes I made does not seem to limit the number of lords I can build. Vassal_b: Quote <?xml version="1.0" encoding="utf-8"?> <Entity parent="template_unit_infantry_melee_swordsman"> <Auras datatype="tokens"> units/heroes/anglo_loyalty </Auras> <Cost> <Population>1</Population> <Resources> <food>1000</food> <wood>1000</wood> <metal>1000</metal> <stone>1000</stone> </Resources> </Cost> <Attack> <Melee> <AttackName context="Name of an attack using a double-edged sword.">Sword</AttackName> <Damage> <Hack>2</Hack> </Damage> <MaxRange>3</MaxRange> <PrepareTime>375</PrepareTime> <RepeatTime>750</RepeatTime> <PreferredClasses datatype="tokens">Unit+!Ship</PreferredClasses> </Melee> </Attack> <Identity> <Civ>anglo</Civ> <SelectionGroupName>units/anglo/vassal_b</SelectionGroupName> <GenericName>Nobleman</GenericName> <SpecificName>Feudal Lord</SpecificName> <Icon>units/anglo_infantry_swordsman.png</Icon> <VisibleClasses datatype="tokens">Noble</VisibleClasses> </Identity> <ResourceGatherer disable=""/> <Promotion> <Entity>units/anglo/vassal_a</Entity> </Promotion> <Health> <Max>600</Max> </Health> <VisualActor> <Actor>units/anglo/vassal_b.xml</Actor> </VisualActor> <Resistance> <Entity> <Damage> <Hack>4</Hack> <Pierce>4</Pierce> </Damage> </Entity> </Resistance> <Population> <Bonus>10</Bonus> </Population> <Builder> <Rate>1.0</Rate> <Entities datatype="tokens"> -structures/{civ}/civil_centre -structures/{civ}/military_colony -structures/{civ}/house -structures/{civ}/storehouse -structures/{civ}/farmstead -structures/{civ}/field -structures/{civ}/corral -structures/{civ}/dock -structures/{civ}/barracks -structures/{civ}/stable -structures/{civ}/forge -structures/{civ}/temple -structures/{civ}/market -structures/{civ}/outpost -structures/{civ}/sentry_tower -structures/{civ}/defense_tower structures/{civ}/fortress -structures/wallset_palisade -structures/{civ}/wallset_palisade -structures/{civ}/wallset_siege -structures/{civ}/wallset_stone -structures/{civ}/wonder </Entities> </Builder> </Entity> And player: Quote <?xml version="1.0" encoding="utf-8"?> <Entity> <AttackDetection> <SuppressionTransferRange>80</SuppressionTransferRange> <SuppressionRange>160</SuppressionRange> <SuppressionTime>60000</SuppressionTime> </AttackDetection> <BattleDetection> <TimerInterval>200</TimerInterval> <RecordLength>12</RecordLength> <DamageRateThreshold>0.04</DamageRateThreshold> <AlertnessBattleThreshold>4</AlertnessBattleThreshold> <AlertnessPeaceThreshold>0</AlertnessPeaceThreshold> <AlertnessMax>8</AlertnessMax> </BattleDetection> <EntityLimits> <Limits> <Animal>50</Animal> <CivilCentre>1</CivilCentre> <Fortress>10</Fortress> <Gladiator>0</Gladiator> <Hero>1</Hero> <Juggernaut>1</Juggernaut> <Library>1</Library> <Lighthouse>1</Lighthouse> <Monument>5</Monument> <Palace>2</Palace> <Noble>2</Noble> <Lord>1</Lord> <Pillar>0</Pillar> <PyramidLarge>2</PyramidLarge> <PyramidSmall>4</PyramidSmall> <TempleOfAmun>1</TempleOfAmun> <TempleOfVesta>1</TempleOfVesta> <Theater>1</Theater> <Tower>30</Tower> <WarDog>20</WarDog> <Wonder>1</Wonder> </Limits> <LimitChangers> <Gladiator> <Amphitheater>15</Amphitheater> </Gladiator> <Juggernaut> <PtolemyIV>4</PtolemyIV> </Juggernaut> <Pillar> <Ashoka>5</Ashoka> </Pillar> </LimitChangers> <LimitRemovers> <CivilCentre> <RequiredTechs datatype="tokens">phase_town</RequiredTechs> </CivilCentre> </LimitRemovers> </EntityLimits> <Identity> <Civ/> <GenericName>Player</GenericName> <Classes datatype="tokens">Player</Classes> <Undeletable>true</Undeletable> </Identity> <Player> <BarterMultiplier> <Buy> <food>1.0</food> <wood>1.0</wood> <stone>1.0</stone> <metal>1.0</metal> </Buy> <Sell> <food>1.0</food> <wood>1.0</wood> <stone>1.0</stone> <metal>1.0</metal> </Sell> </BarterMultiplier> <SharedLosTech>unlock_shared_los</SharedLosTech> <SharedDropsitesTech>unlock_shared_dropsites</SharedDropsitesTech> <SpyCostMultiplier>1.0</SpyCostMultiplier> </Player> <ResourceTrickle> <Rates> <food>0.0</food> <wood>0.0</wood> <stone>0.0</stone> <metal>0.0</metal> </Rates> <Interval>1000</Interval> </ResourceTrickle> <Sound> <SoundGroups> <defeated>interface/alarm/alarm_defeated.xml</defeated> <defeated_ally>interface/alarm/alarm_defeated_ally.xml</defeated_ally> <defeated_enemy>interface/alarm/alarm_defeated_enemy.xml</defeated_enemy> <no_idle_unit>interface/alarm/alarm_no_idle_unit.xml</no_idle_unit> </SoundGroups> </Sound> <StatisticsTracker> <!-- The summary screen and lobby rankings expect these classes, but additional classes may be added. --> <UnitClasses datatype="tokens"> Cavalry Champion Domestic FemaleCitizen Hero Infantry Ship Siege Trader Worker </UnitClasses> <StructureClasses datatype="tokens"> Economic CivCentre Fortress House Military Outpost Wonder </StructureClasses> </StatisticsTracker> <TechnologyManager/> </Entity> Quote Link to comment Share on other sites More sharing options...
Silier Posted June 12, 2022 Report Share Posted June 12, 2022 Try to use Classes instead VisibleClasses Quote Link to comment Share on other sites More sharing options...
LordStark Posted June 12, 2022 Author Report Share Posted June 12, 2022 I tried: <Classes datatype="tokens">Lord</Classes> But it didn't work. As I am modding MilleniumAD, is there anyway I can check to ensure the Anglo saxon side is accessing the normal player file rather than something else? They only have a player_norse file - which I also edited to include lord and noble. If I recall correctly I have previously tried limiting the number of buildings in the player file and it did not work so I suspect the problem might be in the player file being in the wrong place or the wrong file... Quote Link to comment Share on other sites More sharing options...
Silier Posted June 12, 2022 Report Share Posted June 12, 2022 @Freagarachany idea why limits do not work? Quote Link to comment Share on other sites More sharing options...
Freagarach Posted June 12, 2022 Report Share Posted June 12, 2022 Where have you put your player.xml (in which (subfolder)? What happens if you change e.g. the limit of animals to 40, does that get picked up? Quote Link to comment Share on other sites More sharing options...
LordStark Posted June 12, 2022 Author Report Share Posted June 12, 2022 I put the file in millenniumad-master\simulation\templates\special\player I just limited the number of towers and that worked. Just not for units for some reason. Quote Link to comment Share on other sites More sharing options...
Freagarach Posted June 12, 2022 Report Share Posted June 12, 2022 So the number of heroes is also unlimited? Do you have a repo somewhere that we can take a look at? Quote Link to comment Share on other sites More sharing options...
LordStark Posted June 13, 2022 Author Report Share Posted June 13, 2022 The number of heros was limited. I fixed the problem by adding a training restriction to the Vassal_b unit template: Quote <TrainingRestrictions> <Category>Noble</Category> </TrainingRestrictions> 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.