PC Mode
Org Mobile Site
Forum > Rome: Total War > Rome: Total War > R:TW Modification > Scriptorium >
Thread: Giving money and settlements to other factions
Lord Adherbal 16:17 08-31-2005
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:

Code:
	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:

Code:
	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:

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.

Reply
Monkwarrior 11:21 09-01-2005
Great idea Adherbal!

I think in the first code there is one mistake: if I'm not wrong the last scythia should be thrace.

Question: is this part of a show_me script or a background script?

It is very interesting as it could be part of a "senate" system for all the factions, both player and AI controlled.
Perhaps some partial objectives could be stated at the beginning of the campaign and this would be the method to reward when each objective has been reached.

P.S.: if this is not the place for discussion, please move this post. Thanks.

Reply
Lord Adherbal 12:54 09-01-2005
I've fixed it, thanks.

It should work for both background and show_me scripts (I don't think there's a real difference between the two).

Reply
dzsagon 12:04 12-01-2005
If I am right this is the core version of your idea:
console_command add_money 40000
console_command control Numidia
console_command add_money -39000
console_command control Egypt

Reply
dzsagon 12:07 12-01-2005

Once again.

console_command add_money 4000
console_command control Numidia
console_command add_money -4000
console_command control Egypt

I tried but nothing happened. I am with Egypt.

Reply
Lord Adherbal 17:27 12-05-2005
that should add 4000 denarii to egypt, then remove 4000 denarii for Numidia.

however thanks to Jerome we now know you can also use:

console_command add_money Numidia, 4000

Reply
dzsagon 16:21 12-06-2005
Originally Posted by [cF]Adherbal:
that should add 4000 denarii to egypt, then remove 4000 denarii for Numidia.

however thanks to Jerome we now know you can also use:

console_command add_money Numidia, 4000
Thanks the problem solved already

Reply
brymht 22:23 05-19-2008
hmm. Very interesting. Going to give this sucker a shot.

Reply
HouseOfHam 19:25 05-20-2008
There are a couple nasty (and fairly well-known) side-effects with using "console_command control":
1. The AI doesn't work correctly for the faction you switch to/from.
2. All player settlements revert to auto-managed when you switch back to the original faction.

Reply
brymht 06:36 06-27-2008
What happens with the AI? Is it a global AI issue, for the entire faction, all factions, or what?

Reply
HouseOfHam 00:01 06-28-2008
I think it's an issue with AI not managing settlements properly for the faction that used to be controled by the player. Maybe other things, too - not 100% sure. JeromeGrasdyke (CA lead dev) posted a warning about using this command (quite) some time back.

Reply
Up
Single Sign On provided by vBSSO