Posted: Wed Jan 06, 2016 7:55 am Post subject: Health Unit's script such as teleport.
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)
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
[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?
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.
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