 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Starter_But Advanced Cheater
Reputation: 0
Joined: 26 Oct 2021 Posts: 53
|
Posted: Sun Jul 02, 2023 4:03 pm Post subject: lua script for trainer |
|
|
there is a table with the assembler code
, click on the cross, enter a number and everything works well, how to implement the same, but in the form of a trainer, enter a number and everything works?
address:playerAggro (02390011)
here is the code
| Code: |
define(address, Terraria.Player::ResetEffects+293)
define(bytes, 89 96 2C 03 00 00)
[ENABLE]
assert(address, bytes)
alloc(newmem, 1)
label(code)
label(return)
label(playerAggro)
registersymbol(playerAggro)
newmem:
code:
fild dword ptr [playerAggro]
fistp dword ptr [esi+32C]
jmp return
playerAggro:
dd (int)0
address:
jmp newmem
nop
return:
[DISABLE]
address:
db bytes
//mov [esi+328],edx
unregistersymbol(*)
dealloc(*)
|
thanks to those who tried to help earlier (couldn't answer), but all the methods didn't work, maybe I somehow described my problem wrong, or I'm too stupid to understand something
(I even tried to find a pointer, but even here a failure)
| Description: |
|
| Filesize: |
3.14 KB |
| Viewed: |
3287 Time(s) |

|
|
|
| Back to top |
|
 |
Starter_But Advanced Cheater
Reputation: 0
Joined: 26 Oct 2021 Posts: 53
|
Posted: Mon Jul 03, 2023 4:10 am Post subject: |
|
|
| No help needed, I was able to do it
|
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Mon Jul 03, 2023 4:45 am Post subject: |
|
|
| The least you could do is post the solution so that if others do happen to come across the same problem then they will find the answer.
|
|
| Back to top |
|
 |
Starter_But Advanced Cheater
Reputation: 0
Joined: 26 Oct 2021 Posts: 53
|
Posted: Mon Jul 03, 2023 9:52 am Post subject: |
|
|
| Code: |
local scriptAggro=[[define(address, Terraria.Player::ResetEffects+293)
define(bytes, 89 96 2C 03 00 00)
[ENABLE]
assert(address, bytes)
alloc(newmem, 1)
label(code)
label(return)
label(playerAggro)
registersymbol(playerAggro)
newmem:
code:
fild dword ptr [playerAggro]
fistp dword ptr [esi+32C]
jmp return
playerAggro:
dd (int)0
address:
jmp newmem
nop
return:
[DISABLE]
address:
db bytes
//mov [esi+328],edx
unregistersymbol(*)
dealloc(*)]]
|
in order to enter any value, we need to hook out our address, we register playerAggro in the assembler code, which means that in the furthest solution we will take information from it,
create a script on and off
| Code: |
if CETrainer.rPlayerMobsAgro.Checked then
local r
local originalBytes=nil
r,originalBytes=autoAssemble(scriptAggro)
if not r then
CETrainer.rPlayerMobsAgro.Checked=false
end
else
if originalBytes then
autoAssemble(scriptAggro,originalBytes)
originalBytes=nil
end
end
|
Now, to specify the value we want, it's enough just to add getting an address to the code inclusion section.
| Code: |
if CETrainer.rPlayerMobsAgro.Checked then
local r
local originalBytes=nil
r,originalBytes=autoAssemble(scriptAggro)
tests = string.format('%08X', getAddress('playerAggro'))
valueAggro=tonumber(CETrainer.AgroEf.Text)
writeInteger(tests,valueAggro)
if not r then
CETrainer.rPlayerMobsAgro.Checked=false
end
else
if originalBytes then
autoAssemble(scriptAggro,originalBytes)
originalBytes=nil
end
end
|
I'm not very good at lua, if I accidentally made a mistake somewhere, then please correct
|
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Mon Jul 03, 2023 12:52 pm Post subject: |
|
|
| It's perfectly fine although I don't think any auto assembly is required. This is wholly achievable with Lua. What's important is it works how you intended. Also, thanks for posting the solution for others to see.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|