I spent days trying to figure out this one...
I crashed the Tutorial-i386 so many times I can't even remember haha!
I even had a save with the structure and P->******* addresses to the healths so when it crashed I didn't need to look them up again =-=
I solved it on day 8/15, not too long ago, and the only difference is that I had gone for the 1-hit kill approach. Code in the end for the curious.
Thank you mr
Nice guide!
PHP Code:
alloc(newmem,2048) //2kb should be enough
label(returnhere)
label(originalcode)
label(exit)
newmem:
//MY CODE STARTS HERE, THE REST IS AUTO GENEREATED
cmp [ebx+10],1 //IS AN ALLY?
je originalcode //JUMP IF EQUAL, PROCEED TO ORIGINAL CODE
push 0 //PUSH 0 TO THE STACK
pop eax //EAX IS NOW 0
mov [ebx+04],eax //COPY 0 TO EBX+04 (ENEMY hp)
jmp originalcode //GET BACK TO ORIGINAL CODE
//MY CODE ENDS HERE
originalcode:
fsubr dword ptr [ebx+04]
fstp dword ptr [ebp-30]
exit:
jmp returnhere
"Tutorial-i386.exe"+2509D:
jmp newmem
nop
returnhere:
NOTE:
This image show the structures in my CE, note that I use a "-4" offset after all the addresses to rollback from the Healths +04 offset. This is why my structure shows the "team value" with the offset +10 and not +0C as in the tutorial.
Note also that it makes my "team" as well as "health" values appear in purple, its because I created 2 groups in the Structure dissect window that can be seen between the addresses and the application menu: ALLIES and ENEMIES. When you create groups, CE tries to find the differences between all of them, and makes the differences purple. Its very useful for big structures!