Page 1 of 3 123 LastLast
Results 1 to 20 of 58

Thread: How-to: Setup your mod to have more than 2 turns per year

  1. #1
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default How-to: Setup your mod to have more than 2 turns per year

    Unlike MTW2, there is no single place to configure the number of turns per year in RTW. This means you'll need to use a scripting solution to solve this challenge.

    If your mod does not yet have a background script, start by adding one, as described here: http://www.twcenter.net/forums/showthread.php?p=3144502

    Now, if you'd rather save yourself the time, you can use this tool to generate code for your script: http://www.totalwar.org/Downloads/Rt...tGenerator.rar (more about using this tool below).

    If you'd like to know about how the generated script works and/or how to write your own, read on.

    Ok, now... on to the details! The basic idea of such a script is to monitor the current turn number and change the year and season accordingly. Since the RTW scripting language does not provide any math operators, we cannot use a loop for this. This means that every turn needs to be explicitly coded for. Needless to say, the resulting script can get quite long, but that's just how it is.

    Before you start coding:
    - The only season descriptors recognized by the game are summer and winter.
    - You must have at least one summer and one winter season per year. If you have more than one winter season in a year, they must be placed in such a way that they follow each other back-to-back. The reason for this restriction is that character age is incremented during the season change (from winter to summer, if I remember correctly). If you do not follow this rule and intermix summer and winter seasons at random, your characters will age faster than normal. If the season never changes, they'll never age at all.
    - You can start the year with either summer or winter, as you like, but I'd recommend starting with summer so a full year goes by before your characters start aging.

    The easiest way to show how it works is via an example. Let's say you want to have 4 turns per year, with 2 summer and 2 winter seasons, starting at 280 BC. The code that you would add to the script for the first 2 years would then be*:

    Code:
    ;;; Turn 0
    console_command date -280
    console_command season summer
    
    ; wait till turn 0 is over
    while I_TurnNumber < 1
        suspend_unscripted_advice true
    end_while
    
    ;;; Turn 1
    console_command date -280
    console_command season summer
    while I_TurnNumber < 2
        suspend_unscripted_advice true
    end_while
    
    ;;; Turn 2
    console_command date -280
    console_command season winter
    while I_TurnNumber < 3
        suspend_unscripted_advice true
    end_while
    
    ;;; Turn 3
    console_command date -280
    console_command season winter
    while I_TurnNumber < 4
        suspend_unscripted_advice true
    end_while
    
    ;;; Turn 4
    console_command date -279
    console_command season summer
    while I_TurnNumber < 5
        suspend_unscripted_advice true
    end_while
    
    ;;; Turn 5
    console_command date -279
    console_command season summer
    while I_TurnNumber < 6
        suspend_unscripted_advice true
    end_while
    
    ;;; Turn 6
    console_command date -279
    console_command season winter
    while I_TurnNumber < 7
        suspend_unscripted_advice true
    end_while
    
    ;;; Turn 7
    console_command date -279
    console_command season winter
    while I_TurnNumber < 8
        suspend_unscripted_advice true
    end_while
    *Note: Updated comparison logic to use "I_TurnNumber < n+1", rather than "I_TurnNumber = n", because it seems to work better when (re)loading a saved game.

    Then, just keep following this pattern for as many turns as necessary to cover your mod's date range. If you play the campaign past what the script covers, the game will revert to the default 2-turns-per year method.

    Note: Do not put any monitor_event blocks after the 4-(or however many)-turns-per year script. They will simply never be reached until the 4-tpy script finishes.

    Oh, one more thing. There is no year 0. The date goes from -1 directly to 1.


    Some technical mumbo-jumbo about the tool I mentioned above:

    The tool is a simple Java program that you give some parameters to (start and end years, the number of turns per year, and the number of summer/winter seasons per year), then, it generates the script for you. You must have Java installed on your system to be able to use it. Most computers with a browser on it will also have Java installed and you'll have a copy of java.exe in %SystemRoot%\system32 (that usually maps to C:\Windows\system32), which should already be in your path.

    If all you get when you run xtpyScriptGenerator.bat is a message that tells you to press any key, it means Windows could not find java.exe in its path. The "path" is a list of locations the system checks when it looks for the program you're trying to run. To check what your path is set to, right click on My Computer, go into Properties > Advanced System Settings > Advanced > Environment Variables, and find the PATH variable there. The value is a semicolon-delimited list of folders to search for programs. There might be a PATH variable in both the User and System variables sections.

    Sometimes, Java Runtime Environment is installed somewhere else and there isn't a java.exe in %SystemRoot%\system32\. For example, if it's C:\Program Files\Java\jre6, you'd need to make sure your path includes ;C:\Program Files\Java\jre6\bin or, if there is a JAVA_HOME variable defined, ;%JAVA_HOME%\bin
    Last edited by HouseOfHam; May 06, 2009 at 03:57 PM.
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  2. #2

    Default Re: How-to: Setup your mod to have more (or less) than 2 turns per year

    Well done HouseOfHam :

  3. #3

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    Great job, HouseOfHam,

    Just to make myself understand this: are you saying that by placing the two winter seasons together, the characters will only increase their age one year? That is a big discovery to me

  4. #4
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    Quote Originally Posted by Salvor Hardin View Post
    Great job, HouseOfHam,

    Just to make myself understand this: are you saying that by placing the two winter seasons together, the characters will only increase their age one year? That is a big discovery to me
    As long as you don't have the change from winter to summer more than once per year.
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  5. #5
    Agisilaos's Avatar GREECE - ΕΛΛΑΔΑ
    Join Date
    Sep 2007
    Location
    Santorini, Hellas
    Posts
    3,109

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    very interesting. +rep HouseOfHam
    Macedones were, are and will always be Greeks
    Under the Noble Patronage of jimkatalanos and proud patron of Agis Tournas and cocobongoclub-DJ
    Terrae Expugnandae, Imperial Might, Mythology, Complete Byzantine Roster, Ruins of glory, Sparta 3, Hegemonia City States, Roma Surrectum 2,300 Warlords of Sparta, Sparta 3.5, Classical Age Total War
    watch this
    , this and this
    Τακτική είναι να ξέρεις τι να κάνεις αν υπάρχει κάτι που μπορείς να κάνεις.
    Στρατηγική είναι να ξέρεις τι να κάνεις όταν δεν υπάρχει τίποτα να κάνεις.

  6. #6

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    where do you put the files after the editor makes them

  7. #7

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    You can find that in those tutorials I think:

    How-to: Add a background script to your mod

    Beginner's Scripting Guide


  8. #8

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    maybe im just stupid...but that doesnt help....it creates a file...does anyone know where i put it? when using the genarator

  9. #9

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    Quote Originally Posted by aorda14 View Post
    maybe im just stupid...but that doesnt help....it creates a file...does anyone know where i put it? when using the genarator
    Uhm...

    Quote Originally Posted by PatricianS View Post
    You can find that in those tutorials I think:

    How-to: Add a background script to your mod


  10. #10

    Default

    but is this a campaign file?

    ahhh i see it now lol...im a noob
    Last edited by Squid; October 26, 2009 at 03:02 PM. Reason: double post

  11. #11

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    You have to include it in a script, and the links I gave explain how to set up such a script

    Edit:
    No worries

  12. #12
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    Welcome to the club.
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  13. #13
    GER's Avatar Laetus
    Join Date
    Nov 2009
    Location
    Germany
    Posts
    4

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    I have done the scripting and followed the steps, i start a campaign, i get a black screen and then it shuts down to the desktop

    can you help me PLEASE?
    Last edited by GER; November 24, 2009 at 11:15 AM.

  14. #14

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    I know your problem... You did something wrong!
    To fix it, you should try again, without doing it wrong.


    (But serious, without more information on what you did, you won't get any better answer than that )

  15. #15
    GER's Avatar Laetus
    Join Date
    Nov 2009
    Location
    Germany
    Posts
    4

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    well man, i've tried it again and again, but i couldn't find my fault (i don't know much about those things)

    1. Add a new thread to export_descr_advice.txt: (i've added it at the beginning of the document, but after the "== ADVICE THREAD DATA STARTS HERE ==", so that it should work

    2. At the end of the export_descr_advice.txt file, add the following triggers for the above advice thread. (i've added it at the end of the document)

    3. Add the following lines at the end of the text\export_advice.txt file: (also this lines i've added at the end)

    1. Add the following at the very end of descr_strat.txt:

    2. In the same folder with the descr_strat.txt file for your mod, create a new file called campaign_script.txt (our campaign script) and put these lines into it:

    1. In the scripts\show_me folder, create a new file called background_script.txt <-- This is the file referenced by the On_display line in the advice thread in Section I. Traditionally, everyone puts their scripts into scripts\show_me, but you can put it anywhere you like and call it anything you want, as long as you update the On_display line to point to it.

    then i've used the script generator (6 turns per year, 3 summers, 3 winters), and i've added the threats to text\export_advice.txt and export_descr_advice.txt, i've also put the xtpy.txt to the scripts/show me folder, and because i was not sure, i've copied the text also in the backgroundscript.txt

    you know where's my fault?? (maybe i just didn't understand one step, my english is not very well.....)
    oh, one thing, i've got RTR Platinum and The Fourth Age-TW, i hope it doesn't matter
    Last edited by GER; November 25, 2009 at 02:19 PM.

  16. #16
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    Most likely, filenames are not matching between what's in export_descr_advice.txt/descr_strat.txt and what you actually called them.
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  17. #17
    Senator
    Join Date
    Apr 2009
    Location
    Estonia
    Posts
    1,151

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    I have one problem. I have already one 4 turn per-year script, but i wanna change it to 12.
    I have done the 12 turns per-year script, but how i can delete old one? Where it is?

  18. #18
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    Well, the script itself is most likely in the scripts\show_me folder. Take a look at the files there to see which one it is. Once you've identified it, just replace the contents with your own. Just be careful, there might be other code besides the 4tpy in there.
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  19. #19

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    Quote Originally Posted by HouseOfHam View Post
    Sometimes, Java Runtime Environment is installed somewhere else and there isn't a java.exe in %SystemRoot%\system32\. For example, if it's C:\Program Files\Java\jre6, you'd need to make sure your path includes ;C:\Program Files\Java\jre6\bin or, if there is a JAVA_HOME variable defined, ;%JAVA_HOME%\bin
    The script generator is not recognizing that I have java installed but I do. My java.exe is installed in this path: C:\Program Files (x86)\Java\jre6\bin. How do I make the script generator read that path to my java.exe?
    "What's the matter, kid? Don't ya like clowns?
    Don't we make ya laugh? Aren't we freakin' funny?" - CPT Spaulding in Devil's Rejects

  20. #20
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: How-to: Setup your mod to have more than 2 turns per year

    Add that directory to your path.

    If using Vista:
    - right-click on My Computer
    - select Properties
    - Advanced System Settings > Advanced > Environment Variables
    - find the PATH variable in the system section and edit it. At the end of the Variable value line, append a semicolon, then C:\Program Files (x86)\Java\jre6\bin
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

Page 1 of 3 123 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
  •