Page 1 of 1

Dissection Help

Posted: Wed Dec 12, 2018 4:58 am
by zachillios
So I'm new to scripting, but essentially I'm trying to do a God Mode script, and I've managed to find the code that reduces health which is

Code: Select all

13FFF0043 - 29 87 94000000  - sub [rdi+00000094],eax
And so I dissected off of the damage everyone took, and I'm pretty sure I've found the identifier in question.

Image

15:Players
31:Enemies

So my question is how exactly would I set the script up? I tried following a few of the tutorials and everything I've tried has either had no effect, or has had me die in one hit rather than make me invisible. Because following the tutorials had me end up with:

Code: Select all

add [rdi+00000094],eax
cmp [rdi+00000070],15
jne +6
mov eax,[rdi+00000098]
mov [rdi+00000094],eax
And this ended up with me being killed in one hit. Any help would greatly be appreciated.

0094 was current health, and then 0098 was Maximum health.

Re: Dissection Help

Posted: Wed Dec 12, 2018 4:40 pm
by Bloodybone
Maybe try this out:

Code: Select all

add [rdi+00000094],eax
cmp [rdi+00000070],(int)15
jne @f
mov eax,[rdi+00000098]
mov [rdi+00000094],eax
@@:

Re: Dissection Help

Posted: Wed Dec 12, 2018 10:32 pm
by zachillios
Bloodybone wrote:
Wed Dec 12, 2018 4:40 pm
Maybe try this out:

Code: Select all

add [rdi+00000094],eax
cmp [rdi+00000070],(int)15
jne @f
mov eax,[rdi+00000098]
mov [rdi+00000094],eax
@@:
Thank you for help! So this got me a little closer. I'm now invincible, and enemies health decreases, however they never die. So the code I ended up with that does this is:

Code: Select all

sub [rdi+00000094],eax
cmp [rdi+00000008],0
jne +6
mov eax,[rdi+00000098]
mov [rdi+00000094],eax
jmp return
So I'm still confused on how this should be setup to also include their deaths. These are all the codes that execute when an enemy is killed.

Image

Again, thank you for your help.

Re: Dissection Help

Posted: Thu Dec 13, 2018 11:47 am
by JohnFK
You subtract eax from [rdi+94], then later you write eax to [rdi+94]. So [rdi+94] will ALWAYS be what EAX is. You should write it like this:

is player?
jump if not to original code
(else)
write max health in [rdi+98] to eax
write eax to [rdi+94]

In assembly it can look like this:

Code: Select all

cmp [rdi+8],0
jne @f //jumps to the next anonymous label
mov eax,[rdi+98]
mov [rdi+94],eax 
jmp return //skip original code for player and exit script

@@: //anonymous label you dont need to declare
sub [rdi+00000094],eax //originalcode
But since it subtract a value you can also write it differently

Code: Select all

cmp [rdi+8],0
jne @f //jumps to the next anonymous label
xor eax,eax //clears eax, so for player it subtracts 0 which doesnt change the health

@@: //anonymous label you dont need to declare
sub [rdi+00000094],eax //originalcode

Re: Dissection Help

Posted: Fri Dec 14, 2018 10:12 pm
by zachillios
JohnFK wrote:
Thu Dec 13, 2018 11:47 am
You subtract eax from [rdi+94], then later you write eax to [rdi+94]. So [rdi+94] will ALWAYS be what EAX is. You should write it like this:

is player?
jump if not to original code
(else)
write max health in [rdi+98] to eax
write eax to [rdi+94]

In assembly it can look like this:

Code: Select all

cmp [rdi+8],0
jne @f //jumps to the next anonymous label
mov eax,[rdi+98]
mov [rdi+94],eax 
jmp return //skip original code for player and exit script

@@: //anonymous label you dont need to declare
sub [rdi+00000094],eax //originalcode
But since it subtract a value you can also write it differently

Code: Select all

cmp [rdi+8],0
jne @f //jumps to the next anonymous label
xor eax,eax //clears eax, so for player it subtracts 0 which doesnt change the health

@@: //anonymous label you dont need to declare
sub [rdi+00000094],eax //originalcode
This helped so much, I was able to get it. Thank you so much!