Results 1 to 10 of 10

Thread: Testing script to be used with -ai parameter

  1. #1
    Bug Hunter Senior Member player1's Avatar
    Join Date
    Feb 2005
    Location
    Belgrade, Serbia
    Posts
    1,405

    Default Testing script to be used with -ai parameter

    From last FAQ update:
    Q: MikeB mentioned an auto-run feature that can be used to run a game without player intervention. This would be very useful for mod testing. Is there any way we can activate it now? If not, will we be able to in the future?

    A: MikeB was very naughty to mention that and will shortly be fighting the company bear to pay for his mistake. :) This is a feature we use internally for debugging. Autorun is not something that we've openly advertised for released versions, and it's not normally something that a player would want to do, simply because they are *playing* the game rather than *watching* stuff happen. However, there's a -ai command line option that turns autorun on in release builds after the 1.2 patch. This doesn't work with earlier versions of the game.

    This script is example of controlling AI autorun behavior to make it possible to review situation after X turns.

    Code:
    script 
    	suspend_during_battle on
    
    	while I_TurnNumber < 41
    	end_while					
    	console_command control gauls
    
    	while I_TurnNumber < 42
    	end_while					
    	console_command control germans
    
    	while I_TurnNumber < 43
    	end_while					
    	console_command control britons
    	
    	while I_TurnNumber < 44
    	end_while					
    	console_command control dacia
    
    	while I_TurnNumber < 45
    	end_while					
    	console_command control scythia
    
    	while I_TurnNumber < 46
    	end_while					
    	console_command control spain
    
    end_script
    So, in case if you started the game with -ai parameter, this script will stop autorun after 40 turns and give command to gauls for one turn, next turn to germans, then to britons, etc...

    Useful if you test some mod, and need to see how situation would resolve when AI plays.


    P.S.
    The script is standard campaign script.
    BUG-FIXER, an unofficial patch for both Rome: Total War and its expansion pack

  2. #2

    Default Re: Testing script to be used with -ai parameter

    You may want to throw a console_command toggle_perfect_spy in there instead of switching control between the factions.

    Have you had any luck restarting the -ai using a console_command run_ai?
    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

  3. #3
    Bug Hunter Senior Member player1's Avatar
    Join Date
    Feb 2005
    Location
    Belgrade, Serbia
    Posts
    1,405

    Default Re: Testing script to be used with -ai parameter

    toggle_perfect_spy?
    Didn't knew about that.

    Haven't yet had luck with run_ai...
    BUG-FIXER, an unofficial patch for both Rome: Total War and its expansion pack

  4. #4
    Bug Hunter Senior Member player1's Avatar
    Join Date
    Feb 2005
    Location
    Belgrade, Serbia
    Posts
    1,405

    Default Re: Testing script to be used with -ai parameter

    Doesn't work in console.
    I guess it's script only command?
    BUG-FIXER, an unofficial patch for both Rome: Total War and its expansion pack

  5. #5

    Default Re: Testing script to be used with -ai parameter

    Quote Originally Posted by player1
    toggle_perfect_spy?
    Didn't knew about that.

    Haven't yet had luck with run_ai...
    How to: Toggle Perfect Spy
    It gives you an infinite spying range so you can see exactly what buildings and troops are in each settlement.

    Unlike toggle_fow, it's not saved in preferences so you have to reactivate it each time you launch the game. The game _does_ however remember from campaign to campaign so if you quit a campaign and launch another one, toggle_perfect_spy will still be activated, and indeed if you run the command again, you'll actually switch it off.

    Normally, I'd have it run in a separate script for that reason. Can you bring up a show_me script once you've stopped the ai with the control command?
    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

  6. #6
    Bug Hunter Senior Member player1's Avatar
    Join Date
    Feb 2005
    Location
    Belgrade, Serbia
    Posts
    1,405

    Default Re: Testing script to be used with -ai parameter

    Yes, works through script.

    But, it's not perfect, general's traits and retinues can't be seen.
    BUG-FIXER, an unofficial patch for both Rome: Total War and its expansion pack

  7. #7
    Simulation Monkey Member The_Mark's Avatar
    Join Date
    Dec 2004
    Location
    Helsinki, Finland
    Posts
    2,613

    Default Re: Testing script to be used with -ai parameter

    Yes, it's a script-only console command...

    Edit, three posts in one minute and mine was the last.
    Edit2:

    You might want to use an EscPressed-monitor for this, that way one could pause the game on the fly.
    Code:
    StealEscKey on
    
    monitor_event EscPressed TrueCondition
    console_command control X
    end_monitor
    
    monitor_event ButtonPressed ButtonPressed end_turn
    StealEscKey on
    end_monitor
    Press esc to halt and to take control of a faction. End turn and the esc will work again to tak control. This could prolly be modified so that one could select the faction to be controlled.
    edit: untested
    Last edited by The_Mark; 07-29-2005 at 17:03.

  8. #8
    Bug Hunter Senior Member player1's Avatar
    Join Date
    Feb 2005
    Location
    Belgrade, Serbia
    Posts
    1,405

    Default Re: Testing script to be used with -ai parameter

    Quote Originally Posted by Epistolary Richard
    Can you bring up a show_me script once you've stopped the ai with the control command?
    No, clicking on ? doesn't do the thing.

    Also, if you save game (only possible if script has ended), and reload, auto AI will continue to go in full speed (regardless is -ai parameter used or not).

    I suspect that auto AI flag is somewhere in saved games.
    BUG-FIXER, an unofficial patch for both Rome: Total War and its expansion pack

  9. #9

    Default Re: Testing script to be used with -ai parameter

    What you'll have to do then if you want to use it, is put the toggle_perfect_spy and Mark's monitors in a campaign script, just remember when you quit a campaign and start a new one, to comment out the toggle_perfect_spy, otherwise you'll switch it off.

    No, you can't see the traits of the generals, unfortunately. They'll have to be tested the old fashioned way
    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

  10. #10
    The Dark Knight Member wlesmana's Avatar
    Join Date
    Jan 2005
    Location
    Indonesia
    Posts
    602

    Default Re: Testing script to be used with -ai parameter

    This might be good for campaign multiplayer. The battles will be decided by the actual general instead of the player(s).

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