This script allows you to modify perks and stats of soldier for XCOM Long War by
modifying a Geoscape save (it will not work on tactical map saves). This
probably works for Enemy Within as well, but the perk IDs are different, so
you're own your own there.
This script performs NO validation, and I don't know what will happen if you add
invalid perks. So probably don't do that.
This script also does not adjust for stat changes as a result of adding perks.
This script requires the use of the xcom2json and json2xcom programs. If you are
on Windows and you downloaded the .zip file, you should have everything you
need.
The interactive terminal interface requires Curses. On Mac or Linux this should
be available by default. On Windows you can install it with
pip install windows-curses
. The GUI interface requires that Tkinter is
installed.
If you downloaded the source code then you can get xcom2json and json2xcom as
either Windows binaries or source code from here.
usage: XCOM LW Respec.py [-h] [-G] [-n NAME] [-o OUTPUT] [-l]
[--perk_info PERK_INFO] [--health HEALTH] [--aim AIM]
[--defense DEFENSE] [--mobility MOBILITY]
[--will WILL] [--add_perk [ADD_PERK [ADD_PERK ...]]]
[--remove_perk [REMOVE_PERK [REMOVE_PERK ...]]]
[save_file]
Modify the perks and specs for soldiers in XCOM Long War. This probably works
for Enemy Within as well, but the perk IDs are different, so you're own your
own there. This script performs NO validation, and I don't know what will
happen if you add invalid perks. So don't do that. This script also does not
adjust for stat changes as a result of adding perks.
positional arguments:
save_file Save game file. If the file name ends in .json then it
will be read as a json file as output by xcom2json.
Otherwise it will be read as a binary file. Required
if not in GUI mode.
optional arguments:
-h, --help show this help message and exit
-G, --gui Use GUI interface.
-n NAME, --name NAME Soldier's name. Only used in non-interactive mode. Can
be any combination of first name, last name, or
nickname. Order does not matter, but all provided
names must match.
-o OUTPUT, --output OUTPUT
Output save file. If the file name ends in .json it
will be written as a json file compatible with
json2xcom. Otherwise it will be written as a binary
file. This can overwrite save_file if they are the
same, so care should be taken. The default is
"[save_file].new and has the same format as the
save_file.".
-l, --list List the soldier's perks, the save will not be
modified even if perks are provided.
--perk_info PERK_INFO
CSV file containing perk information. Default
"perks.csv".
--health HEALTH, --hp HEALTH
Set soldier health.
--aim AIM Set soldier aim.
--defense DEFENSE, --def DEFENSE
Set soldier defense.
--mobility MOBILITY, --mob MOBILITY
Set soldier mobility.
--will WILL Set soldier will.
--add_perk [ADD_PERK [ADD_PERK ...]]
A list of perk IDs, names, or console names to add to
the selected soldier.
--remove_perk [REMOVE_PERK [REMOVE_PERK ...]]
A list of perk IDs, names, or console names to remove
from the selected soldier.
To run in interactive GUI mode:
python "XCOM LW Respec.py" -G save71
To run in interactive terminal mode:
python "XCOM LW Respec.py" save71
To edit the soldier named Shaojie interactively in the terminal:
python "XCOM LW Respec.py" -n "Shaojie" save71
This will display all the perks on the soldier named Shaojie:
python "XCOM LW Respec.py" -l -n "Shaojie" save71
The output looks like:
Shaojie 'Chilong' Zhang:
XP: 3444 Psi XP: 100
HP: 5 Aim: 81 Def: -2 Mob: 12 Will: 65
(10) Opportunist
(47) Covering Fire
(94) Ranger
(110) Pistol (Foundry Pistol I upgrade)
(123) Shaped Armor (Foundry Upgrade)
(126) Light 'Em Up
This will remove the Opportunist perk and add the Will To Survive perk:
python "XCOM LW Respec.py" -n "Shaojie" --remove_perk=Opportunist --add_perk="Will To Survive" save71
Or:
python "XCOM LW Respec.py" -n "Shaojie" save71 --remove_perk=10 --add_perk=17
This will modify the soldier's stats:
python "XCOM LW Respec.py" -n "Shaojie" --health=5 --aim=90 save71
I would like to thank tracktwo, whose XCOM save utilities made this possible.