Anybody know how to make all these hotkeys work with a controller so I'm not forced to split between keyboard and controller? More specifically, the fast sprint. Just want to press my B button on my xbox 1 controller and sprint faster. Maybe edit out the requirement to hold capslock down?
How to use this cheat table?
Install Cheat Engine
Double-click the .CT file in order to open it.
Click the PC icon in Cheat Engine in order to select the game process.
Keep the list.
Activate the trainer options by checking boxes or setting values from 0 to 1
You could use a script, but the problem will be that you run out of buttons and would be losing buttons for the game; you can set it up to work with button combos to help.
Example:
{$lua}
------------------------------ ENABLE ------------------------------
[ENABLE]
local function luaThread(thread)
while RunLuaThread do
local xcs = getXBox360ControllerState()
local mr = nil
if xcs.GAMEPAD_A then
mr = AddressList.getMemoryRecordByDescription('Script description here')
elseif xcs.GAMEPAD_B and xcs.GAMEPAD_A then
mr = AddressList.getMemoryRecordByDescription('Some other Script description here')
end
if mr then
mr.Active = not mr.Active
end
sleep(0)
end
thread.terminate()
end
----------------------------------
if syntaxcheck then return end
RunLuaThread = true
createThread(luaThread)
------------------------------ DISABLE ------------------------------
[DISABLE]
if syntaxcheck then return end
RunLuaThread = false
Thank you soo much for the response! But I still don't know how to integrate to the original script, since one is in assembly and hte other one in lua. I'm guesssing that what your LUA script does is run a script every time I press a button. About running out of buttons, that wouldn't be a problem since the dumb devs forgot that RT and LT existed. It's really a cheap rushed port.
Thank you soo much for the response! But I still don't know how to integrate to the original script, since one is in assembly and hte other one in lua. I'm guesssing that what your LUA script does is run a script every time I press a button. About running out of buttons, that wouldn't be a problem since the dumb devs forgot that RT and LT existed. It's really a cheap rushed port.
...
Basically it's meant to run on it's own as a thread; so just add it to the table and edit the "script description here" part to match the description of the script you want to enable/disable (but it has to be unique and exactly the same text). It just runs a loop until the script is disabled. And to use the triggers just edit the check to be something like this xcs.LeftTrigger > 20. Then you can just enable this script and then it will be checking for the buttons and activate (enable/disable) the scripts when the right buttons are pressed, and you can disable it when you don't want to have it polling; keep in mind this doesn't check for the game to be paused, so it will be polling (possibly enabling and/or disabling scripts) even when you pause the game if you hit the buttons (but with a controller I feel like it won't be that big of a deal).
{$lua}
------------------------------ ENABLE ------------------------------
[ENABLE]
local function luaThread(thread)
while RunLuaThread do
local xcs = getXBox360ControllerState()
local mr = nil
if xcs.LeftTrigger > 20 then
mr = AddressList.getMemoryRecordByDescription('Script description here')
elseif xcs.RightTrigger > 20 then
mr = AddressList.getMemoryRecordByDescription('Some other Script description here')
end
if mr then
mr.Active = not mr.Active
sleep(10) -- wasn't thinking but you'll want a delay between activations,
-- else it would quickly enable than disable again before you let off the buttons.
-- But you might have to play with the delay a bit until it feels right.
end
sleep(0) -- This is needed to stop from freezing CE.
-- Basically a "poll" delay, you can increase this if it seems too fast.
-- But with most games the wait for other threads tends to be enough for me.
end
thread.terminate()
end
----------------------------------
if syntaxcheck then return end
RunLuaThread = true
createThread(luaThread)
------------------------------ DISABLE ------------------------------
[DISABLE]
if syntaxcheck then return end
RunLuaThread = false
And then the cheat script would need to be enabled by default.
If you have any more questions, just quote me; I even tend to replace quoted text with "..." to make it look better. But then the forum will notify me; else I might miss your post.
EDIT:
So looking at the script, it seems this will take a bit more; you'll need a flag to set in the thread checking the controller state. And then check the flag in the script.
Sorry, the above post was assuming the script was a standard constant cheat; I should have looked at the script better.
Ok, so this might work; it has everything in the one script.
[ENABLE]
{$lua}
if not getAddressSafe('flgHotkeyLuaThread') then
allocateSharedMemory('flgHotkeyLuaThread', 1)
registerSymbol('flgHotkeyLuaThread')
end
writeBytes('flgHotkeyLuaThread', 0)
local function hotkeyLuaThread(thread)
local addr = getAddress('flgHotkeyLuaThread')
while RunHotkeyLuaThread do
local xcs = getXBox360ControllerState()
if xcs.LeftTrigger > 20 then
writeBytes(addr, 1)
end
sleep(0)
end
dealloc('flgHotkeyLuaThread')
unregisterSymbol('flgHotkeyLuaThread')
thread.terminate()
end
----------------------------------
if syntaxcheck then return end
RunHotkeyLuaThread = true
createThread(hotkeyLuaThread)
{$asm}
//code from here to '[DISABLE]' will be used to enable the cheat
define(weaponchargeleveldefault,#8000)
aobscanmodule(staminaAndWeaponChargeWriteAOB,Secret_of_Mana.exe,8B 80 ** ** ** ** 89 ** ** ** ** ** ** 8B ** ** 8B ** ** FF)
registersymbol(staminaAndWeaponChargeWriteAOB)
label(dWeaponChargeLevel)
registersymbol(dWeaponChargeLevel)
alloc(newmem,2048)
label(returnhere)
label(originalcode_weaponchargemod)
registersymbol(originalcode_weaponchargemod)
label(exit)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
//cmp edi,#1000
//jle @f
cmp byte ptr [flgHotkeyLuaThread],1
jne @f
mov byte ptr [flgHotkeyLuaThread],0
cmp edi,[dWeaponChargeLevel]
jge @f
mov edi,[dWeaponChargeLevel]
originalcode_weaponchargemod:
readmem(staminaAndWeaponChargeWriteAOB+6,7)
//mov [eax+esi+00000124],edi
exit:
jmp returnhere
///
dWeaponChargeLevel:
dd weaponchargeleveldefault
///
staminaAndWeaponChargeWriteAOB+6: //"Secret_of_Mana.exe"+179892:
jmp newmem
nop
nop
returnhere:
///*****************************************///
aobscanmodule(playerActionWritesAOB,Secret_of_Mana.exe,8B ** ** ** ** ** 89 ** ** ** ** ** ** 8B ** ** ** ** ** ** ** ** ** 59 5E 8B E5 5D C3)
registersymbol(playerActionWritesAOB)
alloc(newmem2,2048)
label(returnhere2)
label(originalcode2_weaponchargemod)
registersymbol(originalcode2_weaponchargemod)
label(exit2)
newmem2: //this is allocated memory, you have read,write,execute access
//place your code here
/*
cmp ecx,3
jl @f
cmp ecx,4
jge @f
*/
push ebx
mov ebx,[controllingFlagReadAOB+2]
cmp dword ptr [esi+ebx],0
pop ebx
jne @f
cmp ecx,3
jne @f
cmp byte ptr [flgHotkeyLuaThread],1
jne @f
mov byte ptr [flgHotkeyLuaThread],0
xor ecx,ecx
originalcode2_weaponchargemod:
readmem(playerActionWritesAOB+6,7)
//mov [edx+eax+00000188],ecx
exit2:
jmp returnhere2
///
playerActionWritesAOB+6: //"Secret_of_Mana.exe"+10A10C:
jmp newmem2
nop
nop
returnhere2:
[DISABLE]
{$lua}
if syntaxcheck then return end
RunHotkeyLuaThread = false
{$asm}
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
staminaAndWeaponChargeWriteAOB+6: //"Secret_of_Mana.exe"+179892:
readmem(originalcode_weaponchargemod,7)
//db 89 BC 30 24 01 00 00
//Alt: mov [eax+esi+00000124],edi
unregistersymbol(originalcode_weaponchargemod)
unregistersymbol(dWeaponChargeLevel)
///*****************************************///
dealloc(newmem2)
playerActionWritesAOB+6: //"Secret_of_Mana.exe"+10A10C:
readmem(originalcode2_weaponchargemod,7)
//db 89 8C 02 88 01 00 00
//Alt: mov [edx+eax+00000188],ecx
unregistersymbol(originalcode2_weaponchargemod)
But yeah, reversing that get controller state function would be a bit much in the script; I think it had 3 different structures to make and deal with just to get the controller state. So I hope this works.
Ok... I give up. lol. It doesn't work on the xbox controller but the same code that you made works on the mouse still. lol. But thank you very much for all your time on this
Sorry, the above post was assuming the script was a standard constant cheat; I should have looked at the script better.
Ok, so this might work; it has everything in the one script.
[ENABLE]
{$lua}
if not getAddressSafe('flgHotkeyLuaThread') then
allocateSharedMemory('flgHotkeyLuaThread', 1)
registerSymbol('flgHotkeyLuaThread')
end
writeBytes('flgHotkeyLuaThread', 0)
local function hotkeyLuaThread(thread)
local addr = getAddress('flgHotkeyLuaThread')
while RunHotkeyLuaThread do
local xcs = getXBox360ControllerState()
if xcs.LeftTrigger > 20 then
writeBytes(addr, 1)
end
sleep(0)
end
dealloc('flgHotkeyLuaThread')
unregisterSymbol('flgHotkeyLuaThread')
thread.terminate()
end
----------------------------------
if syntaxcheck then return end
RunHotkeyLuaThread = true
createThread(hotkeyLuaThread)
{$asm}
//code from here to '[DISABLE]' will be used to enable the cheat
define(weaponchargeleveldefault,#8000)
aobscanmodule(staminaAndWeaponChargeWriteAOB,Secret_of_Mana.exe,8B 80 ** ** ** ** 89 ** ** ** ** ** ** 8B ** ** 8B ** ** FF)
registersymbol(staminaAndWeaponChargeWriteAOB)
label(dWeaponChargeLevel)
registersymbol(dWeaponChargeLevel)
alloc(newmem,2048)
label(returnhere)
label(originalcode_weaponchargemod)
registersymbol(originalcode_weaponchargemod)
label(exit)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
//cmp edi,#1000
//jle @f
cmp byte ptr [flgHotkeyLuaThread],1
jne @f
mov byte ptr [flgHotkeyLuaThread],0
cmp edi,[dWeaponChargeLevel]
jge @f
mov edi,[dWeaponChargeLevel]
originalcode_weaponchargemod:
readmem(staminaAndWeaponChargeWriteAOB+6,7)
//mov [eax+esi+00000124],edi
exit:
jmp returnhere
///
dWeaponChargeLevel:
dd weaponchargeleveldefault
///
staminaAndWeaponChargeWriteAOB+6: //"Secret_of_Mana.exe"+179892:
jmp newmem
nop
nop
returnhere:
///*****************************************///
aobscanmodule(playerActionWritesAOB,Secret_of_Mana.exe,8B ** ** ** ** ** 89 ** ** ** ** ** ** 8B ** ** ** ** ** ** ** ** ** 59 5E 8B E5 5D C3)
registersymbol(playerActionWritesAOB)
alloc(newmem2,2048)
label(returnhere2)
label(originalcode2_weaponchargemod)
registersymbol(originalcode2_weaponchargemod)
label(exit2)
newmem2: //this is allocated memory, you have read,write,execute access
//place your code here
/*
cmp ecx,3
jl @f
cmp ecx,4
jge @f
*/
push ebx
mov ebx,[controllingFlagReadAOB+2]
cmp dword ptr [esi+ebx],0
pop ebx
jne @f
cmp ecx,3
jne @f
cmp byte ptr [flgHotkeyLuaThread],1
jne @f
mov byte ptr [flgHotkeyLuaThread],0
xor ecx,ecx
originalcode2_weaponchargemod:
readmem(playerActionWritesAOB+6,7)
//mov [edx+eax+00000188],ecx
exit2:
jmp returnhere2
///
playerActionWritesAOB+6: //"Secret_of_Mana.exe"+10A10C:
jmp newmem2
nop
nop
returnhere2:
[DISABLE]
{$lua}
if syntaxcheck then return end
RunHotkeyLuaThread = false
{$asm}
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
staminaAndWeaponChargeWriteAOB+6: //"Secret_of_Mana.exe"+179892:
readmem(originalcode_weaponchargemod,7)
//db 89 BC 30 24 01 00 00
//Alt: mov [eax+esi+00000124],edi
unregistersymbol(originalcode_weaponchargemod)
unregistersymbol(dWeaponChargeLevel)
///*****************************************///
dealloc(newmem2)
playerActionWritesAOB+6: //"Secret_of_Mana.exe"+10A10C:
readmem(originalcode2_weaponchargemod,7)
//db 89 8C 02 88 01 00 00
//Alt: mov [edx+eax+00000188],ecx
unregistersymbol(originalcode2_weaponchargemod)
But yeah, reversing that get controller state function would be a bit much in the script; I think it had 3 different structures to make and deal with just to get the controller state. So I hope this works.
is it possible to reset the flag when the xbox button is released in the lua script rather than reset it in the hook? if so I can integrate this lua script to my future key-activated script much easier and cleaner so that user can choose to use keyboard/mouse/or xbox controller...
Ok... I give up. lol. It doesn't work on the xbox controller but the same code that you made works on the mouse still. lol. But thank you very much for all your time on this
are you sure?
I've just read Tim's script, it doesn't listen to the mouse click at all.
it only listens to the xbox360 LeftTrigger.
worst case would be the script won't response to LeftTrigger, but there's no way the script would response to mouse click.
you should double-check if you're actually testing Tim's updated script.
...
is it possible to reset the flag when the xbox button is released in the lua script rather than reset it in the hook? if so I can integrate this lua script to my future key-activated script much easier and cleaner so that user can choose to use keyboard/mouse/or xbox controller...
...
Yeah, I think adding a delay for the activation, then reset the flag if no button is pressed. You might have to play with the dely a bit. But the thing with this is it might be seen by the cheat script more than once, but I think the other way did this too; so I'm guessing the cheat works fine this way.
Ok... I give up. lol. It doesn't work on the xbox controller but the same code that you made works on the mouse still. lol. But thank you very much for all your time on this
I'm thinking you used the second script I posted, the third one is the one that should work. And this being the fourth, should also work.
I don't have the controller, but I just read that
"LeftTrigger: Left trigger (integer ranging from 0 to 255)"
so that means it returns 0 when not pressed I think..
if so, I assume this should work too?
Let me see... I'm trying at this moment
The last one that Tim posted won't activate. The last time I think I actived the old code then pasted the new one.
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
define(weaponchargeleveldefault,#8000)
aobscanmodule(staminaAndWeaponChargeWriteAOB,Secret_of_Mana.exe,8B 80 ** ** ** ** 89 ** ** ** ** ** ** 8B ** ** 8B ** ** FF)
registersymbol(staminaAndWeaponChargeWriteAOB)
label(flgHotkeyLuaThread)
registersymbol(flgHotkeyLuaThread)
label(dWeaponChargeLevel)
registersymbol(dWeaponChargeLevel)
alloc(newmem,2048)
label(returnhere)
label(originalcode_weaponchargemod)
registersymbol(originalcode_weaponchargemod)
label(exit)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
//cmp edi,#1000
//jle @f
//cmp byte ptr [flgHotkeyLuaThread],1
//jne @f
push ebx
mov bl,[flgHotkeyLuaThread]
test bl,bl
pop ebx
jz @f
cmp edi,[dWeaponChargeLevel]
jge @f
mov edi,[dWeaponChargeLevel]
originalcode_weaponchargemod:
readmem(staminaAndWeaponChargeWriteAOB+6,7)
//mov [eax+esi+00000124],edi
exit:
jmp returnhere
///
dWeaponChargeLevel:
dd weaponchargeleveldefault
flgHotkeyLuaThread:
dd 0
///
staminaAndWeaponChargeWriteAOB+6: //"Secret_of_Mana.exe"+179892:
jmp newmem
nop
nop
returnhere:
///*****************************************///
aobscanmodule(playerActionWritesAOB,Secret_of_Mana.exe,8B ** ** ** ** ** 89 ** ** ** ** ** ** 8B ** ** ** ** ** ** ** ** ** 59 5E 8B E5 5D C3)
registersymbol(playerActionWritesAOB)
alloc(newmem2,2048)
label(returnhere2)
label(originalcode2_weaponchargemod)
registersymbol(originalcode2_weaponchargemod)
label(exit2)
newmem2: //this is allocated memory, you have read,write,execute access
//place your code here
/*
cmp ecx,3
jl @f
cmp ecx,4
jge @f
*/
push ebx
mov ebx,[controllingFlagReadAOB+2]
cmp dword ptr [esi+ebx],0
pop ebx
jne @f
cmp ecx,3
jne @f
//cmp byte ptr [flgHotkeyLuaThread],1
//jne @f
push ebx
mov bl,[flgHotkeyLuaThread]
test bl,bl
pop ebx
jz @f
xor ecx,ecx
originalcode2_weaponchargemod:
readmem(playerActionWritesAOB+6,7)
//mov [edx+eax+00000188],ecx
exit2:
jmp returnhere2
///
playerActionWritesAOB+6: //"Secret_of_Mana.exe"+10A10C:
jmp newmem2
nop
nop
returnhere2:
{$lua}
local function hotkeyLuaThread(thread)
local addr = getAddress('flgHotkeyLuaThread')
while RunHotkeyLuaThread do
local xcs = getXBox360ControllerState()
writeBytes(addr, xcs.LeftTrigger)
end
thread.terminate()
end
----------------------------------
if syntaxcheck then return end
RunHotkeyLuaThread = true
createThread(hotkeyLuaThread)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
RunHotkeyLuaThread = false
{$asm}
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
staminaAndWeaponChargeWriteAOB+6: //"Secret_of_Mana.exe"+179892:
readmem(originalcode_weaponchargemod,7)
//db 89 BC 30 24 01 00 00
//Alt: mov [eax+esi+00000124],edi
unregistersymbol(originalcode_weaponchargemod)
unregistersymbol(dWeaponChargeLevel)
unregistersymbol(flgHotkeyLuaThread)
///*****************************************///
dealloc(newmem2)
playerActionWritesAOB+6: //"Secret_of_Mana.exe"+10A10C:
readmem(originalcode2_weaponchargemod,7)
//db 89 8C 02 88 01 00 00
//Alt: mov [edx+eax+00000188],ecx
unregistersymbol(originalcode2_weaponchargemod)
basically it just moved the "flgHotkeyLuaThread" registration from lua to asm.
but I just edited the script on notepad++, I don't have the game installed to test, so....
good luck~
Last edited by Cielos on Sun Sep 30, 2018 6:07 pm, edited 1 time in total.