Hm, that's a very interesting find.
My first choice was indeed to find the current units health. But, as ashaming it is, I could not find the #$%@! Hitpoints and failed at this point.
So instead I took the easy way of re-using the built-in cheats.
Just re-insted WC2 to check your code, many thanks for sharing.
Excellent work! By the way, it seems to works on the orc campaign, too.
Here's my attempt... needs some love, though:
1. no damage on our ships or enemy ships when playing alliance
2. normal damage on our ships and enemy ships when playing orcs
3. invulnerable grunts and kills everything in two hits when playing orcs
4. archers make (and take) no damage when playing alliance
Point 3 is great. The other ones...ehrm, not so.
Code: Select all
[ENABLE]
aobscanmodule(godmod2,Warcraft II BNE_dx.exe,2B C1 56 66 89 46 22) // should be unique
alloc(newmem,$1000)
label(code)
label(return)
label(enemy)
newmem:
cmp ebx,20
je enemy
cmp edx,1
je enemy
jmp code // continue without substracting something it it's us
enemy:
// sub eax,ecx
sub eax,eax // muhaha...that's life. Or better: that HAS BEEN your life.
code:
push esi
mov [esi+22],ax
jmp return
godmod2:
jmp newmem
nop
nop
return:
registersymbol(godmod2)
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
godmod2:
db 2B C1 56 66 89 46 22
unregistersymbol(godmod2)
dealloc(newmem)
{
// ORIGINAL CODE - INJECTION POINT: "Warcraft II BNE_dx.exe"+18565
"Warcraft II BNE_dx.exe"+1854D: 50 - push eax
"Warcraft II BNE_dx.exe"+1854E: E8 0D 52 02 00 - call "Warcraft II BNE_dx.exe"+3D760
"Warcraft II BNE_dx.exe"+18553: 56 - push esi
"Warcraft II BNE_dx.exe"+18554: E8 67 8F 03 00 - call "Warcraft II BNE_dx.exe"+514C0
"Warcraft II BNE_dx.exe"+18559: 57 - push edi
"Warcraft II BNE_dx.exe"+1855A: E8 B1 EE 01 00 - call "Warcraft II BNE_dx.exe"+37410
"Warcraft II BNE_dx.exe"+1855F: 83 C4 10 - add esp,10
"Warcraft II BNE_dx.exe"+18562: 5F - pop edi
"Warcraft II BNE_dx.exe"+18563: 5E - pop esi
"Warcraft II BNE_dx.exe"+18564: C3 - ret
// ---------- INJECTING HERE ----------
"Warcraft II BNE_dx.exe"+18565: 2B C1 - sub eax,ecx
"Warcraft II BNE_dx.exe"+18567: 56 - push esi
"Warcraft II BNE_dx.exe"+18568: 66 89 46 22 - mov [esi+22],ax
// ---------- DONE INJECTING ----------
"Warcraft II BNE_dx.exe"+1856C: E8 8F B0 00 00 - call "Warcraft II BNE_dx.exe"+23600
"Warcraft II BNE_dx.exe"+18571: 83 C4 04 - add esp,04
"Warcraft II BNE_dx.exe"+18574: 5F - pop edi
"Warcraft II BNE_dx.exe"+18575: 5E - pop esi
"Warcraft II BNE_dx.exe"+18576: C3 - ret
"Warcraft II BNE_dx.exe"+18577: 90 - nop
"Warcraft II BNE_dx.exe"+18578: 90 - nop
"Warcraft II BNE_dx.exe"+18579: 90 - nop
"Warcraft II BNE_dx.exe"+1857A: 90 - nop
"Warcraft II BNE_dx.exe"+1857B: 90 - nop
}