Post by Alazar on Apr 22, 2021 4:03:22 GMT
I recommend using wolf109909's lua injector application, it's a lot more convenient than this manual method of running scripts. You would still embed the modified Tick.lua into Journey.exe the same way that is described here - you can use the Tick.lua.gz which is on github and just skip to the instructions about embedding it in Journey.exe. If you want to put more extra stuff in the embedded lua, take Tick.lua from github, then modify it and zip/embed it.
This tutorial shows a way to access/edit the Lua scripts that Journey runs, and inject your own Lua code to play around with the debug functions (including "Rocket Death Match" mode), then you can build off of that to do more advanced stuff if you know how or figure it out. I don't really know enough about Lua yet to provide any more details about how to do certain things.
This tutorial shows a way to access/edit the Lua scripts that Journey runs, and inject your own Lua code to play around with the debug functions (including "Rocket Death Match" mode), then you can build off of that to do more advanced stuff if you know how or figure it out. I don't really know enough about Lua yet to provide any more details about how to do certain things.
Injections might only work on PC, but I assume even on PS3 you could at least edit Tick.lua in the eboot to run debug functions/etc.
This is one of the types of modding/hacking that can easily be noticed by other players depending on what you do, so please remember to be considerate of others - if you change anything which seems like it might be detectable in-game, it is probably best to only do it while offline, or with companions who you know are also modding/hacking, or who you at least know they won't mind.
To start off, you will need a hex editor like HxD, a gzip archiver like 7-Zip, and it would be helpful to have an improved text editor like Notepad++.
1. Editing and replacing the .lua files Journey uses
Open Journey/Data/Scripts/__Tick.lua.gz with 7-Zip/etc, and extract Tick.lua.
Open Tick.lua in a text editor and go to the bottom where it has the Tick() function.
Delete most of the commented lines which start with "--" (so you have extra space to add code without overflowing later).
Create a variable equal to zero outside the function to use as an iterator/timer, and put a dofile command inside the function so that every frame it will load and execute some other .lua (which can be called whatever you want). For example:
tickTimer = 0
-- Tick()
function Tick( game, gameTiming, input )
dofile("CustomLua.lua")
end
Save Tick.lua.
Make a copy of __Tick.lua.gz, name it whatever you want, and open it with 7-Zip. Drag your modified Tick.lua file into the 7-Zip window, so that it overwrites the Tick.lua file inside the archive.
Make a backup copy of Journey.exe, then use HxD to open both Journey.exe and your modified .lua.gz archive.
Select all of the hex data in the .lua.gz archive and copy it.
In Journey.exe, search for "Tick.lua", and find the instance that is surrounded by random-looking text.
Put your cursor in front of the nearby "1F 8B 08 08" hex data, and right click or do Edit > Paste Write (not Paste Insert, which makes the file size bigger and makes the .exe not work).
Select all of the data between what you pasted (which will be red text) and the next "1F 8B 08 08" (which should be at offset 035841A0), and right click or do Edit > Fill Selection, then pick "Zerobytes" and OK to fill it with 00 hex data. Save Journey.exe.
( This process can also be used to modify any other .lua script that is embedded in Journey.exe, as long as you keep the .exe file size from changing. This includes level resource scripts like TriggerInstances.lua, TimelineInstances.lua, etc, although I don't yet know which levels are at which parts of the .exe; you could do the process in reverse to extract any .lua.gz from the .exe and figure it out. The embedded .lua.gz files always start with "1F 8B 08 08", so search by hex value for that in order to find them all. Also I think the level 09 toolset includes tools to automatically extract/replace .lua files if you get it set up?)
2. Lua Injection
Create a text file with the same name as in the dofile() command - from the earlier example, this would be "CustomLua" - and change the file extension to .lua; put this file in the same folder as Journey.exe.
Use a text editor to write whatever kind of Lua script you want in it. Every frame, the game will load and run the whole script; you are able to edit/save the file while playing, and the game will immediately start running the script based on your new edits.
If you don't want a script to be running every frame, you can write a basic iterator function to make the game run a particular script just once, and then call the function. You can run the function again by resetting your iterator variable. For example, your .lua file could look like this:
function RunOnce()
if tickTimer < 60 then
tickTimer = tickTimer + 1
elseif tickTimer == 60 then
--Put whatever script you want to run here--
tickTimer = 9001
end
end
tickTimer = 0
RunOnce()
In the code above, if you comment out "tickTimer = 0" by putting "--" in front of it ("--tickTimer = 0") and save the file, the script you want will run after 60 frames. Then to run the script again (or run a new script you wrote into the same function), you would remove the "--", save the file, put the "--" back, and save the file again.
3. Possibilities
You can run any sort of standard Lua script, as well as any game functions which you may be able to figure out.
Try looking through the other Lua script copies in the Data/Scripts folder; the Lua scripts which are inside Journey.exe in plain text; and the object/function names listed in the plain-text debug logs which are in Journey.exe for some reason.
Quite a few of the DebugKeys functions can be accessed; for example in DebugKeys.lua it has:
, { Key = 'Q'
, Desc = "Toggle DM mode"
, Action = function( game ) ToggleDMActive( game ) end }
...and if you just run "ToggleDMActive( game )" in your script, it will toggle "Rocket Death Match" mode - although unfortunately, companions will not be able to see or interact with your rockets/explosions/craters, they will only see that you are moving around differently because of the alternate controls.
Other debug functions would be pulled out and used the same way.
Here are a few functions that need a little tweaking to work:
- The key-based inputs don't work because the game apparently treats the keyboard as a controller, and it might not be possible to get true controller input (maybe a DualShock controller could work). On keyboard/XBox360 controller, outside of the menu screen you can get input for all the bound controls with these functions: game:input():GetPad(0):IsAnyButtonDown(), ...IsButtonDown(#), ...WasButtonPressed(#), WasButtonReleased(#), ...Button(#),...Left(), ...Right(). #'s for buttons are 0 = menu, 12 = fly, 13 = chirp, 19 = pause. Left() and Right() return tables for the "joystick" position, or WASD/etc: neutral is {0.0, 0.0, 0.0}, first float is left(-1.0)/right(1.0), second float is up(-1.0)/down(1.0).
- To enable NetGui HUD, first you need to do Vars.Game.cheatsEnabled(true), then game:netGui():ToggleEnabled(). Move up and down in the menu with W/S, and use game:netGui():ExecuteSelectedItem(game) to select something.
- DumpMetaSys() will crash your game and not actually dump anything, instead make your own function with a modification of the original script found in Tick.lua. This one will output to a file in your Journey folder:
function DumpMetaSystem()
out = io.open( "Metasystem.lua", "w+" )
PrintMeta( out )
out:close()
end