mrtwisties
11-27-2007, 09:34
Aaages back, Epistolary Richard created a year jump mod for BI. It handed control to the computer for a set number of turns, after which you took over.
I'd really like to get something similar working for EB. The particular use that I have for it is I want to start as the Saka Rauka in Chighu in 172 BCE and run like hell from the Yuezhi. One way or another, it's going to make a fantastic AAR. But this capability would add to the replay value of any faction.
I'm sure you can think of a bunch of other uses for it. Gotten bored of your campaign? Fast-forward 50 years (and perhaps change factions) and explore the alternate history of the world you're creating. Testing a money script or similar AI behaviour mod? Let the computer play it through for a hundred years or more on your behalf.
The trick, of course, is to get it working.
In the spoiler, you can see the version of Epistolary Richard's code that you would use if you were playing with the Alemanni.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; WELCOME TO YEAR JUMP ;;;
;;; Follow the instructions below ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
script
console_command control slavs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; BEFORE YOU LAUNCH THE GAME ;;;
;;; Input the _turn_ number you want to jump to ;;;
;;; (2 turns in a year) in place of the '5' below ;;;
;;; ;;;
;;; - number cannot exceed 93 (Slavs emerge) ;;;
;;; - if your own faction or Sassanids are destroyed ;;;
;;; then it will not work, reload campaign ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; DO NOT CHANGE ANYTHING ABOVE HERE ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; INSERT DESIRED TURN NUMBER IN LINE BELOW
while I_TurnNumber < 5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; DO NOT CHANGE ANYTHING BELOW HERE ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end_while
console_command control sassanids
wait 3
console_command control alemanni
monitor_event FactionTurnEnd FactionIsLocal
and Treasury < -50000
console_command add_money 10000
terminate_monitor
end_monitor
monitor_event FactionTurnEnd FactionIsLocal
and Treasury < -40000
console_command add_money 10000
terminate_monitor
end_monitor
monitor_event FactionTurnEnd FactionIsLocal
and Treasury < -30000
console_command add_money 10000
terminate_monitor
end_monitor
monitor_event FactionTurnEnd FactionIsLocal
and Treasury < -20000
console_command add_money 10000
terminate_monitor
end_monitor
monitor_event FactionTurnEnd FactionIsLocal
and Treasury < -10000
console_command add_money 10000
terminate_monitor
end_monitor
monitor_event FactionTurnEnd FactionIsLocal
and Treasury < 0
console_command add_money 10000
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionIsLocal
and Treasury > 0
set_counter loop 1
terminate_monitor
end_monitor
while I_CompareCounter loop < 1
end_while
end_script
It's very simple code. The problem is that it depends on the existence of an emergent faction, and AFAIK I'm not going to be able to put an emergent faction into EB.
Since I'm pretty new to modding, and since I've already stuffed up my EB installation and won't have the time to reinstall for at least a week, I'd like your advice on how to proceed.
So far as I've come up with, there are two options:
1. Create a loop that works something like this:
script
console_command control [faction1]
console_command run_ai
wait 100
console_command control [faction2]
console_command run_ai
wait 100
while I_TurnNumber < 5 ; you can change this to whatever
end_while
[transitional code to put you back in control of your own faction with > 0 cash]
end_script
The idea is that you'd switch to controlling faction 1, then run the AI until it's faction 1's turn, then switch to controlling faction 2, then run the AI until it's faction 2's turn, then go back to the beginning.
Would this work? Is my code for it correct? Should I use halt_ai commands rather than wait commands?
2. Turn the Casse into an emergent faction and use Epistolary Richard's code.
Any comments or suggestions would be extremely welcome.
I'd really like to get something similar working for EB. The particular use that I have for it is I want to start as the Saka Rauka in Chighu in 172 BCE and run like hell from the Yuezhi. One way or another, it's going to make a fantastic AAR. But this capability would add to the replay value of any faction.
I'm sure you can think of a bunch of other uses for it. Gotten bored of your campaign? Fast-forward 50 years (and perhaps change factions) and explore the alternate history of the world you're creating. Testing a money script or similar AI behaviour mod? Let the computer play it through for a hundred years or more on your behalf.
The trick, of course, is to get it working.
In the spoiler, you can see the version of Epistolary Richard's code that you would use if you were playing with the Alemanni.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; WELCOME TO YEAR JUMP ;;;
;;; Follow the instructions below ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
script
console_command control slavs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; BEFORE YOU LAUNCH THE GAME ;;;
;;; Input the _turn_ number you want to jump to ;;;
;;; (2 turns in a year) in place of the '5' below ;;;
;;; ;;;
;;; - number cannot exceed 93 (Slavs emerge) ;;;
;;; - if your own faction or Sassanids are destroyed ;;;
;;; then it will not work, reload campaign ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; DO NOT CHANGE ANYTHING ABOVE HERE ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; INSERT DESIRED TURN NUMBER IN LINE BELOW
while I_TurnNumber < 5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; DO NOT CHANGE ANYTHING BELOW HERE ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end_while
console_command control sassanids
wait 3
console_command control alemanni
monitor_event FactionTurnEnd FactionIsLocal
and Treasury < -50000
console_command add_money 10000
terminate_monitor
end_monitor
monitor_event FactionTurnEnd FactionIsLocal
and Treasury < -40000
console_command add_money 10000
terminate_monitor
end_monitor
monitor_event FactionTurnEnd FactionIsLocal
and Treasury < -30000
console_command add_money 10000
terminate_monitor
end_monitor
monitor_event FactionTurnEnd FactionIsLocal
and Treasury < -20000
console_command add_money 10000
terminate_monitor
end_monitor
monitor_event FactionTurnEnd FactionIsLocal
and Treasury < -10000
console_command add_money 10000
terminate_monitor
end_monitor
monitor_event FactionTurnEnd FactionIsLocal
and Treasury < 0
console_command add_money 10000
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionIsLocal
and Treasury > 0
set_counter loop 1
terminate_monitor
end_monitor
while I_CompareCounter loop < 1
end_while
end_script
It's very simple code. The problem is that it depends on the existence of an emergent faction, and AFAIK I'm not going to be able to put an emergent faction into EB.
Since I'm pretty new to modding, and since I've already stuffed up my EB installation and won't have the time to reinstall for at least a week, I'd like your advice on how to proceed.
So far as I've come up with, there are two options:
1. Create a loop that works something like this:
script
console_command control [faction1]
console_command run_ai
wait 100
console_command control [faction2]
console_command run_ai
wait 100
while I_TurnNumber < 5 ; you can change this to whatever
end_while
[transitional code to put you back in control of your own faction with > 0 cash]
end_script
The idea is that you'd switch to controlling faction 1, then run the AI until it's faction 1's turn, then switch to controlling faction 2, then run the AI until it's faction 2's turn, then go back to the beginning.
Would this work? Is my code for it correct? Should I use halt_ai commands rather than wait commands?
2. Turn the Casse into an emergent faction and use Epistolary Richard's code.
Any comments or suggestions would be extremely welcome.