STAR WARS™ Empire at War: Gold Pack – How to Make Mod 1C1S Conversion Script

STAR WARS™ Empire at War: Gold Pack – How to Make Mod 1C1S Conversion Script 1 - steamlists.com
STAR WARS™ Empire at War: Gold Pack – How to Make Mod 1C1S Conversion Script 1 - steamlists.com

Table of Contents

1 Credit 1 Second (+ Infinite Unit Cap) Creator Tool
 
 

Credits

A Python 3 script to make a 1C1S + Infinite Unit Cap modification based on this guide – [steamcommunity.com] .
 
https://steamcommunity.com/sharedfiles/filedetails/?id=2514089452 – [steamcommunity.com] 
 
 
 

Code

import os
import re

rules = [
 (re.compile('(<Tactical_Build_Time_Seconds>\s*[^0].*</Tactical_Build_Time_Seconds>)|(<Tactical_Build_Cost_Multiplayer>\s*[^0].*</Tactical_Build_Cost_Multiplayer>)|(<Build_Cost_Credits>\s*[^0].*</Build_Cost_Credits>)|(<Build_Time_Seconds>\s*[^0].*</Build_Time_Seconds>)|(<Tactical_Build_Cost_Campaign>\s*[^0].*</Tactical_Build_Cost_Campaign>)|(<Absolute_Income_Modifier>-.*</Absolute_Income_Modifier>)|(<Population_Value>.*</Population_Value>)|(<Space_Override_Population_Value>.*</Space_Override_Population_Value>)'), '(?1<Tactical_Build_Time_Seconds>1</Tactical_Build_Time_Seconds>)(?2<Tactical_Build_Cost_Multiplayer>1</Tactical_Build_Cost_Multiplayer>)(?3<Build_Cost_Credits>1</Build_Cost_Credits>)(?4<Build_Time_Seconds>1</Build_Time_Seconds>)(?5<Tactical_Build_Cost_Campaign>1</Tactical_Build_Cost_Campaign>)(?6<Absolute_Income_Modifier>0</Absolute_Income_Modifier>)(?7<Population_Value>0</Population_Value>)(?8<Space_Override_Population_Value>0</Space_Override_Population_Value>)'),
 (re.compile('<Absolute_Income_Modifier>-.*</Absolute_Income_Modifier>'), '<Absolute_Income_Modifier>0</Absolute_Income_Modifier>')
]

print('Starting...')
for root, dirs, files in os.walk('.'):
 for file in files:
 if file.endswith('.xml'):
 path = root + '\\' + file
 raw_in = ''
 with open(path, 'r') as f:
 raw_in = f.read()
 working_data = raw_in
 
 for rule, replace in rules:
 working_data = rule.sub(replace, working_data)
 
 with open(path, 'w') as f:
 f.write(working_data)
print('Done!')

 
 
 

Usage

Paste this code into a .py file on the same level as the “Data” file of the mod. The “Data” folder and script should be in the same folder together. Then, run the file if you have Python 3 installed. If you don’t have Python 3, install Python 3 – [python.org] .
 
 
NOTE: THIS WILL OVERWRITE YOUR MOD’S FILES
 
If you wish to preserve your original mod, make a copy of the mod’s folder.
 
 
If you’re copying a steam workshop mod then put the copy in: “\steamapps\common\Star Wars Empire at War\corruption\Mods”
 
 
(You may need to create the mods folder yourself.) You can name the copy anything you like, preferably something easy to type.
 
 
To run the new 1C1S mod, instead of using “STEAMMOD=##########”,
 
use “MODPATH=Mods\” and then the name you named the mod’s folder.
 
 

Written by Ruby

 
 
I hope you enjoy the Guide we share about STAR WARS™ Empire at War: Gold Pack – How to Make Mod 1C1S Conversion Script; if you think we forget to add or we should add more information, please let us know via commenting below! See you soon!
 
 


Be the first to comment

Leave a Reply

Your email address will not be published.


*