I've have did what the instruction say but I'll get CTD at the starting screen.
I've have did what the instruction say but I'll get CTD at the starting screen.
♪ Now it's over, I'm dead and I haven't done anything that I want, or I'm still alive and there's nothing I want to do ♪
Uncomment the end_monitor line before your code, then it should work. But anyhow, it looks like everything you're doing should only happen when you first start a campaign and thus belongs in the campaign script (before the advance_advice_thread line there) rather than in the background script.
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
You see, I would like to make it a background script which starts after the 10th turn, so can you show me how to do that HouseOfHam? And I also would like to when all this happens to have greek_cities (Me) have to destroy or outlast parthia, armenia and pontus to win a short campaign, is that possible?
- The background script always starts at turn 0. If you want to have something happen on a particular turn, use a monitor like this:
- Win conditions are configured via desc_win_conditions.txt (same folder as descr_strat.txt)Code:monitor_event FactionTurnStart I_TurnNumber = 10 ; or 9, since turn numbers start with 0 and FactionIsLocal and FactionType greek_cities ;and FactionLeaderTrai ; all that other code terminate_monitor end_monitor
ps: You should also add some checks to prevent the monitor from getting triggered again in case the player saves the game on turn 10 and continues later.
Last edited by HouseOfHam; August 08, 2008 at 10:05 AM.
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
Well I ment a Show_me Script , sorry for the confusion. well here is my updated script, I wish it would be simpler though.
Oh yea, what do I have to put to put text in the spoiler box on the forums if you know how and would be willing to tell me.
Code:script ; Anything following a semicolon is a comment. ; Remove the adviser portrait from screen. select_ui_element advisor_dismiss_button simulate_mouse_click lclick_up monitor_event FactionTurnStart I_TurnNumber = 10 ; or 9, since turn numbers start with 0 and FactionIsLocal and FactionType greek_cities ;and FactionLeaderTrai ; all that other code terminate_monitor end_monitor ; Wait for it to go away. while I_AdvisorVisible end_while ;suspend_unscripted_advice true ; Open the adviser message bubble automatically whenever advance_advice_thread is called. ; I recommend using this method instead of the select_ui_element + simulate_mouse_click approach. ; Do NOT mix both methods, though, or the advisor will show and then immediately close before ; you get a chance to read the text. declare_show_me ; Very useful for debugging - uncomment to use console_command toggle_perfect_spy ; Handle saved game reloads monitor_event GameReloaded TrueCondition end_monitor ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; This is where to put your own code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; console_command control greek_cities console_command capture_settlement "Phraaspa" console_command capture_settlement "Sparta" console_command kill_character "Flavius Julius" console_command kill_character "Hekhemmut" console_command kill_character "Khnumhoptep" console_command kill_character "Antiochus" console_command kill_character "Aristarchus" console_command kill_character "Demetrius" console_command kill_character "Hanno" console_command kill_character "Kiya" console_command kill_character "Burrhus" console_command kill_character "Theages" console_command kill_character "Theodekles" console_command kill_character "Theophanes" console_command kill_character "Annibas" console_command kill_character "Brennus" console_command kill_character "Gisgo" console_command kill_character "Eporedorix" console_command kill_character "Vindex" console_command kill_character "Arminius" console_command kill_character "Ariogaisus" console_command kill_character "Hariulfus" console_command kill_character "Barrivendos" console_command kill_character "Belenus" console_command kill_character "Cynfawr" console_command kill_character "Artaxias" console_command kill_character "Rusa" console_command kill_character "Zyraxes" console_command kill_character "Vezina" console_command kill_character "Kleomenes of Sparta" console_command kill_character "Dionysios of Sparta" console_command kill_character "Antigonos of Sparta" console_command kill_character "Eumenes of Sparta" console_command kill_character "Memnon of Sparta" console_command kill_character "Muttines" console_command kill_character "Syphax" console_command kill_character "Zipoetes" console_command kill_character "Partatua" console_command kill_character "Viriathus" console_command kill_character "Caraunios" console_command kill_character "Matugenus" console_command kill_character "Lucius Julius" console_command kill_character "Quintus Julius" console_command kill_character "Vibius Julius" console_command kill_character "Sextus Antio" console_command kill_character "Decius Curtius" console_command kill_character "Oppius Clausus" console_command kill_character "Aulus Brutus" console_command kill_character "Marcus Attius" console_command kill_character "Luca Antonius" console_command kill_character "Caius Flaminius" console_command kill_character "Cornelius Scipio" console_command kill_character "Julianus Scipio" console_command kill_character "Quintus Scipio" console_command kill_character "Quintus Caecus" console_command kill_character "Aulus Ovidius" console_command kill_character "Aulus Volesus" console_command kill_character "Flavius Nepos" console_command kill_character "Servius Maxentius" console_command kill_character "Antigonos" console_command kill_character "Gyras" console_command kill_character "Arsaces" console_command kill_character "Ardumanish" console_command kill_character "Mithradates" console_command kill_character "Pharnaces" console_command kill_character "Tiberius Brutus" console_command kill_character "Amulus Brutus" console_command kill_character "Decius Maxentius" console_command kill_character "Marcus Maxentius" spawn_army faction parthia character Xerxes, named character, age 30, , x 209, y 61 unit east infantry soldiers 100 exp 5 armour 0 weapon_lvl 0 unit east infantry soldiers 100 exp 4 armour 0 weapon_lvl 0 unit east infantry soldiers 100 exp 5 armour 0 weapon_lvl 0 unit east infantry soldiers 100 exp 4 armour 0 weapon_lvl 0 unit merc arab cavalry soldiers 100 exp 3 armour 0 weapon_lvl 0 unit east heavy cataphract soldiers 50 exp 7 armour 0 weapon_lvl 0 unit east persian cavalry soldiers 50 exp 7 armour 0 weapon_lvl 0 unit east camel cataphract soldiers 50 exp 7 armour 0 weapon_lvl 0 unit east heavy cataphract soldiers 20 exp 7 armour 0 weapon_lvl 0 unit east persian cavalry soldiers 20 exp 7 armour 0 weapon_lvl 0 unit east camel cataphract soldiers 20 exp 7 armour 0 weapon_lvl 0 unit parthia huvaka soldiers 20 exp 7 armour 0 weapon_lvl 0 unit east hillmen soldiers 100 exp 0 armour 0 weapon_lvl 0 unit east archer soldiers 100 exp 7 armour 0 weapon_lvl 0 unit east archer soldiers 100 exp 7 armour 0 weapon_lvl 0 unit east archer soldiers 100 exp 7 armour 0 weapon_lvl 0 unit east elephant soldiers 38 exp 7 armour 0 weapon_lvl 0 end spawn_army faction pontus character Rhadamsades, named character, age 30, , x 112, y 65 unit east hillmen soldiers 150 exp 5 armour 0 weapon_lvl 0 unit east generals cavalry early soldiers 20 exp 5 armour 1 weapon_lvl 0 unit east infantry soldiers 100 exp 4 armour 0 weapon_lvl 0 unit east archer soldiers 100 exp 4 armour 0 weapon_lvl 0 unit merc eastern infantry soldiers 100 exp 3 armour 0 weapon_lvl 0 unit east cappodocian cavalry soldiers 100 exp 3 armour 0 weapon_lvl 0 unit east cappodocian cavalry soldiers 100 exp 3 armour 0 weapon_lvl 0 unit east scythed chariot soldiers 100 exp 3 armour 0 weapon_lvl 0 unit east scythed chariot soldiers 100 exp 3 armour 0 weapon_lvl 0 unit east chariot archer soldiers 100 exp 3 armour 0 weapon_lvl 0 unit east chariot archer soldiers 100 exp 3 armour 0 weapon_lvl 0 end spawn_army faction greek_cities character Leonidas of_Sparta, named character, age 30, , x 200, y 60 unit greek general's guard cavalry4 soldiers 100 exp 9 armour 3 weapon_lvl 3 unit greek hoplite spartan soldiers 50 exp 9 armour 3 weapon_lvl 3 unit greek hoplite spartan soldiers 50 exp 9 armour 3 weapon_lvl 3 unit greek hoplite spartan soldiers 50 exp 9 armour 3 weapon_lvl 3 unit greek hoplite spartan soldiers 50 exp 9 armour 3 weapon_lvl 3 unit merc thracian soldiers 50 exp 9 armour 3 weapon_lvl 3 unit merc thracian soldiers 50 exp 9 armour 3 weapon_lvl 3 unit merc sarmatian cavalry soldiers 50 exp 9 armour 3 weapon_lvl 3 unit merc sarmatian cavalry soldiers 50 exp 9 armour 3 weapon_lvl 3 unit merc greek hoplites soldiers 50 exp 9 armour 3 weapon_lvl 3 unit merc greek hoplites soldiers 50 exp 9 armour 3 weapon_lvl 3 unit merc barbarian infantry soldiers 50 exp 9 armour 3 weapon_lvl 3 end console_command move_character "Leonidas of_Sparta" x 209 y 61 console_command invulnerable_general "Leonidas of_Sparta" console_command diplomatic_stance seleucid parthia Atwar console_command diplomatic_stance seleucid armenia Atwar console_command diplomatic_stance seleucid pontus Atwar console_command diplomatic_stance greek_cities parthia Atwar console_command diplomatic_stance parthia armenia Allied console_command diplomatic_stance parthia pontus Allied console_command diplomatic_stance armenia pontus Allied console_command diplomatic_stance greek_cities armenia Atwar console_command diplomatic_stance greek_cities armenia Atwar console_command diplomatic_stance greek_cities seleucid Allied ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; End of your code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Spin forever - Do not let the script terminate or any monitors you have set up will immediately get thrown away. while I_TurnNumber < 99999 suspend_unscripted_advice true end_monitor end_while end_script
Last edited by Aradan; October 14, 2008 at 03:50 PM.
so that will look like:HTML Code:[spoiler][code] your code here [/code][/spoiler]
Spoiler Alert, click show to read:
- I wouldn't recommend specifying the exact number of soldiers in a unit, since that number does not automatically adjust when you change the unit size.
- Any characters names you use in the spawn army commands must be valid names from descr_names.txt, etc. Double-check that.
- According to the docs, the valid diplomatic stances allied/neutral/war
Spoiler Alert, click show to read:
Last edited by Amroth; August 09, 2008 at 11:07 AM. Reason: dp
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
Ill try it, and if it don't work ill post back ASAP.
Hi i have followed you tutorial basically just copied and pasted it all, just to see if i could get the advisor then adding my own code, but every time i try and load rome up it is not responding, i have undone everything i have copied and pasted, then it works fine. so i followed the tutorial again, and now it won't respond.
Seeing how you're the first one of more than 1100 people who have viewed this thread to have this problem, I'd say you did something wrong.
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
wonderful work you have done!!! thanks H.O.H.
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
Τακτική είναι να ξέρεις τι να κάνεις αν υπάρχει κάτι που μπορείς να κάνεις.
Στρατηγική είναι να ξέρεις τι να κάνεις όταν δεν υπάρχει τίποτα να κάνεις.
Updated 1st post - added a way to terminate the background script. See the script code for details and explanation.
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
Great tutorial HouseofHam ! I have one question though : Is it possible to have a BuildingIsLocal Building = 'building' condition ? So that there must be a building present to make the script appear ?
This is my script :
Spoiler Alert, click show to read:
Another thing : Every time i clicked on a settlement or character , the advisor showed up saying 'Script is activated' .. How can i disable this ? And when you click on it , it goes away immediatly .. I know you mentioned this , but i don't see what i'm doing wrong ..
Nope, no such condition, unfortunately.
There are a couple problems with that code:
1. No event is being monitored.
An event is something like FactionTurnStart. BuildingIsLocal, if such a thing existed, would be a condition.Code:monitor_event <EventName> <1stCondition> ; or TrueCondition if none [and AdditionalConditions] ; commands end_monitor
Btw, in RTW conditions, if something is Local doesn't mean that it's of the same culture as the settlement. Rather, it belongs to the player faction.
For example, this will deduct 100 gold from the player's treasury for every settlement they own:
2. The while I_TurnNumber < 99999 loop must be just before the end_script tag, outside the monitor_event...end_monitor block. This is why advisor is popping up every time you click on a settlement.Code:monitor_event SettlementTurnStart SettlementIsLocal console_command add_money -100 end_monitor
I'm not exactly sure what the goal of your monitor is, but since you're spawning that army for a specific faction and settlement, you could try something like this...
Code:declare_counter spartaMusterField ; initialized to 0 by default ; Set variable to 1 when player constructs muster_field in Sparta monitor_event BuildingCompleted SettlementBuildingFinished = muster_field and SettlementIsLocal and I_LocaFaction greek_cities and SettlementName Sparta set_counter spartaMusterField 1 end_monitor ; Only spawn when that variable is set monitor_event SettlementTurnStart SettlementIsLocal and I_LocaFaction greek_cities and SettlementName Sparta and I_CompareCounter spartaMusterField = 1 console_command kill_character "Polydoros of Sparta" ; to avoid character cloning CTD spawn_army faction greek_cities character Polydoros of Sparta, general, age 20, x 155, y 61 unit greek general's guard cavalry early, soldiers 20 exp 9 armour 1 weapon_lvl 0 unit greek peltast, soldiers 20 exp 9 armour 1 weapon_lvl 0 end terminate_monitor ; so it doesn't spawn on every turn end_monitor
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
Alright , many thx ! My goal was to spawn an army when you builded a ceratin building (not the muster field ofcourse , but that's easy to test )
Great ! All problems solved and it works ! I owe you big timeA +rep would do the trick
![]()
Hi , sorry for double post and "reviving" this topic , but i thought it would be better to do this than make a whole enw thread .. I have a little "problem" .. fact is ,t hat my script does what i ask , but it generates an error when i exit the game .. This is my script :
Spoiler Alert, click show to read:
error said somthing like : undefined number at line 54 ..
This is line 54 :
if I_CompareCounter SettlementOwner Sparta = 1
But still the army gets spawned ..
I_SettlementOwner Sparta = greek_cities
is a condition and is legitimate code
set_counter SettlementOwner Sparta 1
requires a declared counter of "SettlementOwner Sparta" which I don't think would work because of the space in the counter name - think the error message is maybe about it trying to use 'Sparta' as a number
calling the counter name something similar to the condition might be convenient but if its confusing you try making it something completely different eg:
obviously needs start and end script bits as wellCode:declare_counter SOS if I_SettlementOwner Sparta = greek_cities set_counter SOS 1 end_if if I_CompareCounter SOS = 1 console_command kill_character "Polydoros of Sparta" ; to avoid character cloning CTD spawn_army faction greek_cities character Polydoros of Sparta, general, age 20, x 155, y 61 unit greek general's guard cavalry early, soldiers 20 exp 9 armour 1 weapon_lvl 0 unit greek peltast, soldiers 20 exp 9 armour 1 weapon_lvl 0 end end_if
fact that its 'working' might be similar to some non-valid code I had recently which HoH pointed out was just defaulting 'true'
EDIT: if that is all the counter is doing though, you shouldn't need it
would do same thingCode:if I_SettlementOwner Sparta = greek_cities console_command kill_character "Polydoros of Sparta" ; to avoid character cloning CTD spawn_army faction greek_cities character Polydoros of Sparta, general, age 20, x 155, y 61 unit greek general's guard cavalry early, soldiers 20 exp 9 armour 1 weapon_lvl 0 unit greek peltast, soldiers 20 exp 9 armour 1 weapon_lvl 0 end end_if
Last edited by makanyane; May 02, 2009 at 12:52 AM.
Visit Total War Center Wiki for:
Total War Mods - Modding Portal - Total War Series
M2TW Modding - Battle Map Buildings - Techtrees - worldpkgdesc
Rome Remastered Modding - New Campaign Map
IWTE functions for RR - Unit models in RR
Yep , i know , i made that script before , but i want to make something else (more complicated) .. I wanted to do a certain thing , that would occur for instance only 3% each turn .. So your chance is 1/33 each turn that the script would generate .. But , i wanted that , if you have multiple settlements (2 to be precise :p) , the chance would increase .. So then i thought about the Counter .. i was thinking something like :
Spoiler Alert, click show to read:
Note how the percentage should increase when i capture Athens ..
EDIT : it worked .. i used following script :
Spoiler Alert, click show to read:
Looks like you didn't read my note about what happens if you try to use wait in a monitor_event block.
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