How to mod!... sorta!

Post your mods and custom content here

How to mod!... sorta!

Postby caprontos » Sun Apr 28, 2013 4:47 pm

To use a mod just find your .towns folder, mine is at: C:\Users\User\.towns

Note it is .towns... Not just the normal towns folder... In the folder you will see a save, bury and a mod folder... Just put the mod in that folder and extract it - and the option should appear in game.. under "mods" on the menu menu.. to turn it on/off.

As of v13 you can just open the mod menu in game and click the link at the top to go to your mod folder. So the above bit isn't as important but I'll leave it case someone needs it..

Once you turn it on it should apply it to your game and you don't have to anything else.

---------------------

Making a mod for yourself is also pretty easy.. Once you understand it.. First the mod structure.

To begin make a new folder in your mods folder.. Name it what you want the mod to be called.. And inside this folder make a new folder named data.


Image

As you ca see in the picture.. Basically your building the mod as if it were the towns folder that contains the normal xml's.. Xml's in the data folder go there, xml's in the campaigns folder would go in side there.. in side the data folder... the graphics.ini goes in the main folder with the data folder.. So if your not sure where a file gose, see where it is in the towns folder then duplicate that in your mod folder.

------------------

Alright.. now modding things that are already in the game.. You only need the things you want to change in your files..

Lets say we want to make wheat re-grow twice as fast.. you would create your mod folder.. then in that a data folder.. then in that an items.xml (saving a file as items.xml in something like notepad should make it an xml).

Then in the items.xml you would put this:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>

<items>
   <wheatseed>
      <maxAge>1d360+1080</maxAge>
   </wheatseed>
</items>



And that will change just the max age tag on wheat seed. There is no need to add the other tags your not changing if your only changing part of an item. This is the same for livings or any other xml.

If you wanted to remove surface enemies from your normal map you would create a mod folder - data - campaigns - c1 - normal...

Then in the normal folder make a gen_livingentities.xml

And put this in that xml:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<gen_livingentities>

   <delete id="werepig" />
   <delete id="froggy" />
   <delete id="toady" />

</gen_livingentities>



Basically if you want to remove anything.. All you need to do is use this delete id tag.
<delete id="whatyouwant"/>

This one should also work for the items.xml and livingentities.xml.. by using the items name (IE rmstone or spider)

To delete menus you use:

Code: Select all
    <log delete="true"/>


Changing log to the name of the menu you want to delete..

Also if you delete any items make sure the item removed is also removed from any and all actions that used it otherwise.. it'll make you crash looking for the item.. I think deleting an item is more to replace it entirely with an item of the same name.

You can also use:

Code: Select all
    <wooden deleteContent="true" />


Changing wooden to the menu name you want... to delete all the stuff inside a menu then you can make the menu in the order you want with out deleting the whole menu.
---
The game will load the default files first.. then your mods from the top of the list to the bottom - and it will overwrite any spots your mods do.. - if you have two mods that overwrite the same thing it will only use the last mods changes...

So make sure mods you create do not edit the same things.. So if you have a mod that makes wheat grow twice as fast then a mod that makes it grow slower second.. it will only make it grow slower.

--

Some dev posts on it can be found:
viewtopic.php?f=8&t=9257&start=20
Image
Cha Cha Cha!
User avatar
caprontos
 
Posts: 3930
Joined: Wed Apr 04, 2012 3:18 am

Re: How to mod!... sorta!

Postby JackPS9 » Tue Apr 30, 2013 1:47 pm

Any idea how to delete items?
JackPS9
 
Posts: 1088
Joined: Mon Sep 03, 2012 4:15 pm

Re: How to mod!... sorta!

Postby tom k. » Tue Apr 30, 2013 1:57 pm

Make a file names items.xml in you mod folder, then have the following:

Code: Select all
 <?xml version="1.0" encoding="UTF-8"?>
<items>
   <delete id="rmstone" />
</items>


I guess :)
Tom K.
Former Community Moderator


Please read the FAQs before posting.
Image
Towns' Official Modding Partner Site - Townsmods.net
tom k.
 
Posts: 1605
Joined: Wed Mar 28, 2012 7:22 pm
Location: Lincoln, UK

Re: How to mod!... sorta!

Postby JackPS9 » Tue Apr 30, 2013 1:59 pm

tom k. wrote:Make a file names items.xml in you mod folder, then have the following:

Code: Select all
 <?xml version="1.0" encoding="UTF-8"?>
<items>
   <delete id="rmstone" />
</items>


I guess :)

Items dont have IDs
Its the same with the menus.
JackPS9
 
Posts: 1088
Joined: Mon Sep 03, 2012 4:15 pm

Re: How to mod!... sorta!

Postby tom k. » Tue Apr 30, 2013 2:21 pm

I thought the ID referred to the tag name. So:

Code: Select all
<someitem>
    <name esES="XYZ">XYZ Item</name>
    <value>123</value>
</someitem>


is referred to simply by:
Code: Select all
<delete id="someitem" />
Tom K.
Former Community Moderator


Please read the FAQs before posting.
Image
Towns' Official Modding Partner Site - Townsmods.net
tom k.
 
Posts: 1605
Joined: Wed Mar 28, 2012 7:22 pm
Location: Lincoln, UK

Re: How to mod!... sorta!

Postby caprontos » Tue Apr 30, 2013 2:24 pm

tom k. wrote:I thought the ID referred to the tag name. So:

Code: Select all
<someitem>
    <name esES="XYZ">XYZ Item</name>
    <value>123</value>
</someitem>


is referred to simply by:
Code: Select all
<delete id="someitem" />


Yeah this should be right... for livings and items - just use the name of it. The id tags in the gen files I think is so we could easily pick out parts to delete..
Image
Cha Cha Cha!
User avatar
caprontos
 
Posts: 3930
Joined: Wed Apr 04, 2012 3:18 am

Re: How to mod!... sorta!

Postby JackPS9 » Tue Apr 30, 2013 2:26 pm

what about menus though?
JackPS9
 
Posts: 1088
Joined: Mon Sep 03, 2012 4:15 pm

Re: How to mod!... sorta!

Postby caprontos » Tue Apr 30, 2013 2:28 pm

JackPS9 wrote:what about menus though?


I added it to the main post from the dev posts..

--To delete menus you use:

Code: Select all
    <log delete="true"/>


Changing log to the name of the menu you want to delete..

You can also use:

Code: Select all
    <wooden deleteContent="true" />


Changing wooden to the menu name you want... to delete all the stuff inside a menu then you can make the menu in the order you want with out deleting the whole menu. --
Image
Cha Cha Cha!
User avatar
caprontos
 
Posts: 3930
Joined: Wed Apr 04, 2012 3:18 am

Re: How to mod!... sorta!

Postby madpainter » Wed May 01, 2013 1:50 pm

caprontos wrote:To use a mod just find your .towns folder, mine is at: C:\Users\User\.towns

Alright.. now modding things that are already in the game.. You only need the things you want to change in your files..

Lets say we want to make wheat re-grow twice as fast.. you would create your mod folder.. then in that a data folder.. then in that an items.xml (saving a file as items.xml in something like notepad should make it an xml).

Then in the items.xml you would put this:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>

<items>
   <wheatseed>
      <maxAge>1d360+1080</maxAge>
   </wheatseed>
</items>



And that will change just the max age tag on wheat seed. There is no need to add the other tags your not changing if your only changing part of an item. This is the same for livings or any other xml.


Holy crap, with this information my mods just become exponentially more compatible with everything, from other mods to future updates. The time I've wasted checking files for stuff I didn't want overwritten when I could have just booted up and played.
madpainter
 
Posts: 91
Joined: Sun Feb 03, 2013 2:18 am
Location: Inside my own head.

Re: How to mod!... sorta!

Postby Brigadon » Thu May 23, 2013 8:42 pm

how does the modloader prioritize mods?

for instance, if one mod shortened the growing time on wheat, and another altered it to increase the length of time it took to grow, which mod would be chosen last?
User avatar
Brigadon
 
Posts: 82
Joined: Tue May 29, 2012 12:41 am

Next

Return to Modding

Who is online

Users browsing this forum: No registered users and 6 guests

cron