Total War Center Forums  
<a href="http://www.game-advertising-online.com/" target=_blank>Game Advertising Online</a><br> banner requires iframes

Go Back   Total War Center Forums > Community News, Articles and Interviews > Scriptorium

Scriptorium Repository for TWC articles

Reply
 
Thread Tools Search this Thread
Soulghast
Old July 26, 2009, 05:37 PM / [Modding] Mines   #1
 
Soulghast's Avatar
RAWR!
 
Posts: 3,925
highpos ++++++++++++++


Author: EarendilElenthol
Original Thread: Mines

Mines In addition to the excellent tutorial of Mythic Commodore I would like to write a bit about mines. Mines are in many games one of the most important sources of income and you may want to play around with it.

First of all you need three files in which the mining issues are set:
-.../data/descr_sm_resources.txt
-.../data/export_descr_buildings.txt (and .../data/text/export_buildings for the implementation of new buildings)
-.../data/descr_settlement_mechanics.xml

descr_sm_resources.txt

This file describes the resources.
Spoiler Alert, click show to read: 
Code:
type                coal
trade_value            4
item                data/models_strat/resource_coal.CAS
icon                data/ui/resources/resource_coal.tga
has_mine

The first line is the type. You'd better leave this as it is, as it would require loads of changes in files you didn't know they even existed.
The second line is the value. All the income increases from trade are based on this value. This one can be changed without problems
The third line is the .CAS, that is, the picture on the stratmap. For editing this one, look for the tutorials around.
The fourth line is the icon that turns up in the trade menu of a settlement. This is a normal .tga file, so it is easy to edit with GIMP.
The fifth line is has_mine. This line is the line that is used for the mines in the EDB. If a resource can be mined, then this line needs to be added.

export_descr_buildings.txt
This file is the main file about buildings. In this are the two building trees of mines: hinterland_mines and hinterland_castle_mines.
The hinterland description makes that it can't be removed once it is built. That part can be left out to make it normal buildings.
The vanilla version reads:
Spoiler Alert, click show to read: 
Code:
building hinterland_mines
{
    convert_to hinterland_castle_mines
    levels mines mines+1 
    {
        mines city requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, }  and resource silver or resource gold or resource tin or resource iron or resource sulfur or resource marble or resource coal
        {
            convert_to 0
            capability
            {
                mine_resource 4
            }
            material wooden
            construction  2 
            cost  2000 
            settlement_min large_town
            upgrades
            {
                mines+1
            }
        }
        ....
        ....
    }
    plugins
    {
    }
}


It is just a normal building in setup, only a hinterland version.

The first you see is the marked green lines (scroll a bit to the right). These lines make it require a resource in the region. The resource doesn't need a has_mine entry, because it is just a definition of when the building can be build. The resource entries do NOT need to be added in some file (like descr_regions) other than the descr_strat on the map. The game will finds them itself.
This gives you more space in the hidden_resources.
You can always use a hidden resource (put in the hidden_resource line of the EBD) instead of a resource and make it dependant on your choices instead of the placement of resources on the map.

The second thing you need to know is the marked purple entry. This is the effect of the mines. It has an interesting and rather irritating working.
The income from the mining is (value in descr_sm_resources)*(value in descr_settlement_mechanics)*(value in EDB). This doesn't effect the trade_income as it is of an other type in your settlement income scroll.
You can make multiple entries with different requirements like:
Spoiler Alert, click show to read: 
Code:
            capability
            {
                mine_resource 3  requires resource iron and not resource gold and not resource silver and not resource tin and not resource slaves and not event_counter blast_furnace 1
                mine_resource 5  requires hidden_resource iron1 and not event_counter blast_furnace 1 
                mine_resource 5  requires resource iron and event_counter blast_furnace 1 
                mine_resource 8  requires hidden_resource iron1 and event_counter blast_furnace 1 
                mine_resource 3  requires resource coal and not resource gold and not resource silver and not resource tin and not resource slaves and not resource iron ;and not event_counter blast_furnace 1
                mine_resource 5  requires resource coal and event_counter blast_furnace 1 
                mine_resource 3  requires resource silver or resource gold or resource tin or resource slaves
            }

However, if you make such a requirement, keep in mind that you only check whether there is a resource, you're not putting the value only for that resource. The game lumps all the resources with a has_mine ability together and multiply them to the requested income sum. If you give e.g. salt the has_mine ability, it will be taken in in the equation of the mineable resources, because ALL has_mine resources are mined. Even if you wanted to make another mine specially for salt. It won't work if you let resource salt out of the requirements line of the building tree, because the game lumps them ALL.

This method works well if there is only one mineable resource or all the resources have the same mining value. Even when working with event_counters this won't be a problem.
The game checks for every line, so if you have iron and gold in an area, the effect without the "and not" will be a line with the amount of mine_resource 3 (condition iron is satisfied, so for every mineable resource the multiplier 3)
and then al line with the amount of mine_resource 3 again (condition gold is satisfied, so for every mineable resource the multiplier 3). That gives two times the amount you wanted instead of one.
This will get more problematic when you use different values. The two values will turn up based on two different multipliers. Again, the game lumps ALL the resources, so in this case the iron+gold will give an amount and the gold+iron will give an amount with a different multiplier.

You can use income_bonus instead of mine_resource, to work around this problem. But this will put the income in yet another type of the income building scroll.

descr_settlement_mechanics.xml is the last file we turn to.
There is an excellent tutorial about this file from Tsarsies.
In the vanilla file the entry we need is this:
Spoiler Alert, click show to read: 
Code:
      <factor name="SIF_MINING">
         <pip_modifier value="1.0"/>
      </factor>

According to the tutorial this gives a boost of 10%, in what I found it is only 5%. This value can be changed to get the effect of mining good with regards to the merchant value.

I'd like to thank the numerous posters on this issue from who I got my information. Especially Alpaca's, Tsarsies' and Mythic Commodore's posts were useful.
Any comments, idea's, questions and so on are welcome. I hope someone find a way to give every resource its own mine_resource value without affection all the others.
Ex-Curator
Under the Patronage of Perikles
Patron of Desperado † and Astaroth


R.I.P Calvin
Soulghast is offline  
Send a message via MSN to Soulghast
Reply With Quote
Reply

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

<a href="http://www.game-advertising-online.com/" target=_blank>Game Advertising Online</a><br> banner requires iframes

All times are GMT -5. The time now is 02:40 AM.


Forums powered by vBulletin® Version 3.8.3 - Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.