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 


Health Unit's script such as teleport.

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

Joined: 31 Aug 2013
Posts: 305

PostPosted: Wed Jan 06, 2016 7:55 am    Post subject: Health Unit's script such as teleport. Reply with quote

Hi.
I'm making script for health unit's like teleport script, but save health ,load health not work.help me.
this is script://this script for stronghold 2
Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(healthmem,2048)
registersymbol(s_enable)
registersymbol(l_enable)
registersymbol(u_enable)
label(returnhealth)
label(originalcodehealth)
label(exithealth)
label(max_health)
label(max_health_undo)
label(health)
label(health_undo)
label(save_coord)
label(load_coord)
label(undo_coord)
label(s_enable)
label(l_enable)
label(u_enable)

"Stronghold2.exe"+D28FC:
jmp healthmem
nop
returnhealth:

healthmem:
cmp [s_enable],1
je save_coord

cmp [l_enable],1
je load_coord

cmp [u_enable],1
je undo_coord

jmp originalcodehealth

save_coord:
mov [s_enable],0
push eax
fst [esi+4C]
fld [health]
fst [esi+48]
fld [max_health]
pop eax
jmp originalcodehealth

load_coord:
mov [l_enable],0
cmp [max_health],0
je originalcodehealth
// Save actual Position (for UNDO TELEPORT) when press LOAD POSiTiON
push eax
fst [esi+4C]
fld [health_undo]
fst [esi+48]
fld [max_health_undo]
pop eax
// Save actual Position (for UNDO TELEPORT) when press LOAD POSiTiON
push eax
fld [health]
fst [esi+4C]
fld [max_health]
fst [esi+48]
pop eax
jmp originalcodehealth

undo_coord:
mov [l_enable],0
mov [s_enable],0
mov [u_enable],0
cmp [max_health_undo],0
je originalcodehealth
push eax
fld [health_undo]
fst [esi+4C]
fld [max_health_undo]
fst [esi+48]
pop eax

originalcodehealth:
fld dword ptr [esi+4C]
fdiv dword ptr [esi+48]

exithealth:
jmp returnhealth


health:
dd 0
max_health:
dd 0
s_enable:
dd 0
l_enable:
dd 0
health_undo:
dd 0
max_health_undo:
dd 0
u_enable:
dd 0
//>>>--Unit's-->>>//
 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(healthmem)
Unregistersymbol(s_enable)
Unregistersymbol(l_enable)
Unregistersymbol(u_enable)
"Stronghold2.exe"+D28FC:
fld dword ptr [esi+4C]
fdiv dword ptr [esi+48]
//Alt: db D9 46 4C D8 76 48


**************************************
Is this the wrong script I wrote that does not work?
Back to top
View user's profile Send private message
sjl002
Master Cheater
Reputation: 0

Joined: 31 Aug 2013
Posts: 305

PostPosted: Wed Jan 06, 2016 7:38 pm    Post subject: Reply with quote

Help.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4695

PostPosted: Wed Jan 06, 2016 9:04 pm    Post subject: Reply with quote

The main thing I noticed right away is that you're pushing stuff onto the x87 stack without popping it off. I didn't bother looking at it in detail since the majority of that script is irrelevant and unnecessary (e.g. push/pop eax).

It's fine if you want to make a script using another one as a template; however, you should understand that other one before making your own. If you don't, you're not going to get anywhere. You'd be better off asking other people to make it for you right away, which (I believe) few people would be inclined to do at this point.
Also, please be sure to give credit where credit is due.

Here's some information you may find useful:

fld loads a floating point number onto the x87 stack.
fst takes whatever is on the top of the x87 stack and either stores it into an m32 or copies it into st(i) (some place else on the x87 stack)
fstp does the same thing as fst but once it's done it will pop the value from the stack.

Given that you already know where the health and maxhealth is stored, you don't even need to use x87 instructions. You can just move them using the general purpose registers.

If you're going to be writing a value to those addresses, it might be better to target a write to your health instead of a read from it, since a write to it later might override your write to it now.

_________________
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