Testing script to be used with -ai parameter
From last FAQ update:
Quote:
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.
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?
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...
Re: Testing script to be used with -ai parameter
Doesn't work in console.
I guess it's script only command?
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?
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.
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. :embarassed:
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
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.
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 :toff:
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).