Results 1 to 21 of 21

Thread: Campaign script - adding a building

  1. #1
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Campaign script - adding a building

    Can anyone tell me how I might add a building to a settlement in a campaign before the player has his turn - but using a script? It is a descr_strat script, but I am not sure of the coding. Thx.
    "One of the most sophisticated Total War mods ever developed..."

  2. #2
    Member Member Stuie's Avatar
    Join Date
    Aug 2001
    Location
    Upper Gwynedd, PA
    Posts
    406

    Default Re: Campaign script - adding a building

    The coding is:

    Code:
    console_command create_building [settlement name] [building level id]
    Note that "settlement name" in this case is the name that appears on the map in-game.

  3. #3
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: Campaign script - adding a building

    Thx Stuie.

    However that neither works from the RomeShell or from inside a script.txt declared (linked) at the bottom of the DS file.

    I desire the latter of course.
    "One of the most sophisticated Total War mods ever developed..."

  4. #4

    Default Re: Campaign script - adding a building

    It should work from a DS script. I use it in XGM to do some AI balancing at campaign start. There are some limitations. You can't upgrade buildings (it has to be a type that doesn't exist in the settlement yet) and you can't add things that would be visible on the strat map like walls, roads, or ports.

  5. #5
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: Campaign script - adding a building

    Does it do all levels of buildings in a tech tree if they are all set at the same settlement level?

    The test I am using is seeking to add a new building (i.e. one created by us) - which has no prior tree level present - to a village; the tech tree being keyed to the village level.

    So, to recap, I have:

    script
    script.txt

    at the end of the DS file. And then the script.txt is in the same folder as DS (this is a provincial campaign), that file being a single line as:

    console_command create_building [settlement name] [building level id]


    The settlement name is recognised as I added population to it in the RomeShell. I have tried various alternatives such as putting "script" and "end script" in and alos the tech tree level as well as just the level codename of the building. I even tried it without the console_command prefix.

    There is no recognition by the game of this script.

    I should confess I am not a scripter and do not intend to use scripts for anything but small tasks where they are essential to the game - no doubt just these campaign scripts for initial game set up. All the tutorials seem to be on all the other types of scripting :(

    Maybe now someone can see what I may be doing wrong.
    "One of the most sophisticated Total War mods ever developed..."

  6. #6

    Default Re: Campaign script - adding a building

    Okay, campaign scripts can be a little fiddly:

    Your script file should look something like:

    Code:
    console_command create_building Londinium muster_field
    console_command puppify_my_love
    end_script
    Note it does not need the 'script' command at the beginning as it would with a show_me script.

    Also, and I don't know why this is, leave a few blank lines at the bottom of your DS file and at the top of script.txt.

    As for creating stuff in a village - you can put anything anywhere using a script - you can put a Royal Barracks in a village if you want. The only thing you have to be careful of is buildings that affect the look of the campaign map (governor houses, roads, ports, walls), some of these cause problems.
    Last edited by Epistolary Richard; 04-14-2006 at 10:58.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  7. #7
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: Campaign script - adding a building

    Thx ER but still no recognition of the script in game. I am doing this in BI if that makes a difference.

    Anyone have any examples I could look at?
    "One of the most sophisticated Total War mods ever developed..."

  8. #8
    Member Member Stuie's Avatar
    Join Date
    Aug 2001
    Location
    Upper Gwynedd, PA
    Posts
    406

    Default Re: Campaign script - adding a building

    Quote Originally Posted by Dol Guldur
    Thx ER but still no recognition of the script in game. I am doing this in BI if that makes a difference.

    Anyone have any examples I could look at?
    Ah, BI! That's the problem.

    You need to move everything in the \Rome - Total War\bi\data\world\maps\base directory to the \Rome - Total War\bi\data\world\maps\campaign\barbarian_invasion directory. Then delete or rename the "base" directory so it is ignored.

    I just tried it and it worked... I removed the barracks from Rome and added this to descr_strat.txt:

    Code:
    ;start script
    script
    test_script.txt
    The script:
    Code:
    script
    
    console_command create_building Rome royal_barracks
    
    end_script
    ... and an Urban Barracks appeared as the last building in Rome.

  9. #9
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: Campaign script - adding a building

    Hmmm...I do not think that is possible. I need it for a provincial and the full campaign is in the folders you mention. Further, if the base folder was removed or deleted I believe that custom battles (which reference the base folder map.rwm file) would not work?

    The provincial, of course, already has its base folder removed and the files thereof placed in with the campaign files in the provincial folder. A number of provincials will be set up and these and the main campaign will all need this script.

    What is the principle here? I will think on it more.

    Thank you for your response.
    "One of the most sophisticated Total War mods ever developed..."

  10. #10
    Member Member Stuie's Avatar
    Join Date
    Aug 2001
    Location
    Upper Gwynedd, PA
    Posts
    406

    Default Re: Campaign script - adding a building

    Quote Originally Posted by Dol Guldur
    Hmmm...I do not think that is possible. I need it for a provincial and the full campaign is in the folders you mention.
    Ok - I played around with this some more.

    • I made a second folder in the "\Rome - Total War\bi\data\world\maps\campaign" folder and called it "Pickles".
    • Then I copied all the files in the "\Rome - Total War\bi\data\world\maps\base" folder and the "\Rome - Total War\bi\data\world\maps\campaign\barbarian_invasion" folder into "\Rome - Total War\bi\data\world\maps\campaign\Pickles".
    • I made the script and added the scripting info to the descr_strat.txt (and deleted the map.rwm of course).
    • Then I started BI, selected Single Player > Provincial Campaign > Pickles > picked WRE and started the game.


    Once again, the script worked. Urban Barracks appeared in Rome as the last building built.

    Does that help you? You could probably do the same with the BI campaign folder - just copy the base files in and add the script/scripting info and it will probably work. And that retains the base folder files for whatever else they are used for (custom battles per your post above).

  11. #11
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: Campaign script - adding a building

    Thx. for your thoughts and tests Stuie.

    Essentially then you have made a second copy of the main campaign to represent the provincial (in my case).

    This is, however, the set up I already have except that the two maps and related files are not identical of course. Clearly what works in R:TW does not seem to work in BI.

    Has anyone got a campaign script to work in a BI provincial? If not, I have no evidence that it can work and will need to decide when to knock it on the head. It has already taken up too much of my time already.

    And yet I can't but help think it must be possible...
    "One of the most sophisticated Total War mods ever developed..."

  12. #12
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Campaign script - adding a building

    Hmm well you could use a mod folder instead, I can confirm it works there (also inside a prov campaign in that mod folder).

  13. #13
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: Campaign script - adding a building

    OK,

    I now have the mod in a bi modswitch folder (sitting under the bi folder). I have the following code at present:

    End of ds file:

    Code:
    script
    campaign_script.txt
    campaign_script.txt:

    Code:
    console_command create_building Anfalas temple_of_violence_shrine
    
    terminate_script
    end_script
    (one of many I've tried but I do not have a record of the others now)

    Both these files are in the provincial campaign folder.

    Still does not work.

    What am I doing wrong?
    "One of the most sophisticated Total War mods ever developed..."

  14. #14

    Default Re: Campaign script - adding a building

    What I'm wondering is can a campaign script be used to add an unbuildable AND indestructible building to a town?

    For example in our Zulu Total War mod lets say you have a 'diamond mine' in town - this could trigger the formation (construction) of a 'gambling den' which could neither be bought nor destroyed but is a consequence of having too many high rollers striking it rich. Something that the player has no control over but needs to build other structures to counteract (like a 'local police force' or a 'magistrate').

    Could a script be used to give a town that building - and to take it away?

    Thanks,
    Lord Clare / Harlechman
    Zulu Total War Team
    "Ad majoram Dei gloriam"

  15. #15

    Default Re: Campaign script - adding a building

    To give it, yes. To take it away, no. We don't have a demolish building command. The only thing you can do to remove its effects is to include in a background script a monitor that damages it every turn. All the reforms in EB and Res Gestae are done by placing unbuildable, undamageable buildings in settlements on certain dates (or other events).
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  16. #16

    Default Re: Campaign script - adding a building

    Well, that's good enough. How would you make an unbuyable and indestructible building though, if I may ask (if it is available to, lets say the Roman factions, it won't appear in the building construction list?)

    Thanks very much,
    Lord Clare / Harlechman
    "Ad majoram Dei gloriam"

  17. #17

    Default Re: Campaign script - adding a building

    Unconstructable - make the building require a hidden resource that doesn't appear anywhere on the map.

    Indestructable - Add the hinterland_ prefix to building tree name (as used in hinterland_roads)

    So you might have for example:

    hinterland_newbuilding
    - smallbuilding
    - mediumbuilding
    - largebuilding
    Last edited by Epistolary Richard; 07-20-2006 at 22:46.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  18. #18

    Default Re: Campaign script - adding a building

    So let's say I call this resource PBDISSENT and make it a hidden resource then a script can create this building depending on other factors (ie. the presence of a certain religion in a settlement)?

    Thanks,
    Lord Clare / Harlechman
    Zulu Total War Team
    "Ad majoram Dei gloriam"

  19. #19
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: Campaign script - adding a building

    Gah, OK I give up. I've been having a little go at getting this very simple script working every now and again for months. It just does not work (I knew I should have left scripting alone).

    Can someone point me to a mod download that uses a BI modfolder and has a campaign script working? I will have to study the files - perhaps that will help.

    Thx.

    p.s. the mod downloads section (which is great) could be enhanced by having a division for the form of the mod installation (does it overwrite, go into a modfolder, work of the JSGME thingy, etc.). At least, a clear symbol (along the same lines as the 'P' in the red triangle) could be used to denote the same. It would be very useful.
    "One of the most sophisticated Total War mods ever developed..."

  20. #20
    Modder Member Encaitar's Avatar
    Join Date
    Oct 2003
    Location
    Melbourne, Australia
    Posts
    234

    Default Re: Campaign script - adding a building

    I've got the following setup working (in BI, but not in a -mod folder).

    descr_strat
    Code:
    script
    CreateBuildings_Script.txt
    CreateBuildings_Script.txt
    Code:
    start_script
    console_command create_building Minas_Tirith men0
    end_script
    Remember that you have to use the name of the settlement, not the name of the region.
    Encaitar Arandur

    Middle-earth: Total War Dev

  21. #21
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: Campaign script - adding a building

    Thx. Encaitar - but already tried and a no no.

    :(
    "One of the most sophisticated Total War mods ever developed..."

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO