Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run it? #1

Open
ghost opened this issue Apr 29, 2017 · 10 comments
Open

How to run it? #1

ghost opened this issue Apr 29, 2017 · 10 comments

Comments

@ghost
Copy link

ghost commented Apr 29, 2017

No description provided.

@CalamariAce
Copy link
Owner

CalamariAce commented Apr 30, 2017

The readme shows an example of how you can run the scripts on Linux.

If you are running Windows, you would need to install a Python 2.x release. Ex: https://www.python.org/ftp/python/2.7.13/python-2.7.13.amd64.msi
Open a command prompt, run "python" without quotes to make sure this is installed and working. Then Ctrl+Z+Enter to exit the Python interpreter.

Download the .py files from this github repository and save to:
%USERPROFILE%\Documents\Paradox Interactive\Hearts of Iron III\save games
(Or wherever you keep your save game files. This should be the default location for Windows 7.)

From a windows command prompt, change directories to the save games folder mentioned above. Then run the desired script from the command prompt. Ex:
neutrality.py my_saved_game_Austrailia.hoi3 AST 0.000
(i.e., we are making changes in game save file "my_saved_game_Austrailia.hoi3" for country "AST" to set its neutrality to 0.000. If you don't know the country code for your nation, you can open up any save game file to find the list of all the countries and their three letter codes.)
See the readme for example of how to use the other scripts. Most scripts take the same first two arguments (game file and country flag). Additional arguments vary depending on the script.

Note, if you are running on Windows, you will get "Error 183: Cannot create a file when that file already exists". The script actually is working aside from the final step of replacing the original save file with the modified one. So just look for "outFile.hoi3" as the new save game file that has the modifications.

@ghost
Copy link
Author

ghost commented Jun 18, 2017

thanks

@LilNextGen
Copy link

I know this thread is old but I'm new to modding, I got error syntax everything , could you make a video on how to run these scripts?

@CalamariAce
Copy link
Owner

Can you post the specific error message, and confirm what operating system you're using?
Thanks

@CalamariAce
Copy link
Owner

I made some updates to the readme and the previous Error 183 issue should be fixed, give it another try and let me know how it goes.

@skud38000
Copy link

Hey I know this thread il very old but I have the same error syntax everytime. (I am on Windows 10)
Thank you for your help if you are still consulting this topic

C:\Users\lchan\OneDrive\Bureau\save games>"C:\Users\lchan\OneDrive\Bureau\save games\hoiiiicheats-master\industry.py" Allemagne C.hoi3 GER 10"
Traceback (most recent call last):
File "C:\Users\lchan\OneDrive\Bureau\save games\hoiiiicheats-master\industry.py", line 3, in
import utility
File "C:\Users\lchan\OneDrive\Bureau\save games\hoiiiicheats-master\utility.py", line 16
print "Usage: " + sys.argv[0] + " save.hoi3 NAT 10"
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Usage: " + sys.argv[0] + " save.hoi3 NAT 10")?

@peace-dove
Copy link

My command line is
neutrality.py input.hoi3 CHC 0.000
just like
neutrality.py my_saved_game_Austrailia.hoi3 AST 0.000
but it goes error.

The Error information just like @skud38000 , can you help, plz.

@craiganderson
Copy link
Contributor

craiganderson commented Apr 1, 2022

@peace-dove @skud38000 You get this error because you have Python3 installed instead of Python2. One way to resolve this is to uninstall Python3 and install Python2 on your system.

Alternatively you can delete any of these "print" lines that it complains about from the script and it may still work with Python3 (haven't tested it). Python3 uses a different syntax for "print" statements than Python2 but it is just giving some user feedback in this case and not essential to the running of the script.

@peace-dove
Copy link

Yes I have tested the solution to change "print" to python3-version, it works.(I only test some *.py)
Really thanks.
And I recommend this be added to README.
@craiganderson @skud38000

@TheoklitosFountoulakis
Copy link

I am on python3, i have commented all the print commands, but i am getting an other issue now.
i execute the command manpower.py savegame1936_01.hoi3 GRE 3 and it gives me error :

Traceback (most recent call last):
File "D:\Steam\steamapps\common\Hearts of Iron 3\save games\manpower.py", line 4, in
utility.changeNationSingleLine('manpower=', True, 3)
File "D:\Steam\steamapps\common\Hearts of Iron 3\save games\utility.py", line 180, in changeNationSingleLine
whole_thing = text_file.read()
^^^^^^^^^^^^^^^^
File "C:\Users\Theo\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 10582244: character maps to

Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants