|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
squall0833 Cheater Reputation: 0
Joined: 20 Oct 2012 Posts: 35
|
Posted: Tue Feb 02, 2016 4:14 pm Post subject: Is it possible to make double damage taken? |
|
|
I know this may sound stupid, why would anyone makes double damage taken, lol, I'm trying to understand something and to do some experiment,
english is not my first language, hopefully you all understand what I'm trying to say,
lets say, what I found
what writes to health:
mov [edx],eax
and the memory viewer shows what before that line:
mov eax,[ebp-10] (registering new health value)
mov [edx],eax (writes new health value to the address)
if the value of ebp-10 is the new health after damage taken,
in this case, is it possible to write code that "doubles the damage taken" to the new health value ([ebp-10])?
(I don't think it's possible in this case)
is it only possible if the instruction is telling eax the amount of damage and subtract to [edx]?
i.e
mov eax,[ebp-10] (let's say if ebp-10 is the amount of damage)
sub [edx],eax
can I change eax by multiply its existing value?
if [ebp-10] value is 20 (20 damage), and [edx] is health 100
mov eax,[ebp-10] register 20 to eax,
I want to make this eax become double, by multiple it with x2 so it will become eax = 40
then finally sub [edx],eax which is health 100 - 40 = 80
is it possible to do something like this?
So I can do something like, buy a $100 item in game, but it will cost me $200, buy $500 item, cost me $1000.
I would greatly appreciate if you can help, thanks
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Tue Feb 02, 2016 4:38 pm Post subject: |
|
|
Code: | mov eax,[ebp-10]
sub eax,[edx]
add eax,[ebp-10]
mov [edx],eax |
Lets say the old value ([edx]) equals 5,000.
Lets say the new value ([ebp-10]) equals 4,000.
Move 4,000 into EAX.
Subtract 5,000 from 4,000, giving -1,000 (negative).
Add to that -1,000 the new value (4,000), giving 3,000.
You have now subtracted double the amount.
|
|
Back to top |
|
|
squall0833 Cheater Reputation: 0
Joined: 20 Oct 2012 Posts: 35
|
Posted: Tue Feb 02, 2016 4:56 pm Post subject: |
|
|
Zanzer wrote: | Code: | mov eax,[ebp-10]
sub eax,[edx]
add eax,[ebp-10]
mov [edx],eax |
Lets say the old value ([edx]) equals 5,000.
Lets say the new value ([ebp-10]) equals 4,000.
Move 4,000 into EAX.
Subtract 5,000 from 4,000, giving -1,000 (negative).
Add to that -1,000 the new value (4,000), giving 3,000.
You have now subtracted double the amount. |
wow i didnt know it could be done like this, so simple, really thanks
So how about if i want to make it 10 times or any multiply number i want? It cannot be done by using some sort of calculation formula in the code?
Last edited by squall0833 on Tue Feb 02, 2016 5:05 pm; edited 1 time in total |
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Tue Feb 02, 2016 5:04 pm Post subject: |
|
|
Code: | push edx
push ebx
mov ebx,edx
xor edx,edx
mov eax,[ebx]
sub eax,[ebp-10]
mul eax,#10
sub [ebx],eax
pop ebx
pop edx |
|
|
Back to top |
|
|
squall0833 Cheater Reputation: 0
Joined: 20 Oct 2012 Posts: 35
|
Posted: Tue Feb 02, 2016 5:22 pm Post subject: |
|
|
Zanzer wrote: | Code: | push edx
push ebx
mov ebx,edx
xor edx,edx
mov eax,[ebx]
sub eax,[ebp-10]
mul eax,#10
sub [ebx],eax
pop ebx
pop edx |
|
Mind to explain what is the purpose to push ebx edx , xor edx,edx ?
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Tue Feb 02, 2016 6:34 pm Post subject: |
|
|
The pushes/pops are used to save whatever value is currently in those registers, since later code probably needs them.
The XOR is used to simply zero out EDX, as it is used within the multiplication.
|
|
Back to top |
|
|
squall0833 Cheater Reputation: 0
Joined: 20 Oct 2012 Posts: 35
|
Posted: Wed Feb 03, 2016 8:07 am Post subject: |
|
|
Zanzer wrote: | The pushes/pops are used to save whatever value is currently in those registers, since later code probably needs them.
The XOR is used to simply zero out EDX, as it is used within the multiplication. |
the push and pop for save their current values to prevent possibly game crash if the later codes need them?
and for the changing edx to 0 for multiplication
i dont really get it because there isn't edx in multiplication
mind to explain how that works and why multiplication needs that?
I'm new to assembly instruction, havent really try more complex ones, I'm still learning this
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Wed Feb 03, 2016 11:57 am Post subject: |
|
|
Think I screwed up the previous code. I don't multiply much.
Code: | mov eax,[edx] // retrieve current value
sub eax,[ebp-10] // subtract the new value
push edx // backup the register
mov edx,#10 // set the multiplier
mul edx // result is now in eax
pop edx // restore the register
sub [edx],eax // subtract the result |
Note that when you multiple two 4-byte values together, the result could take up 8 bytes.
In order to store those 8 bytes, the result is stored across registers EDX and EAX.
Since your numbers shouldn't be that huge, you only need to deal with the result in EAX.
|
|
Back to top |
|
|
squall0833 Cheater Reputation: 0
Joined: 20 Oct 2012 Posts: 35
|
Posted: Mon Feb 15, 2016 11:44 am Post subject: |
|
|
Thank you for the explanation, I'll try it on that fps game later,
currently I'm trying to hack the building time for red alert 3 and god mode for units, still no clue how to do that yet
|
|
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
|
|