Page 1 of 1

Fix for Roman Legion camp spam

Posted: Tue May 26, 2020 3:12 pm
by n0b0dy007
The every turn Legion camp spam was annoying, especially after repeatedly deleting them (it only requires one to enable faction-wide recruitment).

Below is a patch for the Data/scripts/Events.BSF file that replaces the loop over all region capitals with selecting the current faction capital.

Most of the functions are defined per game. See http://archonwiki.slitherine.com/index. ... es_Modding for the generic engine modding guide.

Code: Select all

diff -r S:\Events.BSF D:\SteamLibrary\steamapps\common\Field of Glory Empires\Data\scripts\nppBackup\Events.BSF.2020-05-26_104835.bak
4098,4100c4098,4099
< 		// Change to only test/create Legion Camp in faction capital (i.e. Rome):
< 		regionID = Faction_Politic_MainCapitalRgnID(factionID)
< 		if (Evt_Rome_ImperialLegion_Tracker && (regionID > -1))
---
> 		regCount = GetNumOwnedRegions(factionID);
> 		if (Evt_Rome_ImperialLegion_Tracker)
4102,4105c4101,4111
< 			if (Region_Structures_HasThisOne(regionID, $ID_STRUC_IMPERIAL_LEGION_CAMP) == FALSE)//
< 			{
< 				StructureTpl_Name($ID_STRUC_IMPERIAL_LEGION_CAMP);
< 				Structure_CreateEx(factionID, regionID, $ID_STRUC_IMPERIAL_LEGION_CAMP, TRUE, gString);				
---
> 			for (reg = 0; reg < regCount; reg++)
> 			{
> 				regionID = GetOwnedRegionID(factionID, reg);
> 				if (Region_Population_Count(regionID) >= 10 && Dice(100) <= GetDiffMode() * 5) // less onerous tests first
> 				{
> 					if ( (Region_Province_IsLocalCapital(regionID)) && (Region_Structures_HasThisOne(regionID, $ID_STRUC_IMPERIAL_LEGION_CAMP) == FALSE && Region_IsBesieged(regionID) == FALSE) )
> 					{
> 						StructureTpl_Name($ID_STRUC_IMPERIAL_LEGION_CAMP);
> 						Structure_CreateEx(factionID, regionID, $ID_STRUC_IMPERIAL_LEGION_CAMP, TRUE, gString);				
> 					}
> 				}
4108c4114
< 		else if (Evt_Rome_Marian_Tracker && (regionID > -1))
---
> 		else if (Evt_Rome_Marian_Tracker)
4110c4116
< 			if (Region_Structures_HasThisOne(regionID, $ID_STRUC_LEGION_CAMP) == FALSE)
---
> 			for (reg = 0; reg < regCount; reg++)
4112,4113c4118,4126
< 				StructureTpl_Name($ID_STRUC_LEGION_CAMP);
< 				Structure_CreateEx(factionID, regionID, $ID_STRUC_LEGION_CAMP, TRUE, gString);				
---
> 				regionID = GetOwnedRegionID(factionID, reg);
> 				if (Region_Population_Count(regionID) >= 5 && Dice(100) <= GetDiffMode() * 5) // less onerous tests first
> 				{
> 					if ( (Region_Province_IsLocalCapital(regionID)) && (Region_Structures_HasThisOne(regionID, $ID_STRUC_LEGION_CAMP) == FALSE && Region_IsBesieged(regionID) == FALSE) )
> 					{
> 						StructureTpl_Name($ID_STRUC_LEGION_CAMP);
> 						Structure_CreateEx(factionID, regionID, $ID_STRUC_LEGION_CAMP, TRUE, gString);				
> 					}
> 				}

Re: Fix for Roman Legion camp spam

Posted: Wed Jun 03, 2020 9:14 am
by Pocus
Hi,

This script, if copy pasted won't work, given you have kept references like "4102,4105c4101,4111" in between lines.

Also I'm not too sure why you say you only need one Imperial legion camp to recruit them (locally). An Imperial legion asks for one of these in the region it is recruited: $ID_STRUC_ROM_CAMPUS_MARTIUS|$ID_STRUC_IMPERIAL_LEGION_CAMP|$ID_STRUC_EMPEROR_PALACE

Re: Fix for Roman Legion camp spam

Posted: Thu Jun 04, 2020 2:15 pm
by n0b0dy007
Pocus wrote: Wed Jun 03, 2020 9:14 am This script, if copy pasted won't work, given you have kept references like "4102,4105c4101,4111" in between lines.
It's a .patch file, generated by diff (a bog standard s/w engineer's tool): https://linux.die.net/man/1/patch. Those numbers refer to line numbers in the original text file.
This saves space/bandwidth. Also, this board (as currently configured) allows neither text files as post attachments nor very long text post content. So, I had to focus on just what had changed.
Pocus wrote: Wed Jun 03, 2020 9:14 am Also I'm not too sure why you say you only need one Imperial legion camp to recruit them (locally). An Imperial legion asks for one of these in the region it is recruited: $ID_STRUC_ROM_CAMPUS_MARTIUS|$ID_STRUC_IMPERIAL_LEGION_CAMP|$ID_STRUC_EMPEROR_PALACE
Not in the version I was using (at least in the version as of 2020-05-26, as indicated in the NP++ file name).
They were available to recruit in all regions, alongside the other faction-wide (i.e. non-Provincial) units: Alae, Velites, Cavalry, Light Cavalry (per the Campus Martius and Castrum Equitatum "National" structures).
So, perhaps there is a mis-configuration in some other file(s) regarding the 3 structures you mentioned, since it doesn't seem to be working as intended.

Re: Fix for Roman Legion camp spam

Posted: Fri Jun 05, 2020 6:58 am
by Pocus
Well, perhaps that's a .patch file. IDK I'm not a Linux user. What I know is that most people interested by this change won't be developers at all, but end users with a wide variety of jobs and probably what they would like is a ZIP with the modified file, so they can drop the extracted file and have it works. Place yourself as a service provider for customers. What is the easiest solution for your customers? That your mod is the simplest possible to install.

Do you have a saved game where you can recruit an Imperial Legion in any region, because you built an Imperial Legion Camp somewhere? That would be a bug indeed! Thanks.

Re: Fix for Roman Legion camp spam

Posted: Fri Jun 05, 2020 9:12 pm
by n0b0dy007
Pocus wrote: Fri Jun 05, 2020 6:58 am a ZIP with the modified file
Attached as Events.zip
Pocus wrote: Fri Jun 05, 2020 6:58 am Do you have a saved game where you can recruit an Imperial Legion in any region, because you built an Imperial Legion Camp somewhere? That would be a bug indeed! Thanks.
Attached as 76.zip, turn after Marian Reform implemented. National "Wonders":
  • Campus Martius in region Latium
  • Legion Camp in region Campania
  • Castrum Equitatum in region Padus
  • Castrum Elephantidae in region Epirus
Note that unit types Marian Legion, Velites, Light Cavalry, and Cavalry are recruitable in all regions, but unit type Alae recruitable only in provinces Italia Superior and Italia Inferior.

Re: Fix for Roman Legion camp spam

Posted: Sat Jun 06, 2020 5:59 am
by Pocus
76.zip is not attached?

Re: Fix for Roman Legion camp spam

Posted: Sat Jun 06, 2020 12:52 pm
by n0b0dy007
Pocus wrote: Sat Jun 06, 2020 5:59 am 76.zip is not attached?
It seems that the forum software, as presently configured, is silently refusing to upload the large zip file. 3 attempts, so far.
With no explanation available, I am at a loss how to debug / work around the problem. Remarkably user-hostile s/w.
What alternatives do you suggest for sharing a 2.9 Mb file?

Re: Fix for Roman Legion camp spam

Posted: Sat Jun 06, 2020 2:33 pm
by n0b0dy007
Pocus wrote: Sat Jun 06, 2020 5:59 am 76.zip is not attached?
So cumbersome.
Here is a link to the 76.zip file on wetransfer.com, per the instructions at viewtopic.php?f=560&t=92667:
https://we.tl/t-1DDcLPHxdU

Re: Fix for Roman Legion camp spam

Posted: Sun Jun 07, 2020 8:54 am
by Pocus
Thanks, I'll check rapidly. Also I will contact the web team, perhaps they can make the process easier for you guys.

Re: Fix for Roman Legion camp spam

Posted: Mon Jun 08, 2020 8:38 am
by Pocus
So here is what I get in the Corsica-Sardinia province, after the Legion camp has finished disbanding. I can't recruit a Marian legion and the causes of that are valid.

Image

Re: Fix for Roman Legion camp spam

Posted: Mon Jun 08, 2020 11:09 pm
by n0b0dy007
Pocus wrote: Mon Jun 08, 2020 8:38 am and the causes of that are valid.
Seems to be a save game incompatibility, then.