Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How to do a script which change a value and freeze it

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
PtitSerpent
How do I cheat?
Reputation: 0

Joined: 17 Jun 2020
Posts: 9
Location: France, Normandy

PostPosted: Wed Jun 17, 2020 7:03 am    Post subject: How to do a script which change a value and freeze it Reply with quote

Hi all,
Sorry to bother you with this simple question, but i don't really understand how to script this little thing...
I want to make a trainer for the game "Witch Hunt", and i want to activate a "no reload" function on my weapon.
I found a pointer which is equal to "0" or "1". This pointer is exactly what i need to do the trick (if I freeze the value to "1", then i can shoot without reloading).

Now i want to make my trainer, but I don't know how to bind a script to my button, and I don't know how to do this little script.
I just need to change the value to "1" and freeze it, i think it's not really hard to do but i don't know where to go ^^

Can someone help me ?
Thank you Smile
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 98

Joined: 14 Jul 2007
Posts: 3349

PostPosted: Thu Jun 18, 2020 3:32 am    Post subject: Reply with quote

Sure thing, seems you've done the hard part already.

Add the pointer to the address list and see what sets it to 0 or checks for a 1.
Then, use an AA template to either NOP the instruction or set it to 1.

Note: if enemies use it, they'll benefit from this, too - if that happens, you will need to build in a player check.

You can make a trainer from an AA script, but you can also assign hotkeys in the address list. AA scripts are easier to maintain and edit. Up to you.

Good luck!
Back to top
View user's profile Send private message
PtitSerpent
How do I cheat?
Reputation: 0

Joined: 17 Jun 2020
Posts: 9
Location: France, Normandy

PostPosted: Thu Jun 18, 2020 7:36 am    Post subject: Reply with quote

Thanks for your reply Smile

So i tried to use my pointer to make my script, here are my steps :
- Right-click on my pointer and choose "Find out what writes to this address"
- Select "Find what writes the address pointed at by this pointer" (the first option didn't find anything)
- In-game, I shot one bullet
- An event was found, so i click on "Show disassembler"
- In "Tools", i select "Auto Assemble"
- Here, i create an AOB Injection template and i replace the line of code which remove my bullet (here that's mov [rax+0000022C],ecx)
- A little code for disabling my script and that's good to go (just a copy of the previous instruction, in red)
- Next "File -> Assign to current cheat table"

Nice, if I activate my script, it works Cool !!!

But if I close the game, disable my script, and restart the game, it doesn't work anymore Crying or Very sad

What's my problem here ? my pointer is correct but the address in the instruction is wrong ? Or something else ?
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 98

Joined: 14 Jul 2007
Posts: 3349

PostPosted: Thu Jun 18, 2020 12:13 pm    Post subject: Reply with quote

First off, congrats!

If you close the game, you need to attach CE to the process again and enable the script as well.
Back to top
View user's profile Send private message
PtitSerpent
How do I cheat?
Reputation: 0

Joined: 17 Jun 2020
Posts: 9
Location: France, Normandy

PostPosted: Thu Jun 18, 2020 1:41 pm    Post subject: Reply with quote

Yep I did this, obviously Laughing, but it didn't work :/
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 98

Joined: 14 Jul 2007
Posts: 3349

PostPosted: Fri Jun 19, 2020 5:25 am    Post subject: Reply with quote

In that case, I think the code may be at a different location at each game start and you need to turn your script into what we call an AOB script.
It means that rather having an instruction replaced at a fixed address, you do an AOB scan - which will try to find the correct instruction and once found, you replace the instruction at that location.
Back to top
View user's profile Send private message
PtitSerpent
How do I cheat?
Reputation: 0

Joined: 17 Jun 2020
Posts: 9
Location: France, Normandy

PostPosted: Fri Jun 19, 2020 5:38 am    Post subject: Reply with quote

I'll try to find how to do this thanks Wink

In Auto Assembler window, i found out that the "Injection Point" is not the same when i restart the game.

Ex :
Code:
   
aobscan(INJECT,89 88 2C 02 00 00 48 8B 46 10 0F) // should be unique
alloc(newmem,$1000,163BDC04)


Here, the "163BDC04" will change.

So is your statement correct ? The game change the location of this instruction each time I restart ?


The code below is what i use to activate the "No reload" cheat :
Code:


[ENABLE]

aobscan(INJECT,89 88 2C 02 00 00 48 8B 46 10 0F) // should be unique
alloc(newmem,$1000,163BDC04)

label(code)
label(return)

newmem:

code:
  mov [rax+0000022C],1
  jmp return

INJECT:
  jmp newmem
  nop
return:
registersymbol(INJECT)

[DISABLE]

INJECT:
  db 89 88 2C 02 00 00

unregistersymbol(INJECT)
dealloc(newmem)


The code below is my instruction :
Code:
mov [rax+0000022C],1

I've just changed the "eax" to "1" (with that i always have an ammo in my rifle.
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 98

Joined: 14 Jul 2007
Posts: 3349

PostPosted: Fri Jun 19, 2020 6:52 am    Post subject: Reply with quote

Replace "163BDC04" wiith "INJECT", that will take care of the address changes.

Other than that, it should work now every time, as long as the AOB signature is unique and it is found.

Pretty solid work for someone with just 3 posts, congrats!

Here you will find some more templates - including the ones I use. *shameless advertisement* Very Happy

And this hack here inserts more instructions into the comments - makes future updates somewhat easier, especially in case of dynamically generated code.
Back to top
View user's profile Send private message
PtitSerpent
How do I cheat?
Reputation: 0

Joined: 17 Jun 2020
Posts: 9
Location: France, Normandy

PostPosted: Fri Jun 19, 2020 7:52 am    Post subject: Reply with quote

Csimbi wrote:
Replace "163BDC04" wiith "INJECT", that will take care of the address changes.
Other than that, it should work now every time, as long as the AOB signature is unique and it is found.

You're a beast, it works like a charm ! Surprised Surprised Surprised

Csimbi wrote:

Pretty solid work for someone with just 3 posts, congrats!

It's really kind of you Embarassed, but I'm a web developer so I already have some useful skills to quickly understand Wink

Csimbi wrote:
Here you will find some more templates - including the ones I use. *shameless advertisement* Very Happy
And this hack here inserts more instructions into the comments - makes future updates somewhat easier, especially in case of dynamically generated code.

Thanks for those links Very Happy, I need more training for using it but I'm keeping it close at hand Wink

I can make a wonderful trainer with that now Surprised !
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites