Jump to content

How to modify tower/wall placement rules?


ArferBrick
 Share

Recommended Posts

Hello, not sure if this is the right place to ask this question so please delete/move it if needed.

 

I simply want to be able to build walls and/or towers completely freely, anywhere on the map - ie totally disregarding the territory owner/terrain/range rules.

There must be a file somewhere that I can modify to simply disable checking, but I can't even find the game files!  I've read through a lot of tutorial pages and they all seem to mention a public folder but I can't find the right one (there's one in ~/.local/share/0ad/mods/public, and one in /usr/share/games/0ad/mods/ - but no files!).

 

If someone could kindly point me in the right direction I would be eternally grateful :).

Link to comment
Share on other sites

Just modify the templates.

 


  <BuildRestrictions>
    <Territory>own neutral ally</Territory>
  </BuildRestrictions>

 

Then add these to the template to stop the structures from losing loyalty and from casting a territory effect:

 


  <TerritoryDecay disable=""/>
  <TerritoryInfluence disable=""/>

 

 

If you want to do some moddding, I suggest you download svn version of game. It is developer version and all files are moddable. From there we can help you make a mod folder where you can put your new files into without worrying about mess up core game files.

Edited by wowgetoffyourcellphone
  • Like 4
Link to comment
Share on other sites

Thanks for the swift replies :).

A few more questions if I may -

1) All the game files are contained in /usr/share/games/0ad/mods/public/public.zip, correct?

2) Can I extract that entire zip file and run the game with it unzipped, or must I edit the files then re-zip it each time?

3) Which template file(s) do I edit?  I found some possible candidates in public.zip/simulation/components/ - BuildRestrictions.js, and WallPiece.js and WallSet.js - are they the correct files?

Sorry if they are stupid questions, but I'm not a programmer :o.

Link to comment
Share on other sites

Thanks a million for the info all :D

 

Here's what I did (in order to help other newbies save some time) -

I extracted the contents of /usr/share/games/0ad/mods/public/public.zip, then renamed the zip file to disable it.  Then I made a backup copy of /usr/share/games/0ad/mods/public/simulation/templates/template_structure_defense_wall.xml & template_structure_defense_wall_tower.xml & changed the following in each file:

Original -

<BuildRestrictions>
    <PlacementType>land-shore</PlacementType>
    <Category>Wall</Category>
  </BuildRestrictions>

To -

<BuildRestrictions>
    <Territory>own neutral ally enemy</Territory>
    <PlacementType>land-shore</PlacementType>
    <Category>Wall</Category>
  </BuildRestrictions>

..and added -

<TerritoryDecay disable=""/>
 <TerritoryInfluence disable=""/>

..at the end of each file, just before -

</Entity>

and saved the files.

It works, b̶u̶t̶ ̶I̶ ̶s̶t̶i̶l̶l̶ ̶c̶a̶n̶'̶t̶ ̶b̶u̶i̶l̶d̶ ̶i̶n̶ ̶e̶n̶e̶m̶y̶ ̶t̶e̶r̶r̶i̶t̶o̶r̶y̶ and rabbits and trees still get in the way -but that's a story for another day when I've got some time to waste.

All in all very happy with the result and many thanks for the help you all gave me.

 

Eventually I'll try to learn how to get the "git" version and play around with that, but for now my weekend is almost over and I just want to sit back and have fun with 0AD :D.

Cheers :)

 

EDIT:  Oh yes, and I just found out that I can add "enemy" to the list of territory restrictions, a̶n̶d̶ ̶t̶h̶a̶t̶ ̶y̶o̶u̶ ̶c̶a̶n̶ ̶m̶o̶d̶i̶f̶y̶ ̶t̶h̶e̶ ̶f̶i̶l̶e̶s̶ ̶o̶n̶ ̶t̶h̶e̶ ̶f̶l̶y̶ ̶-̶ ̶n̶o̶ ̶n̶e̶e̶d̶ ̶t̶o̶ ̶q̶u̶i̶t̶ ̶t̶h̶e̶ ̶g̶a̶m̶e̶ ̶a̶n̶d̶ ̶r̶e̶s̶t̶a̶r̶t̶ ̶a̶f̶t̶e̶r̶ ̶e̶a̶c̶h̶ ̶e̶d̶i̶t̶.

 

This game just gets better and better :D.

Edited by ArferBrick
added more info
  • Like 2
Link to comment
Share on other sites

ArferBrick, it's better to create a simple mod than to modify the public.zip.

A mod can overwrite any file in the public.zip by its own version, you only need to place a file with the same name and path in your mod. The advantage of making a mod is that it's clearly split from our code, and you can enable and disable it through the game.

The only thing you need to make a mod is a mod-description file (like public.json, but with altered parameters, take a look at some active mods to see the json file), and the files you want to overwrite.

 

Doing it like you do now is also possible, but will cause more problems when upgrading (an upgrade will replace the public.zip), and it will also not allow you to play multiplayer (you'll have a different version of the game, and will immediately get an out-of-sync error).

  • Like 3
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...