Page 1 of 1
Help with one hit kill
Posted: Sun Jul 25, 2021 12:22 pm
by daninthemix
I have found the instruction that affects enemy health:
fstp dword ptr [esi+000001F8]
My problem is, if I change that line in any way, the game crashes. For instance:
mov [esi+000001F8],(float)0
or even
nop
I'm trying to make a one-hit kill. Does anyone have any ideas?
Thanks
Re: Help with one hit kill
Posted: Sun Jul 25, 2021 12:53 pm
by Marc
fstp is somewhat evil, because it changes not only it's target address, but also the stack, take a look [Link].
In your case, I'd copy the fstp-instruction 1:1 in my own code, and just kill the target addresses value after that.
Most likely, this shoud do the trick:
fstp dword ptr [esi+000001F8]
mov[esi+000001F8],0
have fun,
Marc
Re: Help with one hit kill
Posted: Sun Jul 25, 2021 1:12 pm
by daninthemix
Thanks for the reply! I think my crashes were because of shared code and I already had an infinite health cheat on. I did some dissecting and so far this is working without a crash:
cmp [esi+00000000],00004811
je exit
mov [esi+000001F8],(float)-19.85407257
jmp exit
And then some enemies have armour as well - decreasing their armour is handled by another instruction. I did try and combine the two so its still a one hit kill, but oddly they end up with a small amount of health still:
cmp [esi+00000000],00004811
je exit
mov [esi+000001FC],(float)-19.85407257
mov [esi+000001F8],(float)-19.85407257
jmp exit
Have not yet noticed any issues by omitting the fstp, but I will bear in mind what you have said.
EDIT: well the answer seems to be: just drop tehir health bar when their armour gets hit. Don't worry about the armour value:
cmp [esi+00000000],00004811
je exit
mov [esi+000001F8],(float)-19.85407257
jmp exit
Re: Help with one hit kill
Posted: Sun Jul 25, 2021 2:11 pm
by ShyTwig16
Just make sure you clean up the stack, else you can get undesired effects. But all you need in this case is fstp st(0)
.
Re: Help with one hit kill
Posted: Mon Jul 26, 2021 5:22 pm
by PeaceBeUponYou
reset the x87 FPU TOS using either
or this and then load 0 and write it to the dword
Code: Select all
ffree st(0)
fincstp
fldz
fstp dword ptr [esi+1F8]
Re: Help with one hit kill
Posted: Tue Jul 27, 2021 7:34 am
by daninthemix
So this is what I've got right now:
Code: Select all
fstp st(0)
cmp [esi+00000000],00004811 //Main character
je exit
cmp [esi+00000000],00001811 //Eve
je exit
cmp [esi+00000000],00004B91 //Helicopter
je exit
mov [esi+000001F8],(float)-19.85407257
jmp exit
It's working pretty well - I need the one hit kill to exclude the main character, the girl you have to protect, and the helicopter you fly in. The one part where they're shooting at you in the helicopter and the girl went a bit weird - I modified the above code to protect the helicopter, but then the girl was dying. I couldn't figure it out so for that very small part I just disabled the cheat. So far everywhere else, its working.
Re: Help with one hit kill
Posted: Sat Jul 31, 2021 4:22 am
by EpicBirdi
If you're checking things in this manner, the helicopter check may be overriding Eve if they're both true, although I'm not certain how you would fix that myself. I ran into the same issue today with sharedcode for three resources in another game.. when one was infinite the others weren't anymore. My only guess would be to check a higher function and compare against what's writing to the normal register that writes into esi+1F8