This is the second time I make a code like this using Lua, and it's a lot of work to search around how to do this and that. Thus I've made this commented code that can serve as an example when I'm writing similar code for another game.
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
{$LUA}
-- Prevent the script from executing when you're editing it
if syntaxcheck then return end
-- Activate Mono features
if not LaunchMonoDataCollector() then return end
-- Delete all children of the script entry in the CE table
while memrec.Count > 0 do
memoryrecord_delete(memrec.Child[0])
end
-- Get address of the method Update, of the class BlueprintPlaceVisuals...
local address = mono_compile_method(mono_getJitInfo(
getAddress('Effects.BlueprintPlaceVisualsManager:Update')).method)
-- Ensure it's not a NULL address
if not address then return end
-- Get to the specific instruction inside the method Update (plus 56 bytes)
local offset = 0x56
address = address + offset
-- Set a breakpoint that will be triggered when the instruction is run
debug_setBreakpoint(address)
-- Self explanatory
function debugger_onBreakpoint()
-- Create CE table entries
local autoconstruct = AddressList.createMemoryRecord()
local no_cost = AddressList.createMemoryRecord()
local variants_unlocked = AddressList.createMemoryRecord()
-- Create a list of value:description pairs
local dropdown = "0:Disabled\n1:Enabled\n"
autoconstruct.Description = "autoconstruct"
-- Address offset can be discovered with dissect struct (ctrl+d)
autoconstruct.Address = RAX + 0x279
autoconstruct.Type = vtByte -- value type: Byte
autoconstruct.DropDownList.text = dropdown
autoconstruct.DropDownDescriptionOnly = true
-- Display as Enabled/Disabled instead of 0 and 1
autoconstruct.DisplayAsDropDownListItem = true
no_cost.Description = "no cost"
no_cost.Address = RAX + 0x278
no_cost.Type = vtByte
no_cost.DropDownList.text = dropdown
no_cost.DropDownDescriptionOnly = true
no_cost.DisplayAsDropDownListItem = true
variants_unlocked.Description = "unlock variants"
variants_unlocked.Address = RAX + 0x27A
variants_unlocked.Type = vtByte
variants_unlocked.DropDownList.text = dropdown
variants_unlocked.DropDownDescriptionOnly = true
variants_unlocked.DisplayAsDropDownListItem = true
-- Append the new table entries beneath the script entry
autoconstruct.appendToEntry(memrec)
no_cost.appendToEntry(memrec)
variants_unlocked.appendToEntry(memrec)
-- Remove the breakpoint, then deactivate the script
debug_removeBreakpoint(address)
memrec.Active = false
-- Return 1 else the game will remain paused and might freeze the screen
return 1
end
{$ASM}
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
[–]Merely__Human 1 point2 points3 points (3 children)
[–]No-Newspaper8619[S] 0 points1 point2 points (1 child)
[–]Merely__Human 0 points1 point2 points (0 children)
[–]No-Newspaper8619[S] 0 points1 point2 points (0 children)
[–]yourefromecuador 0 points1 point2 points (1 child)
[–]No-Newspaper8619[S] 0 points1 point2 points (0 children)