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 change a value IMMEDIATELY??
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Sohail__Saha
Advanced Cheater
Reputation: 0

Joined: 21 May 2014
Posts: 82
Location: India

PostPosted: Sun Jun 15, 2014 12:39 pm    Post subject: How to change a value IMMEDIATELY?? Reply with quote

Using Auto Assembler scripts to increase health, the health only increases if I get hurt. Is there a way to immediately change the health value??
Confused
Code:

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,512)
label(returnhere)
label(exit)

newmem:
mov [edi+14],(float)44425.0

exit:
jmp returnhere

"Dunia.dll"+52221C:
jmp newmem
returnhere:


[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Dunia.dll"+52221C:
movss [edi+14],xmm0
//Alt: db F3 0F 11 47 14

_________________
Don't underestimate the power of a common code.
Laughing
Back to top
View user's profile Send private message Visit poster's website
AbrasiveZealot
Newbie cheater
Reputation: 0

Joined: 02 Jan 2011
Posts: 21

PostPosted: Sun Jun 15, 2014 1:23 pm    Post subject: Reply with quote

There's 2 methods that I find useful, but they both require a pointer to your health.

1. Hook somewhere else in the game code that is constantly updating something (player position for example)
2. Use a createthread loop to constantly overwrite the data.
Back to top
View user's profile Send private message
Sohail__Saha
Advanced Cheater
Reputation: 0

Joined: 21 May 2014
Posts: 82
Location: India

PostPosted: Mon Jun 16, 2014 12:07 pm    Post subject: Reply with quote

Please can you elaborate the 2nd option, because in the 1st option, the value gets constantly updated only when the script is addressed to change the value... Confused
_________________
Don't underestimate the power of a common code.
Laughing
Back to top
View user's profile Send private message Visit poster's website
Redouane
Master Cheater
Reputation: 3

Joined: 05 Sep 2013
Posts: 363
Location: Algeria

PostPosted: Mon Jun 16, 2014 12:35 pm    Post subject: Reply with quote

Sohail__Saha wrote:
Please can you elaborate the 2nd option, because in the 1st option, the value gets constantly updated only when the script is addressed to change the value... Confused


You'll need a pointer to the address of the value that you want to change,if you have one,then post it here and I'll make scripts for you,you can't do anything without a pointer.

There's a third option,this one is elegant:using Lua,you can make it write the value constantly,or just write it once,again,a pointer is needed.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Mon Jun 16, 2014 2:10 pm    Post subject: Re: How to change a value IMMEDIATELY?? Reply with quote

Sohail__Saha wrote:
Using Auto Assembler scripts to increase health, the health only increases if I get hurt. Is there a way to immediately change the health value??
-Use an instruction that accesses your health...not writes to it. If there are none, follow what others have said and try injecting somewhere else (within the same structure), or use a pointer (with or without a script).
Back to top
View user's profile Send private message
shakib187
Expert Cheater
Reputation: 0

Joined: 24 May 2007
Posts: 215

PostPosted: Mon Jun 16, 2014 3:23 pm    Post subject: Re: How to change a value IMMEDIATELY?? Reply with quote

++METHOS wrote:
Sohail__Saha wrote:
Using Auto Assembler scripts to increase health, the health only increases if I get hurt. Is there a way to immediately change the health value??
-Use an instruction that accesses your health...not writes to it. If there are none, follow what others have said and try injecting somewhere else (within the same structure), or use a pointer (with or without a script).


Pretty much this, because chances are that instruction is constantly updating like every 1 ms

You can also change CE update timers from 500ms to 1ms. I'm unsure if auto assemble is applied for that though
Back to top
View user's profile Send private message
Redouane
Master Cheater
Reputation: 3

Joined: 05 Sep 2013
Posts: 363
Location: Algeria

PostPosted: Mon Jun 16, 2014 4:58 pm    Post subject: Re: How to change a value IMMEDIATELY?? Reply with quote

shakib187 wrote:
++METHOS wrote:
Sohail__Saha wrote:
Using Auto Assembler scripts to increase health, the health only increases if I get hurt. Is there a way to immediately change the health value??
-Use an instruction that accesses your health...not writes to it. If there are none, follow what others have said and try injecting somewhere else (within the same structure), or use a pointer (with or without a script).


Pretty much this, because chances are that instruction is constantly updating like every 1 ms

You can also change CE update timers from 500ms to 1ms. I'm unsure if auto assemble is applied for that though


Injecting code in an instruction that gets accessed frequently will work,but it won't write the value immediately,for example,the code that accesses the health might not get executed when the program is paused,so if you enable,then disable the script without unpausing the game,nothing will change,however,if you use createthread or the Lua solution,then enabling the script will modify the values immediately.

Consider the following situation:You are playing a game where there is a powerup:invisible mode that lasts until you finish a level,you are doing code injection in the part that accesses your invisible flag (it's 0 when false and 1 when true) to give yourself the powerup,you enable the script and everything works correctly,then when you'll disable the script,you'll still have that powerup,even if the disable part restored the original code,you'll have to use either luacall or createthread to set it to 0.

Also,the code that reads your hp might access other structures (enemies hp).

Again,post your pointer and I'll use different approaches to show you how to do it.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Mon Jun 16, 2014 6:45 pm    Post subject: Reply with quote

Redone wrote:

Injecting code in an instruction that gets accessed frequently will work,but it won't write the value immediately,for example,the code that accesses the health might not get executed when the program is paused,so if you enable,then disable the script without unpausing the game,nothing will change,however,if you use createthread or the Lua solution,then enabling the script will modify the values immediately.
-Depends on the instruction, actually. But really, there is no need for the health to get updated while the game is paused. While the game is unpaused, the health will get updated instantly.

Redone wrote:

Consider the following situation:You are playing a game where there is a powerup:invisible mode that lasts until you finish a level,you are doing code injection in the part that accesses your invisible flag (it's 0 when false and 1 when true) to give yourself the powerup,you enable the script and everything works correctly,then when you'll disable the script,you'll still have that powerup,even if the disable part restored the original code,you'll have to use either luacall or createthread to set it to 0.
-All you have to do is write the enable/disable function in to the script...and just let script run always.

There are disadvantages to using pointers, so it is preferable to reserve them as a last resort.
Back to top
View user's profile Send private message
Redouane
Master Cheater
Reputation: 3

Joined: 05 Sep 2013
Posts: 363
Location: Algeria

PostPosted: Tue Jun 17, 2014 3:52 am    Post subject: Reply with quote

++METHOS wrote:

-Depends on the instruction, actually. But really, there is no need for the health to get updated while the game is paused. While the game is unpaused, the health will get updated instantly.


The OP said that he wants to change the value immediately when the script gets enabled.

Yes,as I said,it should work fine that way,I generally inject code in the part that accesses hp,but I also inject in the part that changes the hp,because you may still die even if you set your hp to 100 every second and take more than 100 damage at once,the code that checks if your hp is greater than 0 is generally below the one that writes to your hp.
In the disable part,to restore the old hp value,you could add a 'luacall(hp = readFloat( readInteger( 'lvlonepointer' ) ) )'
and in the disable part,a 'luacall(writeFloat( readInteger( 'lvlonepointer' , hp ) ) )'


++METHOS wrote:

-All you have to do is write the enable/disable function in to the script...and just let script run always.


Then what if you want to disable it?If you are giving your table to other people,then you should expect them to try out every script,also,it's easy to restore the original value even without using a pointer,example code:
Code:
[enable]
alloc(m,1024)
registersymbol(m)
m:
dw 0
lea ebx,[ecx+4] //ebx gets changed anyway
mov [m],ebx
mov [ecx+4],1
mov ebx,[ecx+4] // This reads
jmp 'addressofjumpedcode'+5
'addressofjumpedcode':
jmp m+4
db 90
[disable]
luacall(writeInteger( readInteger'm' , 0 ) )
dealloc(m)
'addressofjumpedcode':
db ?? ?? ?? ?? ?? ?? //Restore original bytes
unregistersymbol(m)
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Tue Jun 17, 2014 5:16 am    Post subject: Reply with quote

Redone wrote:
The OP said that he wants to change the value immediately when the script gets enabled.
-I did read it. My reply is the same.

Redone wrote:
Yes,as I said,it should work fine that way,I generally inject code in the part that accesses hp,but I also inject in the part that changes the hp,because you may still die even if you set your hp to 100 every second and take more than 100 damage at once,the code that checks if your hp is greater than 0 is generally below the one that writes to your hp.
-NOP'ing the write instruction is common sense, but that's irrelevant.

Redone wrote:
Then what if you want to disable it?
-I assume you mean disable the script? Why couldn't they?

Redone wrote:
If you are giving your table to other people,then you should expect them to try out every script
-Not sure what you're saying here. Even with consolidated scripts, enable/disable functions can be written in for every cheat.

Redone wrote:
also,it's easy to restore the original value even without using a pointer,example code:
-No one is arguing that. You were touting the use of pointers, not me. I think scripts are better.

There is no right or wrong, just preferred. There is also nothing wrong with using LUA, if you know how. I'd like to learn more, myself.
Back to top
View user's profile Send private message
Redouane
Master Cheater
Reputation: 3

Joined: 05 Sep 2013
Posts: 363
Location: Algeria

PostPosted: Tue Jun 17, 2014 7:52 am    Post subject: Reply with quote

++METHOS wrote:
-I assume you mean disable the script? Why couldn't they?


++METHOS wrote:
If you are giving your table to other people,then you should expect them to try out every script-Not sure what you're saying here. Even with consolidated scripts, enable/disable functions can be written in for every cheat.


If you restore only the original code in the disable part,it won't restore the original value,so it may still have the 'enabled' effect in the game,and you cannot restore the original value without using createthread or luacall,sorry if I was not clear enough.
Back to top
View user's profile Send private message
NanoByte
Expert Cheater
Reputation: 1

Joined: 13 Sep 2013
Posts: 222

PostPosted: Tue Jun 17, 2014 8:00 am    Post subject: Reply with quote

make a alloc store value of [edi+14] into it then you can add it manually then edit it as you wish no need to get complicated.
Back to top
View user's profile Send private message
Sohail__Saha
Advanced Cheater
Reputation: 0

Joined: 21 May 2014
Posts: 82
Location: India

PostPosted: Tue Jun 17, 2014 12:28 pm    Post subject: Reply with quote

Woh Woh Guys, I need a SOLUTION, not more questions...
And that pointer is---> [edi+14]

_________________
Don't underestimate the power of a common code.
Laughing
Back to top
View user's profile Send private message Visit poster's website
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Tue Jun 17, 2014 12:47 pm    Post subject: Reply with quote

Several solutions have already been given.
Back to top
View user's profile Send private message
NanoByte
Expert Cheater
Reputation: 1

Joined: 13 Sep 2013
Posts: 222

PostPosted: Tue Jun 17, 2014 2:21 pm    Post subject: Reply with quote

add address manually with a pointer which should be 0

Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,64)
globalalloc(_health,8)
label(returnhere)
label(exit)

newmem:
push eax
lea eax,[edi+14]
mov [_health],eax
pop eax
movss [edi+14],xmm0

exit:
jmp returnhere

"Dunia.dll"+52221C:
jmp newmem
returnhere:


[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Dunia.dll"+52221C:
movss [edi+14],xmm0
unregistersymbol(_health) //remove this line if you want the pointer to work efter you disable the cheat
//Alt: db F3 0F 11 47 14
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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