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 


Trying to create Multiplier scripts for Dying Light

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

Joined: 28 Apr 2022
Posts: 2

PostPosted: Thu Apr 28, 2022 7:53 am    Post subject: Trying to create Multiplier scripts for Dying Light Reply with quote

So I'm going to jump straight onto the problem I faced.
I tried to create a currency multiplier, so every time I sell stuff I get a multiplier of the original value and my currency will decrease normally if I buy stuff.
But for some reason every time I activated the multiplier, it multiplied the currency I have on me, not the multiplied item sell value.

example: I have $100 on me, if I sell a $4 item, I should get $108 in the end. But it was $208 instead.

My steps:

1. Located total currency address
2. Checked "What writes to this address." Only two appeared.
When I sell item and currency increases, mov [rbx+40],ecx. When I buy item and currency decreases, mov [rcx+40],eax.
3. Use auto assemble on mov [rbx+40],ecx, used Cheat Table Framework and Code Injection.

Code:

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048,"gamedll_x64_rwdi.dll"+CC9C0A)
label(returnhere)
label(originalcode)
label(exit)

alloc(cashmul,4,"gamedll_x64_rwdi.dll"+CC9C0A)
registersymbol(cashmul)

cashmul:
dd #1

newmem:
imul ecx,[cashmul]

originalcode:
mov [rbx+40],ecx
mov eax,[rbx+08]

exit:
jmp returnhere

"gamedll_x64_rwdi.dll"+CC9C0A:
jmp newmem
nop
returnhere:


[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)

dealloc(cashmul)
unregistersymbol(cashmul)

"gamedll_x64_rwdi.dll"+CC9C0A:
mov [rbx+40],ecx
mov eax,[rbx+08]
//Alt: db 89 4B 40 8B 43 08


From what I've learned, mov [rbx+40],ecx = everytime I sell a item, the ecx(value of the item) gets added into [rbx+40](Total cash on me). But everytime I use a imul #2 it will multiply the total cash and the item value. I only wanted it to affect the item value.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Thu Apr 28, 2022 11:23 am    Post subject: Reply with quote

silvercoffee wrote:
mov [rbx+40],ecx = everytime I sell a item, the ecx(value of the item) gets added into [rbx+40](Total cash on me).
This is wrong. That instruction is `mov`- it's moving data from a register into memory. It's not adding the same way the `add` instruction would.
In other words, just before that instruction is executed, [rbx+40] is the old value of cash (e.g. $100) and ecx is the new value of cash (e.g. $104). The mov instruction moves the new value ($104) into the memory location, overwriting the old value. After that instruction has executed, [rbx+40] would be whatever the value in ecx is ($104).

You may also want to use floating point math to allow for rational multipliers (e.g. 1.5x cash):
Code:
...
alloc(cashmul,8,"gamedll_x64_rwdi.dll"+CC9C0A)
registersymbol(cashmul)

cashmul:
  dq (double)1.0

newmem:
  // example: old value [rbx+40] = $100, new value ecx = $104, multiplier [cashmul] = 1.5
  pxor xmm0,xmm0          // eliminates any false dependencies observed by `cvtsi2sd`
  pxor xmm1,xmm1          // ^
  cvtsi2sd xmm0,[rbx+40]  // converts integers to doubles
  cvtsi2sd xmm1,ecx       // ^
  subsd xmm0,xmm1         // xmm0 = amount money is changing ($104 - $100 = $4)
  movsd xmm1,[cashmul]
  mulsd xmm0,xmm1         // multiply difference by multiplier ($4 * 1.5 = $6)
  cvttsd2si ecx,xmm0      // convert w/ truncation (i.e. floor) to integer (floor($6) = $6)
  add ecx,[rbx+40]        // add the old value to this difference ($6 + $100 = $106)

originalcode:
  mov [rbx+40],ecx
  mov eax,[rbx+08]

exit:
  jmp returnhere

...

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
silvercoffee
How do I cheat?
Reputation: 0

Joined: 28 Apr 2022
Posts: 2

PostPosted: Thu Apr 28, 2022 9:07 pm    Post subject: Reply with quote

@ParkourPenguin Thank you! I mistook mov to add. Embarassed
I assume this works for other multiplier scripts like EXP and item multiplier?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Thu Apr 28, 2022 9:39 pm    Post subject: Reply with quote

More or less.

Money, exp, items, etc. are all just numbers to a computer. The semantics of values lose meaning at a low enough level.

If they're different types of numbers, you may need to handle them differently. Instructions that access the address can also be different.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
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
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