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 


Why does the game crash when the enemy takes damage?

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

Joined: 27 Aug 2022
Posts: 7

PostPosted: Sat Apr 22, 2023 5:49 pm    Post subject: Why does the game crash when the enemy takes damage? Reply with quote

I have found the health value for the player and the enemy uses the same code to deduct damage. I am trying to make damage multipliers so I take less damage and the enemy takes double damage. I have done a few different commonality scans and tried different values/offsets but the result is the same. The player takes reduced damage as expected everything works fine. However when the enemy takes damage the game crashes. Here is my code
Code:

aobscanmodule(plahealth,ZingangGame-Win64-Shipping.exe,F3 0F 5C D1 F3 0F 5F D0) // should be unique
alloc(newmem,$1000,plahealth)
alloc(pmult,4,plahealth)
alloc(emult,4,plahealth)

label(code)
label(return)

pmult:
dd (float)0.25
emult:
dd (float)2

newmem:

code:
  cmp [r15+2c0],1 // 1 is enemy this is the line where the game crashes only when the enemy takes damage
  je enemy
  mulss xmm1,[pmult]
  subss xmm2,xmm1
  maxss xmm2,xmm0
  jmp return

enemy:
  mulss xmm1,[emult]
  subss xmm2,xmm1
  maxss xmm2,xmm0
  jmp return

plahealth:
  jmp newmem
  nop 3
return:
registersymbol(plahealth)

[DISABLE]
//code from here till the end of the code will be used to disable the cheat
plahealth:
  db F3 0F 5C D1 F3 0F 5F D0

unregistersymbol(*)
dealloc(*)
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sat Apr 22, 2023 8:24 pm    Post subject: Reply with quote

If that line crashes the game, it's the distinction you found that's wrong. Find something better to distinguish enemies from yourself.
_________________
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
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sun Apr 23, 2023 1:41 am    Post subject: Reply with quote

what ParkourPenguin or use {$try}/{$except}

if it's the enemy the code at except will execute lol

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sun Apr 23, 2023 2:45 am    Post subject: Reply with quote

Change your code as follows:

Code:
//cmp [r15+2c0],1
jmp enemy


If the game does not crash, then see the previous comments and fix your compare. If the game does crash, then you may need to reduce your multiplier.
Back to top
View user's profile Send private message
j.c
How do I cheat?
Reputation: 0

Joined: 27 Aug 2022
Posts: 7

PostPosted: Sun Apr 23, 2023 5:24 am    Post subject: Reply with quote

Turns out I might have been using the results of the scanner, I am now using which now the game doesnt crash but now regardless of if it was the player or not it jumps to where I want the player to go every time. I will keep trying a few more and report back on what I find.


EDIT

In my post I should have been using the without the brackets, the game no longer crashes but it resulted in both the player and the enemy taking the same path.
Code:

cmp r15,1


I cant double post here is my solution, I just had to keep digging more:

Code:
cmp [rbx+fc],0
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