Reputation: 11
As a preface, I am new to this forum and this is my first post, so please excuse any issues regarding the formatting of the post or anything like that. So I am in the process of modding the game Total War Third Age DaC. I am looking to increase unit speed recruitment and I have already figured out how to do so, but the sheer number of units in the game means that it would take hours to go through and modify all of the numbers by hand. I am looking for a way to input the text files with the stock numbers and have it return one with different numbers. The code I'm looking to modify is below.
I am pretty new to coding and I have experimented with J option pane for this problem, but it was a pretty epic fail.
capability
{
wall_level 3
tower_level 1
gate_strength 3
free_upkeep bonus 2
recruits_morale_bonus bonus 3 requires event_counter is_the_ai 1
law_bonus bonus 1
recruitment_slots 2
population_growth_bonus bonus -2 requires factions { all, } and event_counter AI_growth 1
recruit_pool "Dorwinion Militia Swordsmen" 1 0.12 2 0 requires factions { byzantium, } and region_religion northmen 25 and hidden_resource grasland
recruit_pool "Dorwinion Militia Swordsmen" 0 0.1 1 0 requires factions { byzantium, } and region_religion northmen 25 and hidden_resource forest
recruit_pool "Dorwinion Militia Swordsmen" 0 0.05 1 0 requires factions { byzantium, } and region_religion northmen 25 and hidden_resource desert or hidden_resource mountains
recruit_pool "Dorwinion Militia Archers" 1 0.12 2 0 requires factions { byzantium, } and region_religion northmen 25 and hidden_resource grasland
recruit_pool "Dorwinion Militia Archers" 0 0.1 1 0 requires factions { byzantium, } and region_religion northmen 25 and hidden_resource forest
recruit_pool "Dorwinion Militia Archers" 0 0.05 1 0 requires factions { byzantium, } and region_religion northmen 25 and hidden_resource desert or hidden_resource mountains
recruit_pool "Amroth Infantry Javelinmen" 1 0.12 2 0 requires factions { denmark, } and region_religion islam 25 and hidden_resource coast
recruit_pool "Misty Snaga Javelinmen" 1 0.15 2 0 requires factions { france, } and region_religion catholic 15
recruit_pool "Rohan Militia Spearmen" 1 0.14 2 0 requires factions { milan, } and region_religion northmen 15 and hidden_resource grasland or hidden_resource forest or hidden_resource mountains
recruit_pool "Rohan Militia Spearmen" 1 0.06 1 0 requires factions { milan, } and region_religion northmen 15 and hidden_resource desert
recruit_pool "Rohan Scouts" 1 0.14 2 0 requires factions { milan, } and region_religion northmen 15 and hidden_resource grasland
recruit_pool "Rohan Scouts" 1 0.12 1 0 requires factions { milan, } and region_religion northmen 15 and hidden_resource forest
recruit_pool "Rohan Scouts" 1 0.06 1 0 requires factions { milan, } and region_religion northmen 15 and hidden_resource desert or hidden_resource mountains
recruit_pool "Breeland Militia Spearmen" 1 0.1 2 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource grasland and not resource sugar
recruit_pool "Breeland Militia Spearmen" 0 0.09 1 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource forest and not resource sugar
recruit_pool "Breeland Militia Spearmen" 0 0.02 1 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource desert and not resource sugar
recruit_pool "Breeland Militia Spearmen" 0 0.04 1 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource mountains and not resource sugar
recruit_pool "Breeland Militia Archers" 1 0.1 2 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource grasland and not resource sugar
recruit_pool "Breeland Militia Archers" 0 0.09 1 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource forest and not resource sugar
recruit_pool "Breeland Militia Archers" 0 0.02 1 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource desert and not resource sugar
recruit_pool "Breeland Militia Archers" 0 0.04 1 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource mountains and not resource sugar
recruit_pool "Anduin Hobbit Skirmishers" 1 0.07 1 0 requires factions { turks, } and hidden_resource Vale and hidden_resource HiddenH
recruit_pool "Anduin Hobbit Skirmishers" 1 0.07 1 0 requires factions { turks, } and hidden_resource Vale and hidden_resource HiddenJ
recruit_pool "Anduin Hobbit Skirmishers" 1 0.07 1 0 requires factions { turks, } and hidden_resource Vale and hidden_resource HiddenE
recruit_pool "Anduin Hobbit Shortbowmen" 1 0.1 1 0 requires factions { turks, } and hidden_resource Vale and hidden_resource HiddenH
recruit_pool "Anduin Hobbit Shortbowmen" 1 0.1 1 0 requires factions { turks, } and hidden_resource Vale and hidden_resource HiddenJ
recruit_pool "Anduin Hobbit Shortbowmen" 1 0.1 1 0 requires factions { turks, } and hidden_resource Vale and hidden_resource HiddenE
recruit_pool "Khand Militia Spearmen" 1 0.1 1 0 requires factions { khand, } and not event_counter civil_war 1 and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Khand Militia Spearmen" 1 0.05 1 0 requires factions { khand, } and not event_counter civil_war 1 and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Khand Militia Archers" 1 0.1 1 0 requires factions { khand, } and not event_counter civil_war 1 and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Khand Militia Archers" 1 0.1 1 0 requires factions { khand, } and not event_counter civil_war 1 and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Khand Axemen Cavalry" 1 0.15 2 0 requires factions { khand, } and not event_counter civil_war 1 and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Khand Axemen Cavalry" 1 0.1 1 0 requires factions { khand, } and not event_counter civil_war 1 and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Khand Militia Spearmen" 1 0.1 1 0 requires factions { khand, } and event_counter civil_war 1 and region_religion nomadic 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Khand Militia Spearmen" 1 0.05 1 0 requires factions { khand, } and event_counter civil_war 1 and region_religion nomadic 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Khand Militia Archers" 1 0.15 1 0 requires factions { khand, } and event_counter civil_war 1 and region_religion nomadic 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Khand Militia Archers" 1 0.1 1 0 requires factions { khand, } and event_counter civil_war 1 and region_religion nomadic 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Khand Axemen Cavalry" 1 0.15 2 0 requires factions { khand, } and event_counter civil_war 1 and region_religion nomadic 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Khand Axemen Cavalry" 1 0.1 1 0 requires factions { khand, } and event_counter civil_war 1 and region_religion nomadic 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Rhovanion Light Spearmen" 1 0.1 1 0 requires factions { scotland, } and region_religion northmen 25 and hidden_resource Rhovanion
recruit_pool "Rhovanion Light Spearmen" 1 0.1 1 0 requires factions { scotland, } and region_religion northmen 25 and hidden_resource Celduin
recruit_pool "Rhovanion Light Spearmen" 1 0.1 1 0 requires factions { scotland, } and region_religion northmen 25 and hidden_resource NorthEast
recruit_pool "Dale Medium Axemen" 1 0.12 2 1 requires factions { scotland, } and region_religion northmen 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Dale Medium Axemen" 0 0.08 1 0 requires factions { scotland, } and region_religion northmen 15 and hidden_resource desert or hidden_resource mountains
recruit_pool "Dale Militia Shortbowmen" 1 0.12 2 1 requires factions { scotland, } and region_religion northmen 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Dale Militia Shortbowmen" 1 0.08 1 0 requires factions { scotland, } and region_religion northmen 15 and hidden_resource desert or hidden_resource mountains
recruit_pool "Dale Heavy Javelinmen" 1 0.12 2 1 requires factions { scotland, } and region_religion northmen 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Dale Heavy Javelinmen" 1 0.08 1 0 requires factions { scotland, } and region_religion northmen 15 and hidden_resource desert or hidden_resource mountains
recruit_pool "Umbar Corsair Swordsmen" 1 0.13 2 0 requires factions { russia, } and region_religion kings 5 and hidden_resource coast
recruit_pool "Umbar Corsair Archers" 1 0.13 2 0 requires factions { russia, } and region_religion kings 5 and hidden_resource coast
recruit_pool "Harad Militia Spearmen" 1 0.1 2 0 requires factions { spain, } and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Harad Militia Spearmen" 1 0.05 1 0 requires factions { spain, } and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Harad Militia Archers" 1 0.11 2 0 requires factions { spain, } and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Harad Militia Archers" 1 0.06 2 0 requires factions { spain, } and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Rhun Militia Swordsmen" 1 0.12 2 0 requires factions { venice, } and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Rhun Militia Swordsmen" 0 0.08 2 0 requires factions { venice, } and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Rhun Militia Archers" 1 0.12 2 0 requires factions { venice, } and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Rhun Militia Archers" 0 0.08 1 0 requires factions { venice, } and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Rhun Javelinmen" 1 0.12 2 0 requires factions { venice, } and region_religion orthodox 15 and hidden_resource Rhovanion and event_counter balchoth_clan_joins 1
recruit_pool "Mordor Militia Spearmen" 1 0.22 3 0 requires factions { england, france, } and region_religion catholic 15 and hidden_resource mountains or hidden_resource forest or hidden_resource grasland
recruit_pool "Mordor Militia Spearmen" 0 0.11 2 0 requires factions { england, france, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Mordor Militia Archers" 1 0.22 3 0 requires factions { england, } and region_religion catholic 15 and hidden_resource mountains or hidden_resource forest or hidden_resource grasland
recruit_pool "Mordor Militia Archers" 0 0.11 2 0 requires factions { england, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Mordor Infantry Swordsmen" 1 0.22 3 0 requires factions { england, } and region_religion catholic 15 and hidden_resource mountains or hidden_resource forest or hidden_resource grasland
recruit_pool "Mordor Infantry Swordsmen" 0 0.11 2 0 requires factions { england, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Guldur Militia Archers" 1 0.22 3 0 requires factions { poland, } and region_religion catholic 15 and hidden_resource mountains or hidden_resource forest or hidden_resource grasland
recruit_pool "Guldur Militia Archers" 0 0.11 2 0 requires factions { poland, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Guldur Militia Swordsmen" 1 0.22 3 0 requires factions { poland, } and region_religion catholic 15 and hidden_resource mountains or hidden_resource forest or hidden_resource grasland
recruit_pool "Guldur Militia Swordsmen" 0 0.11 2 0 requires factions { poland, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Mordor Infantry Swordsmen" 1 0.22 3 0 requires factions { poland, } and region_religion catholic 15 and hidden_resource mountains or hidden_resource forest or hidden_resource grasland
recruit_pool "Mordor Infantry Swordsmen" 0 0.11 2 0 requires factions { poland, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Misty Snaga Archers" 1 0.22 3 0 requires factions { hre, } and region_religion catholic 15 and hidden_resource mountains
recruit_pool "Misty Snaga Archers" 1 0.17 2 0 requires factions { hre, } and region_religion catholic 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Misty Snaga Archers" 0 0.12 1 0 requires factions { hre, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Misty Snaga Javelinmen" 1 0.22 3 0 requires factions { hre, } and region_religion catholic 15 and hidden_resource mountains
recruit_pool "Misty Snaga Javelinmen" 1 0.17 2 0 requires factions { hre, } and region_religion catholic 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Misty Snaga Javelinmen" 0 0.12 1 0 requires factions { hre, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Angmar Snaga Swordsmen" 1 0.22 3 0 requires factions { portugal, hre, } and region_religion catholic 15 and hidden_resource mountains
recruit_pool "Angmar Snaga Swordsmen" 1 0.17 2 0 requires factions { portugal, hre, } and region_religion catholic 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Angmar Snaga Swordsmen" 0 0.12 1 0 requires factions { portugal, hre, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Angmar Orc Medium Axemen" 1 0.22 3 0 requires factions { portugal, france, } and region_religion catholic 15 and hidden_resource mountains
recruit_pool "Angmar Orc Medium Axemen" 0 0.17 2 0 requires factions { portugal, france, } and region_religion catholic 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Angmar Orc Medium Axemen" 0 0.12 1 0 requires factions { portugal, france, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Anduin Farmers" 1 0.12 2 0 requires factions { timurids, } and region_religion northmen 15 and hidden_resource mountains or hidden_resource grasland or hidden_resource forest
recruit_pool "Anduin Farmers" 0 0.02 1 0 requires factions { timurids, } and region_religion northmen 15 and hidden_resource desert
recruit_pool "Anduin Hobbit Skirmishers" 1 0.1 1 0 requires factions { timurids, } and region_religion northmen 15 and hidden_resource Vale and hidden_resource HiddenF
recruit_pool "Anduin Hobbit Skirmishers" 1 0.1 1 0 requires factions { timurids, } and region_religion northmen 15 and hidden_resource Vale and hidden_resource HiddenG
recruit_pool "Anduin Hobbit Shortbowmen" 1 0.1 1 0 requires factions { timurids, } and region_religion northmen 15 and hidden_resource Vale and hidden_resource HiddenF
recruit_pool "Anduin Hobbit Shortbowmen" 1 0.1 1 0 requires factions { timurids, } and region_religion northmen 15 and hidden_resource Vale and hidden_resource HiddenG
recruit_pool "Wildmen Bandits" 1 0.14 2 0 requires factions { teutonic_order, } and region_religion wildmen 15 and hidden_resource mountains or hidden_resource grasland or hidden_resource forest
recruit_pool "Wildmen Bandits" 1 0.06 1 0 requires factions { teutonic_order, } and region_religion wildmen 15 and hidden_resource desert
recruit_pool "Enedwaith Medium Archers" 1 0.14 2 0 requires factions { teutonic_order, } and region_religion wildmen 15 and hidden_resource grasland or hidden_resource mountains or hidden_resource forest
recruit_pool "Enedwaith Medium Archers" 0 0.06 1 0 requires factions { teutonic_order, } and region_religion wildmen 15 and hidden_resource desert
recruit_pool "Enedwaith Vorn Spearmen" 1 0.15 2 0 requires factions { teutonic_order, } and region_religion wildmen 15 and hidden_resource Miniriath and hidden_resource HiddenA
recruit_pool "Enedwaith Vorn Spearmen" 1 0.15 2 0 requires factions { teutonic_order, } and region_religion wildmen 15 and hidden_resource Miniriath and hidden_resource HiddenD
recruit_pool "Dunland Militia Spearmen" 1 0.13 2 0 requires factions { aztecs, } and region_religion wildmen 15 and hidden_resource mountains or hidden_resource grasland or hidden_resource forest
recruit_pool "Dunland Militia Spearmen" 0 0.05 1 0 requires factions { aztecs, } and region_religion wildmen 15 and hidden_resource desert
recruit_pool "Dunland Militia Axemen" 1 0.13 2 0 requires factions { aztecs, } and region_religion wildmen 15 and hidden_resource mountains or hidden_resource grasland or hidden_resource forest
recruit_pool "Dunland Militia Axemen" 0 0.05 1 0 requires factions { aztecs, } and region_religion wildmen 15 and hidden_resource desert
recruit_pool "Breeland City Elites" 1 0.055 1 0 requires factions { normans, } and region_religion wildmen 65
}
Say I want to change the numbers directly after the "recruit_pool" in this line of code "recruit_pool "Breeland Militia Archers" 1 0.1 2 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource grasland and not resource sugar" so that it would become: "recruit_pool "Breeland Militia Archers" 3 1 3 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource grasland and not resource sugar" but do this for every single line in the code. I don't want to do this manually because the code above is only one method like this out of hundreds the the .txt that I'm modding. Thanks in advance for the help.
Upvotes: 1
Views: 41
Reputation: 171
a very simple way to search and replace pattern are Regular Expressions. Nearly every Programming Language has regular Expression. You can search for Occurances of sth and replace Parts of it very easy.
In Perl (a Script language) it is very easy to use it.
Upvotes: 1