Jump to content

Limiting how many of a specific unit you can train? (Like for heroes)


krt0143
 Share

Recommended Posts

I'm making some Mercenaries, but since they shouldn't be available in unlimited numbers like you own champions, I've tried to limit their numbers using the "hero" units' limit system.

So I added into their template this:

  <Identity>
    <VisibleClasses datatype="tokens">Ranged Archer</VisibleClasses>
    <GenericName>Elite Mercenary</GenericName>
  </Identity>
  <TrainingRestrictions>
    <Category>Elite Mercenary</Category>
    <MatchLimit>20</MatchLimit>
  </TrainingRestrictions>

Unfortunately, as long as they have that "TrainingRestrictions" part, I can't train a single of them!
The games states "You can train 20 of them" all right, but when I click on the icon nothing happens. It doesn't get added to the queue.

Now when I remove this "TrainingRestrictions" part, I can train them just fine, so it is clearly something about the "TrainingRestrictions" syntax I've missed.

Any ideas what it could be?  :blink:

Link to comment
Share on other sites

  • 2 weeks later...

So... I think I've observed that the entry in "template_player.xml" indeed limits how many you can have at a given time, but the "TrainingRestrictions" entry inside the unit file fixes the maximum amount you can train during the whole game session.

Is that true?  :huh:

 

I'm using it to manage my "mercs" (champion units I've built because Britons are champion-starved): There are several types (pikes, archers, siege) but to keep some balance, you can only have a limited amount of them at the same time: Their general limit is 20 mercs at any time, but you can buy 30 of each type (except siege, which is unique, like a hero unit), so you can mix & match depending on what you need: 20 archers, or 20 pikemen, or 10+10. It seems to work as intended, but I've not tested it really extensively either.

 

I'm wondering if I won't make all high grade (champion units) a limited resource (only x of them available during a game session). After all, populations were very limited back then, and highly trained/exceptional units were extremely rare and long to train. If you're being reckless, at some point you should run out of them.
Now of course the problem is the AI, if it can't handle that limitation it will eventually "run out" and become an easy prey. And I'm indeed afraid it can't handle it, having seen it waste its unique heroes unnecessarily, one after the other, for no purpose (once an AI hero unit attacked my fortress all alone, under the fire of 2 towers and the fortress itself. Needless to say it died...).
Now since I always play the same civilizations, I might do this just for my civilization, and let the AI wield its unlimited unit cornucopia as before. Hmm.

Link to comment
Share on other sites

4 hours ago, krt0143 said:

So... I think I've observed that the entry in "template_player.xml" indeed limits how many you can have at a given time, but the "TrainingRestrictions" entry inside the unit file fixes the maximum amount you can train during the whole game session.

Is that true?  :huh:

Right. Just use the player.xml class to restrict normally. Use the additional entry in the unit xml to restrict for whole match (if you want to. If you don't, then you don't need that line)

  • Thanks 1
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...