Lord Adherbal
08-31-2005, 16:17
I found a way to give money and settlements to a faction other then the player's faction. This was thought to be impossible because add_money and capture_settlement only work for the local (player's) faction. Or atleast I think it is, if this is old news then excuse my ignorance.
First you need to store the player's faction (the "local" faction). This is done with the following piece of code, at the beginning of the script:
declare_counter player_faction
if I_LocalFaction romans_julii
set_counter player_faction 1
end_if
if I_LocalFaction romans_brutii
set_counter player_faction 2
end_if
if I_LocalFaction romans_scipii
set_counter player_faction 3
end_if
if I_LocalFaction romans_senate
set_counter player_faction 4
end_if
if I_LocalFaction macedon
set_counter player_faction 5
end_if
if I_LocalFaction egypt
set_counter player_faction 6
end_if
if I_LocalFaction seleucid
set_counter player_faction 7
end_if
if I_LocalFaction carthage
set_counter player_faction 8
end_if
if I_LocalFaction parthia
set_counter player_faction 9
end_if
if I_LocalFaction pontus
set_counter player_faction 10
end_if
if I_LocalFaction gauls
set_counter player_faction 11
end_if
if I_LocalFaction germans
set_counter player_faction 12
end_if
if I_LocalFaction britons
set_counter player_faction 13
end_if
if I_LocalFaction armenia
set_counter player_faction 14
end_if
if I_LocalFaction dacia
set_counter player_faction 15
end_if
if I_LocalFaction greek_cities
set_counter player_faction 16
end_if
if I_LocalFaction numidia
set_counter player_faction 17
end_if
if I_LocalFaction scythia
set_counter player_faction 18
end_if
if I_LocalFaction spain
set_counter player_faction 19
end_if
if I_LocalFaction thrace
set_counter player_faction 20
end_if
Now to give money/settlements to another faction. The console commands "add_money" and "capture_settlement" only work for the "local" faction, but there is a way around this problem: This is done with the "control" command. Control changes the faction the player controls, thereby changing the "local" faction. An example:
console_command control britons
console_command capture_settlement Paris
console_command add_money 2000
First the local faction is set to the britons, then the settlement "Paris" is given to the local faction (the britons), then money is added to the local faction (yep, still the britons). This all happens within the same turn, so the player won't notice anything (apart from a small delay while the current garrison moves our of the settlement).
Now all that remains is giving control back to the original player's faction, with the following piece of code:
if I_CompareCounter player_faction = 1
console_command control romans_julii
end_if
if I_CompareCounter player_faction = 2
console_command control romans_brutii
end_if
if I_CompareCounter player_faction = 3
console_command control romans_scipii
end_if
if I_CompareCounter player_faction = 4
console_command control romans_senate
end_if
if I_CompareCounter player_faction = 5
console_command control macedon
end_if
if I_CompareCounter player_faction = 6
console_command control egypt
end_if
if I_CompareCounter player_faction = 7
console_command control seleucid
end_if
if I_CompareCounter player_faction = 8
console_command control carthage
end_if
if I_CompareCounter player_faction = 9
console_command control parthia
end_if
if I_CompareCounter player_faction = 10
console_command control pontus
end_if
if I_CompareCounter player_faction = 11
console_command control gauls
end_if
if I_CompareCounter player_faction = 12
console_command control germans
end_if
if I_CompareCounter player_faction = 13
console_command control britons
end_if
if I_CompareCounter player_faction = 14
console_command control armenia
end_if
if I_CompareCounter player_faction = 15
console_command control dacia
end_if
if I_CompareCounter player_faction = 16
console_command control greek_cities
end_if
if I_CompareCounter player_faction = 17
console_command control numidia
end_if
if I_CompareCounter player_faction = 18
console_command control scythia
end_if
if I_CompareCounter player_faction = 19
console_command control spain
end_if
if I_CompareCounter player_faction = 20
console_command control thrace
end_if
Note that I haven't done a great lot of tests on this yet, so there might be drawbacks that I haven't discovered yet (switching control *might* mess up the AI). But if there aren't any problems then it should be usefull to help the AI by giving them extra money and for special events that change settlement control. There might be other commands that are limited to the "local" faction that work with this too, I haven't really checked them all.
First you need to store the player's faction (the "local" faction). This is done with the following piece of code, at the beginning of the script:
declare_counter player_faction
if I_LocalFaction romans_julii
set_counter player_faction 1
end_if
if I_LocalFaction romans_brutii
set_counter player_faction 2
end_if
if I_LocalFaction romans_scipii
set_counter player_faction 3
end_if
if I_LocalFaction romans_senate
set_counter player_faction 4
end_if
if I_LocalFaction macedon
set_counter player_faction 5
end_if
if I_LocalFaction egypt
set_counter player_faction 6
end_if
if I_LocalFaction seleucid
set_counter player_faction 7
end_if
if I_LocalFaction carthage
set_counter player_faction 8
end_if
if I_LocalFaction parthia
set_counter player_faction 9
end_if
if I_LocalFaction pontus
set_counter player_faction 10
end_if
if I_LocalFaction gauls
set_counter player_faction 11
end_if
if I_LocalFaction germans
set_counter player_faction 12
end_if
if I_LocalFaction britons
set_counter player_faction 13
end_if
if I_LocalFaction armenia
set_counter player_faction 14
end_if
if I_LocalFaction dacia
set_counter player_faction 15
end_if
if I_LocalFaction greek_cities
set_counter player_faction 16
end_if
if I_LocalFaction numidia
set_counter player_faction 17
end_if
if I_LocalFaction scythia
set_counter player_faction 18
end_if
if I_LocalFaction spain
set_counter player_faction 19
end_if
if I_LocalFaction thrace
set_counter player_faction 20
end_if
Now to give money/settlements to another faction. The console commands "add_money" and "capture_settlement" only work for the "local" faction, but there is a way around this problem: This is done with the "control" command. Control changes the faction the player controls, thereby changing the "local" faction. An example:
console_command control britons
console_command capture_settlement Paris
console_command add_money 2000
First the local faction is set to the britons, then the settlement "Paris" is given to the local faction (the britons), then money is added to the local faction (yep, still the britons). This all happens within the same turn, so the player won't notice anything (apart from a small delay while the current garrison moves our of the settlement).
Now all that remains is giving control back to the original player's faction, with the following piece of code:
if I_CompareCounter player_faction = 1
console_command control romans_julii
end_if
if I_CompareCounter player_faction = 2
console_command control romans_brutii
end_if
if I_CompareCounter player_faction = 3
console_command control romans_scipii
end_if
if I_CompareCounter player_faction = 4
console_command control romans_senate
end_if
if I_CompareCounter player_faction = 5
console_command control macedon
end_if
if I_CompareCounter player_faction = 6
console_command control egypt
end_if
if I_CompareCounter player_faction = 7
console_command control seleucid
end_if
if I_CompareCounter player_faction = 8
console_command control carthage
end_if
if I_CompareCounter player_faction = 9
console_command control parthia
end_if
if I_CompareCounter player_faction = 10
console_command control pontus
end_if
if I_CompareCounter player_faction = 11
console_command control gauls
end_if
if I_CompareCounter player_faction = 12
console_command control germans
end_if
if I_CompareCounter player_faction = 13
console_command control britons
end_if
if I_CompareCounter player_faction = 14
console_command control armenia
end_if
if I_CompareCounter player_faction = 15
console_command control dacia
end_if
if I_CompareCounter player_faction = 16
console_command control greek_cities
end_if
if I_CompareCounter player_faction = 17
console_command control numidia
end_if
if I_CompareCounter player_faction = 18
console_command control scythia
end_if
if I_CompareCounter player_faction = 19
console_command control spain
end_if
if I_CompareCounter player_faction = 20
console_command control thrace
end_if
Note that I haven't done a great lot of tests on this yet, so there might be drawbacks that I haven't discovered yet (switching control *might* mess up the AI). But if there aren't any problems then it should be usefull to help the AI by giving them extra money and for special events that change settlement control. There might be other commands that are limited to the "local" faction that work with this too, I haven't really checked them all.