Page 1 of 4 1234 LastLast
Results 1 to 20 of 65

Thread: Lesson 4 Part 1 Buildings

  1. #1
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Lesson 4 Part 1 Buildings

    Now we are going to add buildings, guilds, traits, ancillaries, and triggers to our little mod.


    Buildings are separated into "trees". A tree is simply a collection of buildings all related to each other that progress from lowest to highest in a strait line. You have to have A before you can build B before you can build C and so on. There can bea maximum of 128 trees with 9 buildings each, which gives you a maximum of 1152 buildings. Most mods will not even come close to that as many trees do not reach the maximum of 9 buildings.


    We will be working with the following files. Copy the vanilla files into your mod folder:
    export_descr_buildings.txt
    export_descr_buildings_enums.txt
    descr_building_battle.txt
    descr_building_battle_enums.txt
    In the text folder, convert them first:
    building_battle.txt
    export_buildings.txt
    export_descr_guilds.txt




    Before we create a new building it is best to decide how many levels there are going to be. I am going to create a Goldsmith with levels, Apprentice and Master. The easiest thing to do is find a tree with the same number of levels as you want to create and copy it, then change what you need to change. I am using bank as my template, simply because it has fewer units to remove than some of the others with 2 levels. Here is the original code:
    Spoiler Alert, click show to read: 
    Code:
    building bank
    {
        levels merchant_bank merchant_vault 
        {
            merchant_bank city requires factions { hre, venice, milan, } 
            {
                capability
                {
                    trade_base_income_bonus bonus 2
                    agent_limit merchant 1
                }
                material wooden
                construction  4 
                cost  4800 
                settlement_min large_city
                upgrades
                {
                    merchant_vault
                }
            }
            merchant_vault city requires factions { hre, venice, milan, } 
            {
                capability
                {
                    trade_base_income_bonus bonus 3
                    agent_limit merchant 2
                }
                material wooden
                construction  6 
                cost  9600 
                settlement_min huge_city
                upgrades
                {
                }
            }
        }
        plugins 
        {
        }
    }



    This line simply names the tree. I used roads for this example because of the hinterland tag. Each tree name must be unique, and to keep things clean you should never have a level name the same as the tree name. The hinterland_ tag on the front end prevents the building from being destroyed by the player and is optional:
    Code:
    building hinterland_roads


    This tells the game which tree to reference when the settlement is converted from city to castle. To use this feature you will have to build two trees, one for the city level and one for the castle level.
    Code:
    convert_to hinterland_castle_roads


    This line defines the levels, from lowest level to highest.
    Code:
    levels roads paved_roads


    This is pretty self explanatory. The building can only be built in a city, and only by the listed factions and cultures.
    Code:
    roads city requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, }


    This tells the game which entry in the tree named above to convert the building to. Note that it says 0, which is the first entry. Another case of starting counting at 0 instead of 1. Remember that as it will save you hours of headache later.
    Code:
    convert_to 0


    This defines what bonuses/penalties the building gives you. These are all listed in the Building Traits section of the M2TW Ultimate Docudemons, with examples of how they are used. Anything that says bonus can also be a negative bonus.
    Code:
                capability
                {
                    road_level 0
                }


    This section defines the specifics of the building. I believe the material relates to how easily the building is damaged in the battle map, the rest is obvious.
    Code:
                material wooden
                construction  1 
                cost  400 
                settlement_min town


    Here is where you define the next building in the tree. As far as I know you cannot mix the tree up, you have to list the next level.
    Code:
                {
                    paved_roads
                }



    After that is the next level entry. At the end of all the levels there is a section called plugins. We will be leaving these empty for this course, but you can specify other buildings here. Basically what this does is apply a bonus from another building tree to this tree. There is some information on that here.



    Decide what you are going to name your buildings, and start replacing text. Just change the name at first, and I always set the requries factions to all like this:
    Code:
    apprentice_gsmith requires factions { all, }


    Once you get your new building to show up in the game you can tweak it. Here is my code. Note that I removed the convert_to lines and also that it doesnt speficy city or castle. You can do this if you want the building available in both types of settlement:
    Spoiler Alert, click show to read: 
    Code:
    building goldsmith
    {
        levels apprentice_gsmith master_gsmith
        {
            apprentice_gsmith requires factions { all, } 
            {
                capability
                {
                    trade_base_income_bonus bonus 3
                }
                material wooden
                construction  1 
                cost  500
                settlement_min town
                upgrades
                {
        master_gsmith
                }
            }
            master_gsmith requires factions { all, } 
            {
                capability
                {
                    trade_base_income_bonus bonus 3
                }
                material wooden
                construction  6 
                cost  9600 
                settlement_min huge_city
                upgrades
                {
                }
            }
        }
        plugins 
        {
        }
    }




    Now you need to add the text that shows up in game, in export_buildings.txt. If you notice you can create an entry for each culture, so that all cultures have a different description. This is useful because if you have two very different buildings but they have the same capabilities you can just name them differently and save on your building slots. For instance You can create generic_building_1 and give it an income_bonus of 2. Then in the descriptions file you could call it journalist for the northern_european culture and scribe for the middle_eastern culture with two very different descriptions by just appending the culture_name after the building_name. If all you put in the file is the building_name then all cultures will have the same description. The roads and farms and some of the guilds are done this way. For the purposes of the class all that is required is a single description.
    Code:
    {apprentice_gsmith}Apprentice Goldsmith
    {apprentice_gsmith_desc}A jeweler for the masses that creates simple rings, necklaces, and other small items made from gold. One say he aspires to become a Master Goldsmith.
    {apprentice_gsmith_short}A basic goldsmith capable of simple jewelry. Provides an income bonus.
    {master_gsmith}Master Goldsmith
    {master_gsmith_desc}A Master Goldsmith capable of doing any gold work you require.
    {master_gsmith_desc_short}A Master Goldsmith. Provides an income bonus.


    This will get the building in game, but it will show up as a barracks from RTW. This is because we havent given the building an image yet.
    Spoiler Alert, click show to read: 




    To give the building an image we need to create some folders. In the data folder create a folder named ui
    Inside the ui folder create a folder for each culture you want to have the building, northern_european, southern_european, etc
    Inside each culture folder create a folder named buildings
    Inside the buildings folder create a folder named construction
    Then you need 2 images for each building inside the building folder, with the culture name on the front.
    #northern_apprentice_gsmith.tga
    #northern_apprentice_gsmith_constructed.tga
    #northern_master_gsmith.tga
    #northern_master_gsmith_constructed.tga
    Inside the construction folder you need 1 image for each building.
    #northern_apprentice_gsmith.tga
    #northern_european_master_gsmith.tga



    Then your buildings will show up properly in game.
    Spoiler Alert, click show to read: 




    If you want them to show up in the battle map, we have to add a few more files. First open building_battle.txt and add description lines for your new buildings.
    Code:
    {apprentice_gsmith}Apprentice Goldsmith
    {master_gsmith}Master Goldsmith


    Then open descr_building_battle.txt. At the top of the file there is a section named stat_cats (statistics categories) that defines how strong a building is. Pick one that you think should apply to your new building and create an entry at the bottom.
    Code:
    apprentice_gsmith 
    {
     stat_cat  medium_stone
     localised_name apprentice_gsmith 
    }
    master_gsmith 
    {
     stat_cat  medium_stone
     localised_name master_gsmith 
    }


    This will allow your building to show on the battle map, and also allow it to be damaged by riots and auto calc battles.
    Last edited by GrnEyedDvl; December 21, 2008 at 02:41 PM.

  2. #2
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 4 Part 1 Buildings

    Sorry this is late guys, had a power outage and I only have 90 minutes of battery

  3. #3
    dragonsign's Avatar International Brigade
    Join Date
    Sep 2008
    Location
    Oslo, Norway
    Posts
    966

    Default Re: Lesson 4 Part 1 Buildings

    why is this not in the class forum?

    just wondering, great work anyways

  4. #4
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Lesson 4 Part 1 Buildings

    This thread has been moved to the class forum.

    Oh and... 90 minutes of battery is no excuse for being a nub GED

  5. #5
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 4 Part 1 Buildings

    Where did I have it posted?? lol sheesh

  6. #6
    Hunter Makoy's Avatar We got 2 words for ya..
    Join Date
    Apr 2007
    Location
    Dont mess with Texas
    Posts
    5,202

    Default Re: Lesson 4 Part 1 Buildings

    i just noticed something. when you go into data/settlements/techtree the culture for southern european is spelled south eurpean. and northern european is spelled north euorpean. what is up with that?

    man, i wish i had known i DIDN'T have to put a description for each culture when i made my education mod. that would have saved alot of time.
    Last edited by Hunter Makoy; December 16, 2008 at 12:59 PM.
    Under the patronage of Lord Condormanius (12.29.08)
    "Yes, I know why the leaf is turning yellow. Its a lack of chloroform."

  7. #7
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 4 Part 1 Buildings

    Quote Originally Posted by Hunter Makoy View Post
    i just noticed something. when you go into data/settlements/techtree the culture for southern european is spelled south eurpean. and northern european is spelled north euorpean. what is up with that?
    Typos that CA never fixed, instead they made everything else a typo too. Its REALLY annoying when you get into conditions and events and siege is spelled seige in the condition name but in the event name its right but for this trigger you need it that way... grrrr


    man, i wish i had known i DIDN'T have to put a description for each culture when i made my education mod. that would have saved alot of time.
    Its still not that bad. Just make a template (and save) in notepad with a generic entry for all cultures, then do a replace_all any time you need to create an entry. Copy and paste into your game file.

  8. #8
    Hunter Makoy's Avatar We got 2 words for ya..
    Join Date
    Apr 2007
    Location
    Dont mess with Texas
    Posts
    5,202

    Default Re: Lesson 4 Part 1 Buildings

    when i did my mod i wasn't using notepad ++, so it was pretty tedious. i've been using it for a lil while now though, and it is alot easier.

    also, the entries we make for showing up in battle don't seem to say anything about what it is going to look like. how does the game decide?
    Under the patronage of Lord Condormanius (12.29.08)
    "Yes, I know why the leaf is turning yellow. Its a lack of chloroform."

  9. #9
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 4 Part 1 Buildings

    Thats probably in the .world files which KE and Agrantonio are researching how to mod. They are actually doing quite well with that.

  10. #10
    Hunter Makoy's Avatar We got 2 words for ya..
    Join Date
    Apr 2007
    Location
    Dont mess with Texas
    Posts
    5,202

    Default Re: Lesson 4 Part 1 Buildings

    alright that makes sense.

    i'm done with this part, what do i need to show you?

    EDIT: also, would there have been a way with the building pics to have only put them in one culture and have them appear for all? i think the user interface is only in southern_european, but it appears for all. could that be done with pics too?

    EDIT2: i love finding goofy things that CA did. if someone is looking for an unused pic for gold_smith (if they're using that template). there is a pic called <culture>_black_smith (notice the extra '_') that is a different look then the blacksmith.

    there is no _constructed file though, so a different one would have to be used for that.

    EDIT3: ok spoke too soon. i am done, but it wont work. my log file shows absolutely nothing as far as errors go. nothing that is useful at all. it crashes at the loading splash. i think the only thing that would cause that is the EDB file, and it is the same problem that sidelined my building project for months because i got so fed up with it.

    i am uploading my entire mod folder for anyone to take a look at. (this includes the education buildings i made for my education mod. if the gold smith doesn't end up working, those should be enough to pass anyway )

    Last edited by Hunter Makoy; December 16, 2008 at 07:15 PM.
    Under the patronage of Lord Condormanius (12.29.08)
    "Yes, I know why the leaf is turning yellow. Its a lack of chloroform."

  11. #11

    Default Re: Lesson 4 Part 1 Buildings

    We will be working with the following files. Copy the vanilla files into your mod folder:
    export_descr_buildings.txt
    export_descr_buildings_enums.txt
    descr_building_battle.txt
    descr_building_battle_enums.txt
    In the text folder, convert them first:
    building_battle.txt
    export_buildings.txt
    export_descr_guilds.txt
    data/settlements/techtree/culture/
    Hey GED export_descr_guilds.txt is in the data folder not in the data/text or i am wrong?
    EDITED
    Hey GED this is my entry
    Code:
    building raiderhouse
    {
        levels barn_raider gamla_raider 
        {
            barn_raider requires factions { all, } 
            {
                capability
                {
                    trade_base_income_bonus bonus 3
                    agent_limit merchant 1
                }
                material wooden
                construction  2 
                cost  800 
                settlement_min town
                upgrades
                {
                    gamla_raider
                }
            }
            gamla_raider requires factions { all, } 
            {
                capability
                {
                    trade_base_income_bonus bonus 5
                    agent_limit merchant 2
                }
                material wooden
                construction  6 
                cost  1600 
                settlement_min huge_city
                upgrades
                {
                }
            }
        }
        plugins 
        {
        }
    }

    Does this mean " settlement_min
    town", that the building will be available to build when my village is upgraded to town?
    And in the second upgrade "gamla_raider" will be available after the huge city is builded? and can the "huge_city" entry be change to large_town?
    So i can keep adding upgrades 9 times?
    I just wanna make sure before advancing any longer.
    Last edited by Icedie El Guaraní; December 16, 2008 at 05:16 PM.
    Contribuitor IBIICB-WOTN-Modeler-Scripter


  12. #12
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Lesson 4 Part 1 Buildings

    Quote Originally Posted by GrnEyedDvl View Post
    Where did I have it posted?? lol sheesh
    It was in the main Uni area.

    Quote Originally Posted by GrnEyedDvl View Post
    Its still not that bad. Just make a template (and save) in notepad with a generic entry for all cultures, then do a replace_all any time you need to create an entry. Copy and paste into your game file.
    Also, for building files, get a program called Bulk Rename Utility. Then copy whatever file you intend to use into a new folder as "generic_(building name)" and use the rename utility to add in all the cultures. Rename them en masse where possible.

    Quote Originally Posted by Icedie of South View Post
    Hey GED export_descr_guilds.txt is in the data folder not in the data/text or i am wrong?
    EDITED
    Hey GED this is my entry
    Code:
    building raiderhouse
    {
        levels barn_raider gamla_raider 
        {
            barn_raider requires factions { all, } 
            {
                capability
                {
                    trade_base_income_bonus bonus 3
                    agent_limit merchant 1
                }
                material wooden
                construction  2 
                cost  800 
                settlement_min town
                upgrades
                {
                    gamla_raider
                }
            }
            gamla_raider requires factions { all, } 
            {
                capability
                {
                    trade_base_income_bonus bonus 5
                    agent_limit merchant 2
                }
                material wooden
                construction  6 
                cost  1600 
                settlement_min huge_city
                upgrades
                {
                }
            }
        }
        plugins 
        {
        }
    }

    Does this mean " settlement_min
    town", that the building will be available to build when my village is upgraded to town?
    And in the second upgrade "gamla_raider" will be available after the huge city is builded? and can the "huge_city" entry be change to large_town?
    So i can keep adding upgrades 9 times?
    I just wanna make sure before advancing any longer.
    Yes it goes in the data folder.

    The "settlement_min" means that is the minimum level core building it can be created in.

    The line in upgrade is referencing the name of your next building. It is a curious line really, because you'd think it would be implicit that the building which follows within a tree is the upgrade, but it isn't. I haven't checked to see if this can be used creatively, but intend to. GED might know if the upgrades area can be used more creatively than 9 in a row.

    You can have 9 buildings in a tree, so 8 upgrades for a total of 9.

  13. #13
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 4 Part 1 Buildings

    Hunter, if you have other new buildings working then yes they qualify. Btw I see no mod folder...

    With images you cannot use the same one for all cultures. Or at least if you can I dont know how.

    Icedie, good catch on the export_descr_guilds. + rep

    You are correct in your reasoning about levels, and I see AL beat me to it.

  14. #14
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 4 Part 1 Buildings

    Quote Originally Posted by Augustus Lucifer View Post
    It was in the main Uni area.




    The line in upgrade is referencing the name of your next building. It is a curious line really, because you'd think it would be implicit that the building which follows within a tree is the upgrade, but it isn't. I haven't checked to see if this can be used creatively, but intend to. GED might know if the upgrades area can be used more creatively than 9 in a row.
    As far as I know it cannot, it throws an "Expected building_x" error.

  15. #15

    Default Re: Lesson 4 Part 1 Buildings

    Ok thanks guys, here is the first attempt
    Spoiler Alert, click show to read: 

    But in the second attempt i only get it to work in the construction section, but when select it to build, it show up the default image and the places holder as well.
    Spoiler Alert, click show to read: 

    I ran out of time here so i´ll keep up tomorrow, i appreciate your help + rep VL, GED
    Edited
    Here is my final product , though i am still not able to understsand how the H::LL doesn the game find this .tga path, does it directly translate the " # " as export_building? also i have add the ingame building but i have a crash when i double click on an enemy army to see how big it is and what type of units are in it.

    The other bugg i have made is when i start the campaign as England the introduction script think that i am the spanish king, i don´t know what i did to do thisbut it doesnt crash for this it only show me all the options as always, but for spain, i haven´t tested it with another faction so may be is for all for some reason because the previous course part i edited everything for spain , but i call it danelag, there shouldnt be spain in my campaign they are Danelag now,,:hmmm:? strange, any thought?
    Any ways here are my images
    Drinking Hall
    Spoiler Alert, click show to read: 
    ,

    Upgrade Meat Hall
    Spoiler Alert, click show to read: 

    They are just test don´t mind the description is nothing like that,
    Ah almost forgot the game only crash when i double click on enemy stacks to check out their units but i can play battles with no problem, so it may be a little file missing nothig so of a big deal.
    Last edited by Icedie El Guaraní; December 17, 2008 at 05:03 PM.
    Contribuitor IBIICB-WOTN-Modeler-Scripter


  16. #16
    Hunter Makoy's Avatar We got 2 words for ya..
    Join Date
    Apr 2007
    Location
    Dont mess with Texas
    Posts
    5,202

    Default Re: Lesson 4 Part 1 Buildings

    Quote Originally Posted by GrnEyedDvl View Post
    Hunter, if you have other new buildings working then yes they qualify. Btw I see no mod folder...

    With images you cannot use the same one for all cultures. Or at least if you can I dont know how.
    yeah i tried uploading it and it took forever and i gave up. if the other buildings will work i wlil delete wat i entered.

    Quote Originally Posted by Augustus Lucifer View Post

    The line in upgrade is referencing the name of your next building. It is a curious line really, because you'd think it would be implicit that the building which follows within a tree is the upgrade, but it isn't. I haven't checked to see if this can be used creatively, but intend to. GED might know if the upgrades area can be used more creatively than 9 in a row.

    You can have 9 buildings in a tree, so 8 upgrades for a total of 9.
    i don't think there's much leeway at all with those. One of the things i had always wanted to do was make it so that the core building was the only requirement. as it stands now you have to have each previous building as well. i was so sick of conquering a late game fortress where they hadn't bothered to build any cavalry buildings or something, and having to build level 1, then 2, then 3. it was just such a waste of time and unrealistic. but appearance there's no way around something like that.
    Last edited by Hunter Makoy; December 16, 2008 at 09:08 PM.
    Under the patronage of Lord Condormanius (12.29.08)
    "Yes, I know why the leaf is turning yellow. Its a lack of chloroform."

  17. #17
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 4 Part 1 Buildings

    If its not showing up in one area but it is in another, its not the EDB file. Check your brackets in the description files.

  18. #18

    Default Re: Lesson 4 Part 1 Buildings

    Quote Originally Posted by GrnEyedDvl View Post
    If its not showing up in one area but it is in another, its not the EDB file. Check your brackets in the description files.
    Yes it was the EDB file and incorrect name of the tga files. thanks GED i have updated the post #15 above.
    Contribuitor IBIICB-WOTN-Modeler-Scripter


  19. #19
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 4 Part 1 Buildings

    Nice job.

    I will put the rest of this lesson up tomorrow.

  20. #20

    Default Re: Lesson 4 Part 1 Buildings

    Nice i will try to make a start on this part tomorrow.

    Doing this class has given me an idea of making my own mod that would be about what would happen if King Harold II had won at Hastings. The mod would not be for the public just something that would be intresting to do.

    All help or advise would be welcome. I do not want to clutter up the Mod class thread so any comments or advise can be posted here.

    http://www.twcenter.net/forums/showthread.php?t=212685

Page 1 of 4 1234 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
  •