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 isnt this script working for one hit kill?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Gaz
Cheater
Reputation: 0

Joined: 08 Aug 2012
Posts: 40

PostPosted: Wed Nov 28, 2012 4:58 am    Post subject: Why isnt this script working for one hit kill? Reply with quote

Code:
[ENABLE]

label(enemy)

ac_client.exe+254D9:
sub [edi+04],ebx //original code which is changing health
pushad //save the registers
pushfd //save the flags
cmp [edi+28],0 // cmp edi base plus 28 offset which is player id that checks to enemy , player 0 enemy 1

jne enemy
add [edi+04],ebx

enemy:
sub [edi+04],ebx
mov edi,1
popfd //load flags
popad //load registers

[DISABLE]
ac_client.exe+254D9:
sub [edi+04],ebx
Back to top
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Wed Nov 28, 2012 10:14 am    Post subject: Reply with quote

In all cases, you're doing the first sub, which subtracts damages from health.
If an enemy is getting damaged, you subtract AGAIN the damage (2nd sub in your script), so enemies are getting twice the damage.
If a player is getting damaged, you're doing health=health-damage(1st sub)+damage(1st add)-damage(2nd sub) -> nothing special.

Oh wait, this script simply crashes your game doesn't it? That's because you're improperly overwriting the original code. Your script takes more bytes than "sub [edi+04],ebx" does, so you need a code cave, which can have any size you want when you use the alloc keyword, I asked for 128 bytes in the following example.

If you want 1hit kill, I'd suggest the following:
Code:
[ENABLE]
alloc(CodeCave,128)
label(enemy)
label(JobDone)
label(ReturnHere)

ac_client.exe+254D9:
jmp CodeCave
nop //there should be one less "nop"s here than the number of bytes taken by the instruction that followed the original sub
nop
nop
ReturnHere:

CodeCave:
pushfd //save the flags
cmp [edi+28],0 // cmp edi base plus 28 offset which is player id that checks to enemy , player 0 enemy 1
jne enemy
sub [edi+04],ebx //original code which is changing health
jmp JobDone
enemy:
mov [edi+04],1 //set enemy's HP to 1
JobDone:
popfd
//paste here the instruction that followed the original sub [edi+04],ebx
jmp ReturnHere


[DISABLE]
ac_client.exe+254D9:
sub [edi+04],ebx
//paste here the instruction that followed the original sub [edi+04],ebx

dealloc(CodeCave)
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