Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


God Mode which protects only from 100% damage - SpellForce
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Jacusiek
Advanced Cheater
Reputation: 0

Joined: 24 Jan 2011
Posts: 81

PostPosted: Mon Jun 24, 2013 8:08 am    Post subject: God Mode which protects only from 100% damage - SpellForce Reply with quote

Hello all. I would like to make a God Mode which will only protect from 100% damage. I mean, in game there are towers, who can kill You by one shot, and I want protection against them, but when I am hit by less than my maximum HP, I want to be hit normally. The table is made by Recifense for game SpellForce, AoB version, which You can download here:
http://forum.cheatengine.org/viewtopic.php?p=5367214
There is now God Mode script (with some others) but I would like to have God Mode X and God Mode Y (separate, Y - defence from 100%
damage).

Eg (during God Mode Y).:
I have 150 HP. Some monsters attack me, dealing 5,6,5 dmg and now I have 134 - that's correct.
I have 150 HP. That big tower attacks me and I don't die, because I have God Mode Y (normally those towers deals the same ammount of damage as Your current HP, so when You have 130/130 HP, that deals 130 HP, when You have 163/170, that deals 163 HP, and You always die by one hit).
I meant that God Mode Y should protect me from 100% damage, but it shouldn't protect me from normal hits. Please, help.

Thanks in advance!

P.S. I tried to write in Recifense's topic for help, but no one answered, so I deleted that post.

@Edit: I also found some informations, which could be helpful:

http://imageshack.us/a/img829/9100/2qi.png - picture of "find out what accesses to this address", and the address is current HP
http://i.imgur.com/ROuotCe.png - picture of an instruction
http://i.imgur.com/DOpcspJ.png - dissect structure (0x06 - current HP (which means, when current is 0 - You have maximum HP, current is maximum = You are dead), 0x00 - Maximum HP
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Mon Jun 24, 2013 2:36 pm    Post subject: Reply with quote

Just incorporate a conditional jump so that your health will not be changed if the damage is too great. Depending on the game, you can run a check on the damage that is being dealt, or what value is being moved in to your health etc. As long as this check is performed before the value gets changed, you can control what happens...whether you allow it or not.
Back to top
View user's profile Send private message
Jacusiek
Advanced Cheater
Reputation: 0

Joined: 24 Jan 2011
Posts: 81

PostPosted: Mon Jun 24, 2013 2:42 pm    Post subject: Reply with quote

Could You explain how exactly should I do that? I'm totally novice at writting scripts.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Mon Jun 24, 2013 3:24 pm    Post subject: Reply with quote

Do you have a script, already made, that works...or do you need to build one from scratch?

If you have one that is working, paste it here, and I can try to help you. If you need to build one from scratch, I will need to know that.
Back to top
View user's profile Send private message
Jacusiek
Advanced Cheater
Reputation: 0

Joined: 24 Jan 2011
Posts: 81

PostPosted: Mon Jun 24, 2013 3:28 pm    Post subject: Reply with quote

Code:
{
===========================================
 Spellforce - Platinum Edition
 Game Version  : 1.54.75000
 Script Version: 2.0
 CE Version    : 6.0
 GodMode, Mana, Resource, XP and points
 01-Aug-2010
 15-Aug-2010 (God Mode also for buildings - AOB Version)
 15-Feb-2011 Added _MonMoneyS and _MonMoneyB
 By Recifense
===========================================
}

[ENABLE]
//=========================================
alloc(MyCode,1024)
//=========================================

aobscan(aobMonHP,66 8b 44 01 48 66 89 85 3c fe ff ff)
aobscan(aobMonMana,66 8b 44 01 56 66 89 85 38 fe ff ff)
aobscan(aobMonRes,03 d0 8b 44 91 0b c2 0c 00)
aobscan(aobMonXP,8b 4a 04 66 8b 52 08 03 c6)
aobscan(aobMonSP,66 ff 88 d3 00 00 00 8b c7 5f 5e)
aobscan(aobMonAP,66 ff 88 d1 00 00 00 8b c7 5f 5e 5d)
aobscan(aobGodMode,66 89 41 06 5b 59 c2 04 00)
aobscan(aobGodModeB,8d 4c 81 11 33 c0 66 8b 01 66 3b c2 ?? ?? 2b c2 66 89 01 c2 08 00)
aobscan(aobMonMoneyS,89 7c 24 10 89 74 24 0c b9 05 00 00 00 8d 74 24 08) //+08
aobscan(aobMonMoneyB,2b fa 89 7c 24 1c 8b 7c 24 2c b9 05 00 00 00 8d 74 24 10 f3 a5) //+0A

//=========================================
// Declaration section
label(pMonHP)
label(pMonMana)
label(pMonRes)
label(pMonXP)
label(pMonSP)
label(pMonAP)
label(pGodMode)
label(pGodModeB)
label(pMonMoneyS)
label(pMonMoneyB)
label(_MonHP)
label(_BackMH)
label(_ExitMH)
label(_MonMana)
label(_BackMM)
label(_ExitMM)
label(_MonRes)
label(_BackMR)
label(_ExitMR)
label(_MonXP)
label(_BackMX)
label(_ExitMX)
label(_MonSP)
label(_BackMS)
label(_ExitMS)
label(_MonAP)
label(_BackMA)
label(_ExitMA)
label(_GodMode)
label(_BackGM)
label(_ExitGM)
label(_GodModeB)
label(_BackGMB)
label(_ExitGMB)
label(_MonMoneyS)
label(_BackMMS)
label(_ExitMMS)
label(_MonMoneyB)
label(_BackMMB)
label(_ExitMMB)
label(pHero)
label(pRes)
label(pMoney)
label(iEnableMH)
label(iEnableMM)
label(iEnableMR)
label(iEnableMX)
label(iEnableMSA)
label(iEnableMMo)
label(iMinMoney)
label(iEAX)

registersymbol(MyCode)
registersymbol(pHero)
registersymbol(pRes)
registersymbol(pMoney)
registersymbol(iEnableMH)
registersymbol(iEnableMM)
registersymbol(iEnableMR)
registersymbol(iEnableMX)
registersymbol(iEnableMSA)
registersymbol(iEnableMMo)
registersymbol(iMinMoney)
registersymbol(pMonHP)
registersymbol(pMonMana)
registersymbol(pMonRes)
registersymbol(pMonXP)
registersymbol(pMonSP)
registersymbol(pMonAP)
registersymbol(pGodMode)
registersymbol(pGodModeB)
registersymbol(pMonMoneyS)
registersymbol(pMonMoneyB)

//=========================================
MyCode:
//=========================================
_MonHP:
 cmp dword ptr [iEnableMH],0
 je _ExitMH                     // Jump if feature is disabled
 
 cmp byte ptr [ecx+eax+1c],01   // Player?s unit ?
 jne _ExitMH

 mov word ptr [ecx+eax+48],0000 // Negative HP = 0
 
_ExitMH:
 mov ax,[ecx+eax+48]            // Original code
 jmp _BackMH                    // Back to main code

//=========================================
_MonMana:
 cmp dword ptr [iEnableMM],0
 je _ExitMM                     // Jump if feature is disabled
 
 cmp byte ptr [ecx+eax+1c],01   // Player?s unit ?
 jne _ExitMM

 mov word ptr [ecx+eax+56],0000 // Negative HP = 0
 
_ExitMM:
 mov ax,[ecx+eax+56]            // Original code
 jmp _BackMM                    // Back to main code

//=========================================
_MonRes:
 add edx,eax                    // Original code

 mov [pRes],ecx                 // Save pointer for debugging
 
 cmp dword ptr [iEnableMR],0
 je _ExitMR                     // Jump if feature is disabled

 cmp dword ptr [ecx+edx*4+0b],0 // Is thare some of this resource?
 je _ExitMR                     // Jump if false
 
 mov eax,#4000                  // Get minimum resource value
 
 cmp eax,[ecx+edx*4+0b]         // Current value >= minimum?
 jle _ExitMR                    // Jump if true
 
 mov [ecx+edx*4+0b],eax         // Update current resource value
 
_ExitMR:
 mov eax,[ecx+edx*4+0b]         // Original code
 jmp _BackMR                    // Back to main code

//=========================================
_MonXP:
 mov ecx,[edx+04]               // Original code
 mov dx,[edx+08]                // Original code
 
 cmp dword ptr [iEnableMX],0
 je _ExitMX                     // Jump if feature is disabled

 mov eax,ecx                    // Make current XP = Next Level Value
 
_ExitMX:
 jmp _BackMX                    // Back to main code

//=========================================
// Stat Points
_MonSP:
 cmp dword ptr [iEnableMSA],0
 je _ExitMS                     // Jump if feature is disabled

 inc word ptr [eax+000000d3]    // Points = Points + 1 
 
_ExitMS:
 dec word ptr [eax+000000d3]    // Original code
 jmp _BackMS                    // Back to main code

//=========================================
// Ability Points
_MonAP:
 cmp dword ptr [iEnableMSA],0
 je _ExitMA                     // Jump if feature is disabled

 inc word ptr [eax+000000d1]    // Points = Points + 1 
 
_ExitMA:
 dec word ptr [eax+000000d1]    // Original code
 jmp _BackMA                    // Back to main code

//=========================================
_GodMode:
 cmp dword ptr [iEnableMH],0
 je _ExitGM                     // Jump if feature is disabled

 cmp byte ptr [ecx-26],01       // Player?s unit ?
 jne _ExitGM

 xor eax,eax                    // Negative HP = 0

_ExitGM:
 mov [ecx+06],ax                // Original code
 pop ebx                        // Original code
 jmp _BackGM                    // Back to main code

//=========================================
_GodModeB:
 cmp dword ptr [iEnableMH],0
 je _ExitGMB                    // Jump if feature is disabled

 cmp byte ptr [ecx-09],01       // Player?s Building ?
 jne _ExitGMB                   // Jump if false

 xor edx,edx                    // Value2Decrease = 0
 mov ax,[ecx+04]                // Gt maximum HP
 
_ExitGMB:
 sub eax,edx                    // Original code
 mov [ecx],ax                   // Original code
 jmp _BackGMB                   // Back to main code

//=========================================
// On Selling
_MonMoneyS:
 mov [pMoney],eax

 cmp dword ptr [iEnableMMo],0
 je _ExitMMS                    // Jump if feature is disabled

 cmp edx,[iMinMoney]
 cmovl edx,[iMinMoney]
 mov ecx,[iMinMoney]
 cmp ecx,[esp+0c]
 cmovl ecx,[esp+0c]
 mov [esp+0c],ecx
 mov ecx,[iMinMoney]
 cmp ecx,[esp+10]
 cmovl ecx,[esp+10]
 mov [esp+10],ecx

_ExitMMS:
 mov ecx,00000005               // Original code
 jmp _BackMMS                   // Back to main code

//=========================================
// On Buying
_MonMoneyB:
 mov [pMoney],edi

 cmp dword ptr [iEnableMMo],0
 je _ExitMMB                    // Jump if feature is disabled

 mov ecx,[iMinMoney]
 cmp ecx,[esp+10]
 cmovl ecx,[esp+10]
 mov [esp+10],ecx
 mov ecx,[iMinMoney]
 cmp ecx,[esp+14]
 cmovl ecx,[esp+14]
 mov [esp+14],ecx
 mov ecx,[iMinMoney]
 cmp ecx,[esp+18]
 cmovl ecx,[esp+18]
 mov [esp+18],ecx

_ExitMMB:
 mov ecx,00000005               // Original code
 jmp _BackMMB                   // Back to main code

//=========================================
// Variables
pHero:
 dd 0
pRes:
 dd 0
pMoney:
 dd 0
iEnableMH:
 dd 1
iEnableMM:
 dd 1
iEnableMR:
 dd 1
iEnableMX:
 dd 1
iEnableMSA:
 dd 1
iEnableMMo:
 dd 1
iMinMoney:
 dd #5000
iEAX:
 dd 0

//=========================================
// Hacking Points
//SpellForce.exe+3fdc38:
aobMonHP:
pMonHP:
 jmp _MonHP
_BackMH:

//SpellForce.exe+3fdc62:
aobMonMana:
pMonMana:
 jmp _MonMana
_BackMM:

//SpellForce.exe+23e96c:
aobMonRes:
pMonRes:
 jmp _MonRes
 nop
_BackMR:

//SpellForce.exe+674c89:
aobMonXP:
pMonXP:
 jmp _MonXP
 nop
 nop
_BackMX:

//SpellForce.exe+6741e4:
aobMonSP:
pMonSP:
 jmp _MonSP
 nop
 nop
_BackMS:

//SpellForce.exe+67415b:
aobMonAP:
pMonAP:
 jmp _MonAP
 nop
 nop
_BackMA:

//SpellForce.exe+454890:
aobGodMode:
pGodMode:
 jmp _GodMode
_BackGM:

//SpellForce.exe+3418b1:
aobGodModeB+0e:
pGodModeB:
 jmp _GodModeB
_BackGMB:

aobMonMoneyS+08:
pMonMoneyS:
 jmp _MonMoneyS
_BackMMS:

aobMonMoneyB+0A:
pMonMoneyB:
 jmp _MonMoneyB
_BackMMB:

//=========================================
// Original Codes
[DISABLE]
//SpellForce.exe+3fdc38:
pMonHP:
// mov ax,[ecx+eax+48]
 db 66,8b,44,01,48

//SpellForce.exe+3fdc62:
pMonMana:
// mov ax,[ecx+eax+56]
 db 66,8b,44,01,56

//SpellForce.exe+23e96c:
pMonRes:
// add edx,eax
 db 03,d0
 mov eax,[ecx+edx*4+0b]

//SpellForce.exe+674c89:
pMonXP:
 mov ecx,[edx+04]
 mov dx,[edx+08]

//SpellForce.exe+6741e4:
pMonSP:
 dec word ptr [eax+000000d3]

//SpellForce.exe+67415b:
pMonAP:
 dec word ptr [eax+000000d1]
 
//SpellForce.exe+454890:
pGodMode:
 mov [ecx+06],ax
 pop ebx

//SpellForce.exe+3418b1:
pGodModeB:
// sub eax,edx
 db 2b,c2
 mov [ecx],ax

pMonMoneyS:
 mov ecx,00000005

pMonMoneyB:
 mov ecx,00000005

unregistersymbol(MyCode)
unregistersymbol(pHero)
unregistersymbol(pRes)
unregistersymbol(pMoney)
unregistersymbol(iEnableMH)
unregistersymbol(iEnableMM)
unregistersymbol(iEnableMR)
unregistersymbol(iEnableMX)
unregistersymbol(iEnableMSA)
unregistersymbol(iEnableMMo)
unregistersymbol(iMinMoney)
unregistersymbol(pMonHP)
unregistersymbol(pMonMana)
unregistersymbol(pMonRes)
unregistersymbol(pMonXP)
unregistersymbol(pMonSP)
unregistersymbol(pMonAP)
unregistersymbol(pGodMode)
unregistersymbol(pGodModeB)
unregistersymbol(pMonMoneyS)
unregistersymbol(pMonMoneyB)

dealloc(MyCode)


I would like to modify this script as I said before (it's not my script)
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Mon Jun 24, 2013 4:19 pm    Post subject: Reply with quote

Which godmode are we referring to? You can try these:

If _GodMode:

Code:
//=========================================
_GodMode:
 cmp dword ptr [iEnableMH],0
 je _ExitGM                     // Jump if feature is disabled

 cmp byte ptr [ecx-26],01       // Player?s unit ?
jne _ExitGM

cmp ax,[ecx+06]               //+++ compare damage to current health
jl _ExitGM                    //+++ if damage is less than current health, jump to original code, otherwise, jump back to code cave and do not change health
pop ebx
jmp _BackGM

_ExitGM:
 mov [ecx+06],ax                // Original code
 pop ebx                        // Original code
 jmp _BackGM                    // Back to main code

//=========================================





_GodModeB:

Code:
//=========================================
_GodModeB:
 cmp dword ptr [iEnableMH],0
 je _ExitGMB                    // Jump if feature is disabled

 cmp byte ptr [ecx-09],01       // Player?s Building ?
 jne _ExitGMB                   // Jump if false

sub eax,edx
cmp ax,[ecx]                   //+++ compare damage to current health
jg _BackGMB                    //+++ if damage is greater than current health, exit code cave and do not change health, otherwise, go ahead and change health
mov [ecx],ax
jmp _BackGMB
 
_ExitGMB:
 sub eax,edx                    // Original code
 mov [ecx],ax                   // Original code
 jmp _BackGMB                   // Back to main code

//=========================================
Back to top
View user's profile Send private message
Jacusiek
Advanced Cheater
Reputation: 0

Joined: 24 Jan 2011
Posts: 81

PostPosted: Mon Jun 24, 2013 4:46 pm    Post subject: Reply with quote

I think it should be only something connected with GodMode, because GodModeB is for buildings and I don't need it (GodMode is for units). Anyway, unfortunatelly, it isn't working. It gives me normal GodMode for everything, like the previous one.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Mon Jun 24, 2013 5:26 pm    Post subject: Reply with quote

Just as a test, remove the yellow text from the script and report back:

//=========================================
_GodMode:
cmp dword ptr [iEnableMH],0
je _ExitGM // Jump if feature is disabled

cmp byte ptr [ecx-26],01 // Player?s unit ?
jne _ExitGM


cmp ax,[ecx+06] //+++ compare damage to current health
jl _ExitGM //+++ if damage is less than current health, jump to original code, otherwise, jump back to code cave and do not change health
pop ebx
jmp _BackGM


_ExitGM:
mov [ecx+06],ax // Original code
pop ebx // Original code
jmp _BackGM // Back to main code

//=========================================
Back to top
View user's profile Send private message
Jacusiek
Advanced Cheater
Reputation: 0

Joined: 24 Jan 2011
Posts: 81

PostPosted: Mon Jun 24, 2013 5:38 pm    Post subject: Reply with quote

When I remove the yellow line it gives me another God Mode, which doesn't make me loose health, but while it is active, my units' health regenerate very fast to maximum.

I mean:
Normal GodMode: I have 150/150 Health. After being hit by some monsters, I still have 150/150
The new one GodMode: I have 150/150 Health. After being hit by some monsters I have eg. 100/150, and after some time my HP regenerates to maximum (normally HP regenerates in that game, but not so fast)
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Mon Jun 24, 2013 5:52 pm    Post subject: Reply with quote

Change the code to this:

//=========================================
_GodMode:

_ExitGM:
mov [ecx+06],ax // Original code
pop ebx // Original code
jmp _BackGM // Back to main code

//=========================================


If you are still getting god mode (for hero player...assuming this section of code is for hero player), then something is wrong with the script, or you're doing something wrong.
Back to top
View user's profile Send private message
Jacusiek
Advanced Cheater
Reputation: 0

Joined: 24 Jan 2011
Posts: 81

PostPosted: Mon Jun 24, 2013 6:04 pm    Post subject: Reply with quote

It doesn't give me God Mode.
Back to top
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Mon Jun 24, 2013 6:40 pm    Post subject: Reply with quote

Out of curiosity, what does this one do?
Code:
//=========================================
 _GodMode:
  cmp dword ptr [iEnableMH],0
  je _ExitGM                     // Jump if feature is disabled

  cmp byte ptr [ecx-26],01       // Player's unit ?
  jne _ExitGM
  cmp dx, word [ecx] //damage<max HP ?
  jb _ExitGM
  sub eax,edx                    // undo the previous add eax,edx if the player is receiving damage equal or greater than his max hp

 _ExitGM:
  mov [ecx+06],ax                // Original code
  pop ebx                        // Original code
  jmp _BackGM                    // Back to main code

 //=========================================


Last edited by Gniarf on Mon Jun 24, 2013 6:45 pm; edited 1 time in total
Back to top
View user's profile Send private message
Jacusiek
Advanced Cheater
Reputation: 0

Joined: 24 Jan 2011
Posts: 81

PostPosted: Mon Jun 24, 2013 6:45 pm    Post subject: Reply with quote

That one gives normal GodMode.
Back to top
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Mon Jun 24, 2013 6:46 pm    Post subject: Reply with quote

try again, I just edited the "cmp dx, word [ecx] //damage<max HP ?" line.
(Before the edit it should have protected against everything except 1-hit kills...In short: the exact opposite of what you wanted)


Last edited by Gniarf on Mon Jun 24, 2013 6:49 pm; edited 1 time in total
Back to top
View user's profile Send private message
Jacusiek
Advanced Cheater
Reputation: 0

Joined: 24 Jan 2011
Posts: 81

PostPosted: Mon Jun 24, 2013 6:49 pm    Post subject: Reply with quote

It gives me protection against 100% damage (finally!) BUT it also makes when my units' health regenerates, it regenerates to its maximum (i want normal regeneration).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites