Victor Vran
Evaluări insuficiente
How to extract victor vran's .hpk files and how to decompile the game's .lua files.
De către Sir.Tomato și colaboratorii 1
Extraction of the .hpk files and decompiling of the .lua files in order for them to be readable.
   
Premiază
Adaugă la preferate
Preferat
Elimină din preferate
Introduction
This guide is ment to explain how one can access the files of the game. This is basically the first step if you want to mod the game. The reason for me writing this guide is the lack of clear explanation how this is done online. I myself struggled a lot with this. Special thanks goes to gunpitchon and evil for taking the time and helping me in solving this problem.
Step 1
Go to https://github.com/nickelc/hpk/releases and download the latest release of the nickelc hpk extracting tool. In my case it was the one called "hpk-v0.3.6-x86_64-pc-windows-msvc.tar.gz".



After you are finished downloading the "hpk-v0.3.6-x86_64-pc-windows-msvc.tar.gz", extract it to a folder of your choice. After the extraction, the nicklc folder should look like this:
Step 2
Now you need to do two things.

First:
Go to the installation folder of the game. Once inside, go into the "Packs". There you need to locate Lua.hpk file, which actually contains the game data. Copy the Lua.hpk to the folder where you earlier extracted the extraction tool.


Second:
You need to create a .bat file or you can alternatively download the one i created.

If you want to create the .bat file yourself, check this guide on how to create a batch (.bat) file:
https://www.windowscentral.com/how-create-and-run-batch-file-windows-10

The newly created batch file has to contain the following:
for %%g in (*.hpk) do mkdir %%~ng
for %%g in (*.hpk) do hpk.exe extract --fix-lua-files "%%g" "%%~ng"
@echo All Done!
pause


Or take the easier way and just download mine ( i gave it the name "extract" for simplicity):
https://drive.google.com/open?id=1ayK9gAo4BJ5bIWsZIR2m-njdpr6Xjmos

To finish this step, paste the .bat file to the folder where you earlier extracted the extraction tool too.


Lastly, double click on the extract.bat. This will open the command promt. Just push the "Space" button on the keyboard, when you are asked to do it.

As a result of your actions, a newly created folder called "Lua" should be created inside the folder where we have the extraction tool, the .bat file and the .hpk file named Lua.
Step 3
What we now need to do is to install java. You can do this from the following link:
https://java.com/en/download/windows-64bit.jsp
Step 4
Create a new folder inside the extraction tool's folder and name it "unluac".


Navigate into the earlier created "Lua" folder and decide for a file you want to decompile. In this example i am going to use Outfit.lua. When you decide for a .lua file, copy it into the newly created "unluac" folder.


Next, download unluac decompiler from here: https://sourceforge.net/projects/unluac/
After finish downloading just copy and paste the file into the newly created "unluac" folder. Don't extract or manipulate the file in any way. Just put it into the "unluac" folder where we earlier pasted the Outfit.lua



Step 5 (Last step)
Open command prompt and navigate to wherever you placed the "unluac" folder.


Once you are there, type the following inside the command promt and press "Enter" :
java -jar unluac_2015_06_13.jar outfit.lua > outfit_decompiled.lua

where outfit should be changed with the name of your .lua file.


Result

A newly decompiled and perfectly readable and editable outfit_decompiled.lua file is created. From there you are free to edit it.




9 comentarii
Noobopensource 26 oct. 2022 la 18:54 
I'm playing Stranded alien dawn which also uses hpk file, thanks for the tutorial, it helped me to see a little bit what I had inside the game, although I couldn't change anything, I think I would have to recompile the lua files to hpk again, in a rough way, but that I still don't know how to do.
ChoGGi 9 dec. 2020 la 6:19 
*works with
ChoGGi 9 dec. 2020 la 6:18 
If you want I have an autohotkey script to batch decompile SM luac files (it also works work VV).
https://github.com/ChoGGi/SurvivingMars_CheatMods/tree/master/Decompile%20LUA
Sir.Tomato  [autor] 27 nov. 2020 la 14:19 
Hey stylez. Sadly me personally still havent experimented ( one of my to do for next year i guess). However, there are some people who experimented. The best thing to do is join the discord server if discord is your thing. Avasark ( the user who posted the first comment here) experimented with the weapons. Here are some of his youtube videos with some weapon modifications:
https://youtu.be/idwPHzoQzCE
https://youtu.be/PcrINjCJfoQ
https://youtu.be/OLioj8O35Go

For the time being i cant help further sadly. Still feel free to ask :)
stylez 27 nov. 2020 la 13:55 
Thanks. I ended up using the console mod (plus the required modloader) along with the decompiled lua from this guide as a jumping point for my purposes. The modloader is more or less what you described - recompiled lua, or lua packaged up as a DLC -- which just looks for & executes other lua files in the mods folder.

I wanted to play around with item attributes, try beefing up some of the borderline-useless skills, and seeing what sort of effort is required to create "new" spells and items (using existing gfx but different name, stats, etc.; maybe a palette shift if possible?...haven't got that far yet).

I'm also curious if weapon effects are easily altered - if the guitar notes can be a dynamic number of projectiles with varied paths. I think the weapons could have been much more fun & varied with not much effort.
Sir.Tomato  [autor] 27 nov. 2020 la 12:56 
stylez, i never went that far. You can check lukeh_ ro mods on nexus to see how he did it. The noob way would be to recompile the games Lua file after you replace f.e. the original Outfits.lua with the edited one from you. You can check the victor vran discord. I think he posted more info about this some time ago.
stylez 8 nov. 2020 la 19:41 
What steps are needed for the game to see the changed data?
lukeh_ro 17 mart. 2020 la 12:48 
Here's a script to decompile all the luas. Is linux but can work from Linux subsystem in Win 10 if Java is installed there. Put that in a .sh file in the folder where you put the jar and the files from hpk:

#!/bin/bash
for i in $(find . -type f -regex ".*\.\(lua\)" -follow -print);do
install -D /dev/null "../decompiled/${i:2}"
java -jar unluac_2015_06_13.jar "$i" > "../decompiled/${i:2}"
done
avasark ♫ 14 ian. 2020 la 4:12 
Thanks for this guide, that was very useful !