Jump to content

Script to modify unit stats by type


Recommended Posts

Hi everyone,

I don't really know what else is out there for this, but I recently tried to rebalance some of the 0AD features that seemed broken to me, and crawling through the unit xml directories and manually editing individual units isn't really my thing. So I wrote a bash script capable of rebalancing large portions of the game. It takes all the data in the public mod, and for each unit, it applies certain operations specific to unit types, such as: Increasing combat unit train time, increasing population cost of cavalry, ships, siege, and elephants, increasing combat unit move speed, decreasing building health... It's not really important what I did with the script, but it is important that anyone can try to rebalance and transform the gameplay with it. The mod I have created with the script plays quite differently from the original 0AD, and I quite like it, and I hope by giving others the opportunity to do the same, we will settle upon a more balanced and interesting game. With this script, doing all these things (and more), and doing them automatically is very easy, so I wanted to provide it for the use of the rest of the community.

I would like to mention that the script is written in bash, and does make use of several standard and nonstandard unix tools, including bc and xmlstarlet. xmlstarlet is very necessary because I needed a way to parse and edit the xml files automatically, but it is by no means a standard/common program, however it is relatively portable (ubuntu users take heart, it's in the repo).

To run the script, make sure you have bc and xmlstarlet, put it in the mods folder, and enter "bash modScript.txt" into the terminal.

It is very much a hack in a lot of ways, and I am still working on parsing the technology files (I am interested in bringing research times up, I would like it if more of the battles took place earlier in the game), so any suggestions/contributions are welcome.

modScript.txt

techScript.txt

Edited by cyruscousins
  • Like 1
Link to comment
Share on other sites

Very cool, this seems to be just about the same thing. I probably should have looked before writing one myself. However our dependencies are different, and your script seems to be intended to be interactive or at least built upon by othe scripts, whereas mine is very specific to the current setup of the 0AD unit files (eg I actually sort by unit type and call a different function for cavalry, infantry, siege ... where the actual parsing and changes are performed). So they are similar, but not the same.

Link to comment
Share on other sites

your script seems to be intended to be interactive or at least built upon by othe scripts

Neither, you just type the command and arguments at your terminal and things happen.

whereas mine is very specific to the current setup of the 0AD unit files (eg I actually sort by unit type and call a different function for cavalry, infantry, siege ... where the actual parsing and changes are performed). So they are similar, but not the same.

That sounds quite interesting. Mine simply uses the built-in classes in the entity XML files, yours sounds like it allows for more fine-grained changes.

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