Results 1 to 30 of 42

Thread: Can I use a script to end the turn?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Can I use a script to end the turn?

    Some points to your attempts.

    - If you want a monitor is repeated, don't use terminate_monitor. With this command the monitor is finished completely once it is true for the first time.

    - The command console_command control is not as simple as it seems. It only works with some factions and depends on the relative position of them in descr_strat, at least in my experience.
    I have this structure in my scripts:
    Code:
    	monitor_event FactionTurnStart FactionType carthage
    		and I_TurnNumber = 0
    
    		console_command control carthage
    		console_command capture_settlement Saguntum
    		console_command control romans_julii
    
    		terminate_monitor
    	end_monitor
    This piece of script only works when carthage and romans_julii are placed one after the other in descr_strat (romans are playable). In the same campaign, if I try to give control to greek_cities, the command doesn't work.

    Moreover, I don't allow the player to do anything during the change of control. It is only to allow the script to use the capture_settlement command with an AI controlled faction.

    - After this kind of control change, the human player cannot manage the recruitment and building for one turn. It is a side effect of this command.


    Because of that problems, I don't think that a single script will work for all the playable factions at the same time. From your idea of making the script for EB, perhaps the only way to do it is to sacrifice one faction, making it spawned by script, and use it in the same way as ER did in year_jump mod.

    Regarding the question of human decisions in diplomacy etc, I think it is not possible, as the rollers don't appear in the AI turns (I cannot see the interest in AI sending messages to itself ). This means you have no event to monitor (afaik).

  2. #2
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Can I use a script to end the turn?

    @ Makanyane
    Did you use intensivelly the -ai option?
    Do you know if it saves automatically the turns?
    Do you know if it is compatible with background scripts?

    One option could be use this option until a given turn, using the background script to stop it at some date, and use the autosaved file to start a new normal campaign.

  3. #3
    Member Member mrtwisties's Avatar
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    235

    Default Re: Can I use a script to end the turn?

    Sorry Monkwarrior, we posted at the same time. I like your idea about the -ai switch, it'd be an elegant solution if it worked.

    I'm still bashing away at my concept at the moment. But I can't even get this to work:

    declare_counter loop

    monitor_event FactionTurnStart FactionType romans_julii
    and I_TurnNumber < 5

    add_money 40000

    end_monitor

    while I_CompareCounter loop = 0
    end_while
    Thanks for all your help.

  4. #4
    Finder of Little Oddities Senior Member Makanyane's Avatar
    Join Date
    Jan 2006
    Posts
    2,220

    Default Re: Can I use a script to end the turn?

    on that last example think you're missing

    set_counter loop 0

    under the declare_counter
    not sure if it defaults to that otherwise.

    @Monkwarrior, I haven't tried -ai from background script, I might have a look at that. I did get it to save with that on shortcut at one stage but, reloading the save without the shortcut command still set it off on its own again, so I rather gave up on looking at it.

    If you are doing anything that switches command to AI I think you may need to look at how rest of script works, I assume that it messes up anything reliant on LocalFaction triggers. I've got Year Jump script triggerable while background script is in use, so I've put a counters in to determine what local faction is on first turn, and use those counters throughout instead of LocalFaction

    EDIT: old discussion on -ai for info
    https://forums.totalwar.org/vb/showt...ghlight=run_ai
    Last edited by Makanyane; 11-28-2007 at 12:12.
    Not used mods before? Looking for something small and fun?!
    Download the:

  5. #5
    Member Member mrtwisties's Avatar
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    235

    Default Re: Can I use a script to end the turn?

    Makanyane - in my own chaste way, I love you. Here's the partially working script:

    script

    declare_counter loop
    set_counter loop 0

    monitor_event FactionTurnStart FactionType romans_julii
    and I_TurnNumber < 5

    console_command control greek_cities
    campaign_wait 10
    console_command add_money 40000
    console_command control romans_julii

    end_monitor

    while I_CompareCounter loop = 0
    end_while

    end_script
    This fast-forwarded me to 268 BCE. All I had to do was click a few boxes along the way. When I got to 268 BCE, the AI had taken Segesta and built a whole bunch of units for the Julii. Meanwhile, the Greeks had built up a fortune of some hundreds of thousands of denarii.

    So all I have to do is figure out how to avoid having to click through the scrolls, and I'll be able to use this to fast forward to any turn.

  6. #6
    Member Member mrtwisties's Avatar
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    235

    Default Re: Can I use a script to end the turn?

    I tested the script again, using it to fast forward 50 turns to 245 BCE. If you decide to do the same, make sure you turn off "follow AI characters", which I didn't do the first time. Turns out the AI likes to put spies and diplomats everywhere, which means you end up following one helluva lot of AI characters. Running RTW.exe in windowed mode was definitely a good idea, though.

    The Romans and the Greeks got into an extended naval war, which I witnessed first-hand from both sides. It was actually kind of fun to see, and verified that both factions are highly active when they're under AI control. I guess forgetting to take away +40,000 denarii for the Greeks every turn probably contributed to them getting ornery, huh?

    I had also forgotten that those dog units existed in vanilla RTW. Turns out the AI likes to move around whole armies of them. Not sure how I feel about that. Pretty sure the answer is "mirthful", though - the dogs of the Julii more or less chased the Gauls out of northern Italy. Dogmatix would have been ashamed. But then the Gauls came back with a whole mass of soldiers, and they all had a bunch o' fight near the Po.

    By the end of the 50 turns:
    * The Julii owned northern Italy
    * The Brutii owned Epirus and Dalmatia
    * The Scipii owned Sicily, Sardinia, Corsica and bits of Tunisia
    * The Gauls owned bits of Spain, for which I don't blame them, I understand it's got lovely countryside
    * The Seleucids were swallowed by Parthia and the Ptolemies (I mean, *cough*, Egypt)
    * Pontus were on their way to becoming a superpower
    * The Sweboz and the Getai were both massive

    But despite all the fun, it was 50 turns that I had to sit there for, clicking on the occasional scroll. Here are the ones that paused or delayed the turn sequence. I need to find a way to automagically resolve these, so I can do something else with my life while the script is fast-forwarding:

    * Diplomacy scrolls
    * Naval battle predeployment
    * Land battle predeployment
    * Assistance requested from SPQR
    * Senate missions (create massive lag during the turn sequence)

    I can't find events for any of these in the docudemon. Do they exist? And can anyone suggest code for automagically resolving these happenings (preferably with the AI deciding what to do)?

  7. #7
    Member Member mrtwisties's Avatar
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    235

    Default Re: Can I use a script to end the turn?

    Thanks for the -ai link, M. I'm testing that as well.

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