![]() |
|
|||||||
| Register | FAQ | Rules | Chat | TWC Wiki | Downloads | Arcade | Forum Help | Members List | Social Groups | Calendar | Search | Today's Posts | Mark Forums Read |
| Tutorials on Scripting Tutorials for scripting RTW and BI. Only post tutorials or questions relevant to the existing threads. |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 | |
|
Lieutenant Colonel
|
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/Rtw_Uploads/RTWupload/xtpyScriptGenerator.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
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 Ex-RTR VII Developer / RS2 scripting advisorOnly doing RTR Web site and RTRVII/ExRM/RS2 SVN admin stuff now - Settlement coordinate locator -for RTW/BI. Seems to work for M2TW, too, but needs more testing. - EDB Validator - supports RTW/BI/M2TW - RTW scripting tutorials - n-turns per year script generator Last edited by HouseOfHam; May 06, 2009 at 03:57 PM. |
|
|
|
|
|
|
|
#2 | |
|
ЯTR Developer
![]()
Posts: 9,823
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Well done HouseOfHam
Rome Total Realism Developer ![]() ![]() See all RTR VII previews here! Under the patronage of Tony83 Proud patron of Kepper My mod-tools and animations tutorial ![]() |
|
|
|
|
|
|
|
#3 | |
|
Artifex
![]()
Posts: 2,636
![]() |
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 | |
|
Lieutenant Colonel
|
As long as you don't have the change from winter to summer more than once per year.
Ex-RTR VII Developer / RS2 scripting advisorOnly doing RTR Web site and RTRVII/ExRM/RS2 SVN admin stuff now - Settlement coordinate locator -for RTW/BI. Seems to work for M2TW, too, but needs more testing. - EDB Validator - supports RTW/BI/M2TW - RTW scripting tutorials - n-turns per year script generator |
|
|
|
|
|
|
|
#5 | |
|
Πάμε γερά Ελλαδάρα.....
![]()
Posts: 2,930
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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 Warwatch this, this and this |
|
|
|
|
|
|
|
#6 | |
|
Drummer and Fifer
Posts: 153
![]() ![]() |
where do you put the files after the editor makes them
|
|
|
|
|
|
|
|
#7 | |
|
ЯTR Developer
![]()
Posts: 9,823
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
You can find that in those tutorials I think:
How-to: Add a background script to your mod Beginner's Scripting Guide Rome Total Realism Developer ![]() ![]() See all RTR VII previews here! Under the patronage of Tony83 Proud patron of Kepper My mod-tools and animations tutorial ![]() |
|
|
|
|
|
|
|
#8 | |
|
Drummer and Fifer
Posts: 153
![]() ![]() |
maybe im just stupid...but that doesnt help....it creates a file...does anyone know where i put it? when using the genarator
|
|
|
|
|
|
|
|
#9 | |||
|
ЯTR Developer
![]()
Posts: 9,823
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Quote:
Quote:
Rome Total Realism Developer ![]() ![]() See all RTR VII previews here! Under the patronage of Tony83 Proud patron of Kepper My mod-tools and animations tutorial ![]() |
|||
|
|
|
|||
|
|
#10 | |
|
Drummer and Fifer
Posts: 153
![]() ![]() |
but is this a campaign file?
ahhh i see it now lol...im a noob Last edited by Sqυιd; October 26, 2009 at 03:02 PM. Reason: double post |
|
|
|
|
|
|
|
#11 | |
|
ЯTR Developer
![]()
Posts: 9,823
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
You have to include it in a script, and the links I gave explain how to set up such a script
Edit: No worries Rome Total Realism Developer ![]() ![]() See all RTR VII previews here! Under the patronage of Tony83 Proud patron of Kepper My mod-tools and animations tutorial ![]() |
|
|
|
|
|
|
|
#12 | |
|
Lieutenant Colonel
|
Welcome to the club.
Ex-RTR VII Developer / RS2 scripting advisorOnly doing RTR Web site and RTRVII/ExRM/RS2 SVN admin stuff now - Settlement coordinate locator -for RTW/BI. Seems to work for M2TW, too, but needs more testing. - EDB Validator - supports RTW/BI/M2TW - RTW scripting tutorials - n-turns per year script generator |
|
|
|
|
|
|
|
#13 | |
|
Light Infantryman
Posts: 4
![]() |
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 | |
|
ЯTR Developer
![]()
Posts: 9,823
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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 Rome Total Realism Developer ![]() ![]() See all RTR VII previews here! Under the patronage of Tony83 Proud patron of Kepper My mod-tools and animations tutorial ![]() |
|
|
|
|
|
|
|
#15 | |
|
Light Infantryman
Posts: 4
![]() |
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 | |
|
Lieutenant Colonel
|
Most likely, filenames are not matching between what's in export_descr_advice.txt/descr_strat.txt and what you actually called them.
Ex-RTR VII Developer / RS2 scripting advisorOnly doing RTR Web site and RTRVII/ExRM/RS2 SVN admin stuff now - Settlement coordinate locator -for RTW/BI. Seems to work for M2TW, too, but needs more testing. - EDB Validator - supports RTW/BI/M2TW - RTW scripting tutorials - n-turns per year script generator |
|
|
|
|
|
|
|
#17 | |
|
Ensign
Posts: 1,167
![]() ![]() |
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 | |
|
Lieutenant Colonel
|
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.
Ex-RTR VII Developer / RS2 scripting advisorOnly doing RTR Web site and RTRVII/ExRM/RS2 SVN admin stuff now - Settlement coordinate locator -for RTW/BI. Seems to work for M2TW, too, but needs more testing. - EDB Validator - supports RTW/BI/M2TW - RTW scripting tutorials - n-turns per year script generator |
|
|
|
|
|
|
|
#19 | ||
|
Chosen Man
Posts: 203
![]() ![]() ![]() |
Quote:
Respectfully,
CPT Worsham |
||
|
|
|
||
|
|
#20 | |
|
Lieutenant Colonel
|
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 Ex-RTR VII Developer / RS2 scripting advisorOnly doing RTR Web site and RTRVII/ExRM/RS2 SVN admin stuff now - Settlement coordinate locator -for RTW/BI. Seems to work for M2TW, too, but needs more testing. - EDB Validator - supports RTW/BI/M2TW - RTW scripting tutorials - n-turns per year script generator |
|
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
|