Page 1 of 2 12 LastLast
Results 1 to 20 of 35

Thread: How to Edit Trade Resources

  1. #1

    Default How to Edit Trade Resources

    Playing the vanilla game with the existing trade resources is fine as far as gaming goes, but to achieve "total realism" several of the trade resources need to be modded, both in terms of location and the resources themselves. Location is easy to change -- simply alter the x,y coordinates in the descr_strat.txt file (or make new entries in imitation of the existing ones).

    Changing the resources themselves is more of a challenge. The master file here is descr_sm_resources.txt, which is found in the "text" subfolder of the "data" folder. This file will allow you to do three things:

    1) Change the base value of each resource
    2) Change the graphic for that resource that appears on the campaign map
    3) Change the icon for that resource that appears in the trade summary chart for each settlement

    #1 is quite easy just by looking at the text file. The higher the number assigned, the higher the base value (Gold has a high value, around 22, while more common resources are around 5). No big challenge here.

    For #2 and #3, I decided to change sulfur to salt. (Sulfur later became an important industry in Sicily, but only really took off in the 17th century when mass production of firearms became common. Salt, on the other hand, was a major trade item in medieval times and a significant basis for the prosperity of Venice, Salzburg, Mallorca, Provence, Lubeck, and several other places).

    The practical advantage of this transition is that the game graphics for sulfur are both piles of yellow powder, and this can be fairly easily changed into piles of white powder. To do this, went into the original (unmodded) "data" folder to retrieve three files:

    a) under data/ui/resources, I grabbed the resource_sulfur.tga file. This is the icon that appears in the trade window. I opened it in Photoshop and turned it into a greyscale ("remove color"). Then I saved this file as resource_salt.tga in my mymod folder under mymod/data/ui/resources (had to create new folders to do this).

    b) under data/strat_models, I grabbed the resource_sulfur.cas file. I saved this under mymod/data/strat_models as resource_salt.cas.

    c) under data/strat_models/textures, I grabbed the corresponding texture dds file for sulfur. I opened this in Photoshop (using the dds plugin), and again I removed color. I also had to brighten the image to make it closer to white. Then I saved the file UNDER ITS ORIGINAL NAME (sulfur) under mymod/data/strat_models/textures. It must be saved under its original name, unless you go in and change the .cas file, because the .cas file is still going to look for something called "sulfur" to grab the texture it needs.

    Then you go back into descr_sm_resources.txt and change the links under that resource to call up the modded files. You must add mymod/ (or whatever name you are using for your mymod folder) to the beginning of the addresses, so it knows to look for the modded files in the mod folder. Otherwise it will look in the original data folder and call up the unmodded files or (if you've changed the file names, like I did) nothing. So, for example, the icon address would be mymod/data/ui/resources/resource_salt.tga. Make sure you keep the tga and cas files clear in your mind. The tga is the trade window icon, the cas refers to the campaign map graphic. In fact, it is best to mod these links one at a time so if there is any problem you can isolate the cause.

    When you load the game now, if everything has been put in its proper folder and the links changed correctly, you should see a pile of white powder on both the campaign map and the trade window. However, you will see that it is still named "sulfur". To change this, you need to mod two strings.bin files, and here's how:

    Download pmcorp's strings.bin editor, which can be found at:
    http://www.twcenter.net/forums/downl...do=file&id=993

    This is a lifesaver. Now backup two files in your original data folder, strat.txt.strings.bin and tooltips.txt.strings.bin. Open strat.txt.strings.bin using pmcorp's editor. Find the line where it says "Sulfur," select it, and edit it to say "Salt", then save under mymod/data/text. Please not that although you may have an unconverted strat.txt file, changing this will not be reflected in the game, because this file does not self-generate a strings.bin file in the mymod folder, and when the game doesn't find a strings.bin in the mymod folder, it goes looking in the unpacked files. You must copy a modded string.bin file directly into your mymod folder for the edit to take hold.

    Go through the same process with the tooltips.txt.string.bin file. Note that we were never given an unconverted text file for this, nor does alpaca's converter appear to work. You must mod this directly using pmcorp's tool. Change "Sulfur - a valuable trade resource" so it says "Salt - a valuable ..." instead. Now save it to mymod/data/text.

    You should be done. When you load the game, you should see white piles that say "salt", both on the campaign map and the trade window.

    You can also edit trade resources by introducing .cas, texture, and .tga files from RTW. For instance, I replace coal (which was not really traded long distances in the middle ages) with glass (which was) by adding the graphic files for glass from RTW. You may need to unpack your pack files in RTW to access all of the required files.

    Presumably someone who is much better than I am at 3-D modeling and texturing could create entirley new .cas models for new resources. But the RTW files offer a pretty good starting pool of easily modable graphics.

    Note that M2TW has three resources -- elephants, dogs, and camels -- which appear not to have any game function. Presumably these too can be modded into new resources. I am not sure whether the game allows you to add completely new resource on top of these, however. At the very least, this would require access to an uncoverted tooltips.txt file, in order to create the links between the tooltip entry and the underlying resource code. I won't bother to try for now.

  2. #2

    Default Re: Tutorial: How to Edit Trade Resources

    I didn't want to clutter the tutorial, but I have one request. I am trying to change one of the unused resources into "paper". Originally, I tried to create the campaign map graphic by taking the RTW "silk," greyscaling and reducing contrast on the texture. But alone of all the RTW resources, I can't get silk (even with the .cas renamed so-as to avoid confusion with the M2TW silk) to work. When the campaign files load it just hangs, which seems to happen when the game can't find the right texture file. This was kind of an imperfect solution anyway, what I'd really like is a custom-made set of paper icons and graphics. If anyone is good at 3-d max, perhaps they might be interested in doing what should be a pretty quick project. Any takers?

  3. #3

    Default Re: Tutorial: How to Edit Trade Resources

    i cant find the file descr_sm_resources.txt not even when i use the find option im i doing something wrong ?

  4. #4

    Default Re: Tutorial: How to Edit Trade Resources

    You have to unpack first.

  5. #5

    Default Re: Tutorial: How to Edit Trade Resources

    unpack it from were ?????????


    P.S. could you help me to find a tutorial for changing the value price for products ? and changing the world map ????????????????? plz help me

  6. #6
    kleemann's Avatar Libertus
    Join Date
    Jan 2006
    Location
    In EU (Estonia)
    Posts
    74

    Default Re: Tutorial: How to Edit Trade Resources

    well, i tred to add totally new ressource but the game crashes. Error log says

    09:42:42.203 [script.err] [error] Script Error in data/descr_sm_resources.txt, at line 141, column 21
    dont recognise this resource type pottery

    trade_value 8

    item data/models_strat/resource_pottery.CAS

    icon data/ui/resources/resource_pottery.tga



    ; DO NOT ADD THE FOLLOWING RESOURCE TO THE CAMPAIGN MAP. GENERIC RESOURCE USED TO REPRESENT GENERIC TRADE PIP IN TRADE SCROLL

    type generic

    trade_value 0

    item data/models_strat/resource_dogs.CAS ; NOT ACTUALLY USED

    icon data/ui/resources/resource_trade_goods.tga


    I have made all entryes, CA did it wrong if they hardcoded ressources number it.
    Trading tip: Load your mercants on your (crapy, cheap upkeep) unit and place that crapy unit on the valuable trade ressource. All will earn money on that single ressourec AND other merchants can't do anything! ha:ha

    BUT it has bad side efect, if the unit rebel you will lose your merchants :hmmm:

    How-to: edit battle_model.modeldb to add new animations and skins.

  7. #7
    Kivals's Avatar Libertus
    Join Date
    Feb 2007
    Location
    Russia, Moscow
    Posts
    62

    Default Re: Tutorial: How to Edit Trade Resources

    Quote Originally Posted by vindex246 View Post

    1) Change the base value of each resource
    2) Change the graphic for that resource that appears on the campaign map
    3) Change the icon for that resource that appears in the trade summary chart for each settlement

    #1 is quite easy just by looking at the text file. The higher the number assigned, the higher the base value (Gold has a high value, around 22, while more common resources are around 5). No big challenge here.
    Well, its not so easy at all.
    Starting with the england i've tried to modify several values, particulary wool as its one of the most important england resource for that ages (you now that the head of the britain parlament still sits on the pack of wool as a tradition). Well starting a new game i saw the wool price increases but not the way i expected. Than i started the comparison of the available near my starting position resources with the trade values in the file... well there was no similarity at all. Some resources with equal values in the file cost different prices in the map, some (like a fish) with overall low value 4 costs greater than the wool with overall value 15. Well than i decided that the difference is in the resource type too.
    With a series of experiments quite strange things appeared.
    First (and not strange at all) the resources on enemy or other faction territory without a trade agreement cost exactly the price on your territory (other faction with the trade agreement) - 25%. Well it works that way if the number of reduction (25%) is not an integer (as always for the low modificators in the descr_sm_resource.txt file (dsr further) )
    than this reduction is rounded to the closest integer to the minimum of 1, when this reduction equals 'something' and a half (like a 2.5) well it wil be decreased to 'something' (2). I figured it out quite clear see below.
    I started with the file values 1 for all the resources in dsr and again with england merchant with a 1 finance.
    Investisating as many resources as i can on the first turn i've got the following picture (further the first price is trade agreement territory second - without it)
    iron 4 3
    timber 3 2
    dyes 2 1
    wine 4 3
    furs 5* 4
    fish 5* 4
    wool 2 1
    coal 5 4
    textiles 2* 1
    tin 2 1
    silver 5* 4

    Well it is very well agreed with the sugestions of a resource type importance and a -25% concept. * marks the prices that i sugested because i cannot made the trade agreements with the rebellion territory and the longer investigation is not the one i've planed out.
    The second stage is with values 2 for all the resources in dsr
    iron 8 6
    timber 6 5
    dyes 3 2
    wine 8 2
    furs x* 10
    fish x* 10
    wool 3 2
    coal 10 7**
    textiles x* 3***
    tin 3 2
    silver x* 11***
    Again x* - is what i cannot get on the first turn and for that moment i decide to make no suggestions only clear facts as i noticed the values marked with the ** and ***.
    First fact the numbers in the dsr file were somewhat not simple multipliers see below or at least the results of multiplication were different .
    Second - ** value for coal works against my -25% concept at least against the rules of rounding the value ... but i suggested that its not so simple. I thought that both values - your and enemy price are first calculated and than rounded to the closest so that coal "your price" was a bit higher than 9.5 and its "enemy" price a bit lower 7.5.
    Third - *** marks that the silver (textile) with the same first round experiment price as a furs or fish (dyes wool tin) costs greater than them in the second round. So i suggested that the numbers in file nevertheless are simple multipliers but the type values are not integers so the problem was in the round procedure.
    To ensure my suggestions and to gain more accurate results of rounding the next step was 100
    iron 386 290 =386-96 386/4=96,5
    timber 306 230 =306-76 306/4=76,5
    dyes 150 112 =150-38 150/4=37,5
    wine 405 304 =405-101 405/4=101,25
    furs x* 512
    fish x* 505
    wool 150 112 =150-38 150/4=37,5
    coal 495 372 =495-123 495/4=123,75
    textiles x* 146
    tin 150 112 =150-38 150/4=37,5
    silver x* 542

    There is still some inaccurate rounding but there is no problem to me as the main concept was correct and you can see the there is a variety of prices. But i was a little bit disapointed with the similarities of the wool tin and dyes prices so i decided to multiply by thousand and YES!!! to get all the resources near me and on my and rebellion territory. As it was not important to that moment i do not mention that i carried out all of the experiments on the big map ext (thanks Spurius) from the deus lo vult mod (thanks Der Drakken and others involved) well i've modified the resource location and set the base trade value to 1000.
    it was no similarities at all!!!!! some bugs may be but see below
    gold 1500
    silver 1500
    fish 1500
    furs 1500
    grain 1500
    timber 1500
    iron 1500
    ivory 1500
    wine 1500
    slaves 1500
    chocolate 1500
    marble 1500
    textiles 1500
    dyes 3000
    tobacco disapears
    silk 3000
    sugar 3188
    sulfur 3544
    tin 3000
    spices 3984
    cotton 4219
    amber 4472
    coal 4744
    wool 3000

    The enemy price was exactly 25% lower
    What does this result mean? I do not know... But there are several suggestions.
    First - may be the order they mentioned in the desr_strat.txt is important.
    Second - may be their availability to my faction is important (seems no).
    Third (and most approved) maybe their location in my factions capital region affects their value. Remember tin, wool and dyes from the third experiment? they all are in london region. The resources in the last table were located in a vertical line from the south england cost to the notingham region and begining from the tobacco they were already out of london region - so their price started to growth according their appearance in the decsr_strat.txt, except the DYES TIN and WOOL - that were already in the capital region (originally) and so they are out of the row of increased prices.
    What next? I don't now.
    If there is any volunteers you are welcome.
    But if you want to modify the prices remember that difference and try to take it in consideration.

  8. #8

    Default Re: Tutorial: How to Edit Trade Resources

    Quote Originally Posted by vindex246 View Post

    To change this, you need to mod two strings.bin files, and here's how:

    Download pmcorp's strings.bin editor, which can be found at:
    http://www.twcenter.net/forums/downl...do=file&id=993

    This is a lifesaver. Now backup two files in your original data folder, strat.txt.strings.bin and tooltips.txt.strings.bin. Open strat.txt.strings.bin using pmcorp's editor.
    It seems that pmcorp's strings.bin editor doesn't work well with all untagged text files. and strat.txt.strings.bin and tooltips.txt.strings.bin. are both untagged. i cannot open these two files with this editor. each time when i tried to open any untagged file there is always a pop-up window like the first pic.

    and what's more, even u can manage to alter the resource's name in both files u mentioned, u will find that still there is a place in game remains the original name, the red squared place on the the second pic ( when u double click a resource-controlling merchant, u can get this window). i tried several times to change this place but failed, and donot know how to change the resource's name here.
    Last edited by rogertri; February 28, 2007 at 02:01 PM.

  9. #9

    Default Re: Tutorial: How to Edit Trade Resources

    Is there any way to somehow build a mine on, say, a fish resource? It might sound weird, but I'm trying to change the fish resource into mercury and I was wondering how to be able to build a mine and extract it. I tried going into export_descr_buildings, and it gives me the option of building the mine in the game, but once its built, it doesn't show up on the main map, and I don't get the extra florins for it. I'm obviously missing a step, but I can't find out what it is, so I would greatly appreciate if someone could point me in the right direction.

    PS I'm new to this forum, and I tried searching for the solution and I couldn't find it. I apologise if the answer has already been posted somewhere. Any help would be appreciated.
    Last edited by Masterfod; August 12, 2007 at 04:47 PM.

  10. #10
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: Tutorial: How to Edit Trade Resources

    Was there any news on pmcorp's editor? It doesn't edit either strat or tooltip textfiles.


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  11. #11
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,097
    Blog Entries
    35

    Default Re: How to Edit Trade Resources

    Quote Originally Posted by vindex246 View Post
    Note that M2TW has three resources -- elephants, dogs, and camels -- which appear not to have any game function. Presumably these too can be modded into new resources. I am not sure whether the game allows you to add completely new resource on top of these, however. At the very least, this would require access to an uncoverted tooltips.txt file, in order to create the links between the tooltip entry and the underlying resource code. I won't bother to try for now.
    They don't have a trade value, I assume they were to be linked to recruitment via EDB requirement conditions, similar to the hidden_resource principle.

    Some late comments:
    • Each instance of a grain resource in a region will increase the fertility level, use with caution.
    • The number and data name of the trading resources is hard coded, which means there can be no other resources and you will be restricted to the editing of them as described in this tutorial.










  12. #12
    Titus le Chmakus's Avatar Biarchus
    Join Date
    Aug 2014
    Location
    Skiing on the Spine of the World or hunting in Lurkwood
    Posts
    648

    Default Re: How to Edit Trade Resources

    Hi

    The link to the editor is dead ...

  13. #13
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,097
    Blog Entries
    35

    Default Re: How to Edit Trade Resources

    Use this one. Simply 'open' the bin file with it and 'export' as text file with the same name into the same directory- it's easier to work with the txt file. The bin file gets generated automatically at game start every time you edit the txt file.

    To edit the battle, strat, shared and tooltips files download them here as converted txt files.










  14. #14
    Titus le Chmakus's Avatar Biarchus
    Join Date
    Aug 2014
    Location
    Skiing on the Spine of the World or hunting in Lurkwood
    Posts
    648

    Default Re: How to Edit Trade Resources

    Thanks, it worked.

    Now another problem, only the half of my resources appear on the strat map ... I mean on all the .CAS files from vanilla only 10 do actually work and appear. Is it normal ?

  15. #15
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,097
    Blog Entries
    35

    Default Re: How to Edit Trade Resources

    You may have a spelling or formatting mistake in descr_strat. eg elephant instead of elephants, maybe missing commas. The complete syntax is this:

    resource [resource name], x, y










  16. #16
    Titus le Chmakus's Avatar Biarchus
    Join Date
    Aug 2014
    Location
    Skiing on the Spine of the World or hunting in Lurkwood
    Posts
    648

    Default Re: How to Edit Trade Resources

    Weird, I checked and nothing is wrong. I quote them from the descr_sm_resources to be sure I wasn't doing any mistake. The game picks them there doesn't it ? I mean, I have changed the name in the strat.txt file and tooltips.txt. But I still have to name them as in vanillia, or do IU have to use the new name ? Ex. coal is now gems ...

    I've palced them all each along others to check how they are looking like and most of them do not appear ... But some do !?

  17. #17
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,097
    Blog Entries
    35

    Default Re: How to Edit Trade Resources

    The 'data' name remains the same. Can you post the descr_strat section that you set up to check the display? Wrap it into code tags to preserve formatting: go into 'go advanced' edit mode, then highlight the text and press the button with the hash sign (#)










  18. #18
    Titus le Chmakus's Avatar Biarchus
    Join Date
    Aug 2014
    Location
    Skiing on the Spine of the World or hunting in Lurkwood
    Posts
    648

    Default Re: How to Edit Trade Resources

    Code:
    I know how to code ;-)
    Code:
     
    ;    Calimport
    resource    gold,     150,    34
    resource    silver    155,    38
    resource    iron    152,    34
    resource    tin        156,    38
    resource    coal    154,    34
    resource    marble    159,    38
    resource    timber    156,     34
    resource    sugar    160,    38
    resource    elephant    158,    34
    resource    wool    159,     34
    resource    fish    160,     34
    resource    camels    150,    33
    resource    textile    151,    33
    resource    spices    152,    33
    resource    furs    153,     33
    resource    tobacco    154,     33
    resource    wine    155,     33
    resource    grain    156,     33
    resource    sulfur    157,    33
    resource    cotton    158,     33
    resource    dyes    159,    33
    resource    slave    160,     33
    resource    chocolate    150,     32
    resource    ivory    151,     32
    resource    silk    152,     32
    resource    amber    153,     32

  19. #19
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,097
    Blog Entries
    35

    Default Re: How to Edit Trade Resources

    Right, here is the complete list of valid resources - you forgot dogs. You also had two spelling mistakes.
    gold
    silver
    iron
    tin
    coal
    marble
    timber
    sugar
    elephants
    wool
    fish
    camels
    textiles
    spices
    furs
    tobacco
    wine
    grain
    sulfur
    cotton
    dyes
    slaves
    chocolate
    ivory
    silk
    amber
    dogs
    I can't see any identical co-ordinates (stacking), but the code appears to use spaces instead of tab between the entries, should be like this:
    resource[TAB]gold,[TAB]150,[TAB]34










  20. #20
    Titus le Chmakus's Avatar Biarchus
    Join Date
    Aug 2014
    Location
    Skiing on the Spine of the World or hunting in Lurkwood
    Posts
    648

    Default Re: How to Edit Trade Resources

    Well it seems something is really bugged as some .CAS simply do not work. I managed to have some more to appear, but not all of them !?

    Anyway, I have another question : is it possible to forbid slavery in some factions ? Because I have some "Good" factions where slavery is forbidden, next to others where it is allowed and the "Good" ones have slaves in their import/export pannel.

    Thanks

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •