Dead Space 3 [regenarating health cheat][AA script][CT]

Upload your cheat tables here (No requests)
Post Reply
User avatar
STN
Founder
Founder
Posts: 4436
Joined: Thu Mar 02, 2017 7:48 pm
Reputation: 3440

Dead Space 3 [regenarating health cheat][AA script][CT]

Post by STN »

Made by mgr.inz.Player

There are many CT tables and trainers for this game. But I wanted to make something different.
And probably something useful for other games.

As we know, Dead Space 3 have this structure:
Code:
struct playerHealthStruct{
single maximumHealth
single currentHealth
single OSDH
};
// "single" = (32-bit) floating-point Little Endian


OSDH - I call it: "on screen display health". It is in 0.0-1.0 range (0%-100%), we see this value in-game. This value is used for health bar on Isaac Clarke back (that weird "spine").

currentHealth - self explanatory.

maximumHealth is 100.0 by default. If we upgrade "RIG HITPOINTS", this value changes to 125.0, 150.0, 175.0 and 200.0

So, if player have currentHealth equal to 150.0 and maximumHealth is 175.0, OSDH is 85.7142... percent.


My idea is:
If the players avoids taking damage for 50 seconds, their health will slowly regenerate at a rate of XX% points per second. "regenerate rate" isn't always the same, it has two values. When player's health is between 0% and 40%, it will be 1%, and if health is between 40% and 100%, it will be 5%. Regenerating will stop at 40% or at 100%.

Example:
1) maximumHealth is 100.0 points.
If currentHealth is 15.0 (so, 15%) then regenerate rate will be 1%.
If currentHealth is 70.0 (so, 70%), regenerate rate will be 5%.

2) maximumHealth is 200.0 points.
If currentHealth is 40.0 (so, 20%) then regenerate rate will be 1% (it will regenerate up to 40%, that is 80.0 points).
If currentHealth is 110.0 (so, 55%), regenerate rate will be 5% (regenerating will stop at 100%, that is 200.0 points).


Making the AA script:

Fortunately for us, there is hack point which access player's health only. And it is called 60times per second. I skip other 59 calls. So my script works with 1Hz frequency (once per second).
Code:
(...)
// skip other 59 calls
inc [Delay]
cmp [Delay],#60
jb originalcode
mov [Delay],0
(...)rest of code(...)



Check if player avoided taking damage for 50 seconds. I compare currentHealth with previously saved value and I count how many seconds without damage:
Code:
(...)
// check if XX seconds without damage (checking currentHealth)
movss xmm0,[currentHealth]
comiss xmm0,[previousHealthValue]
movss [previousHealthValue],xmm0
jae countSeconds

// damage taken, skip
mov [secondsWithoutDamage],0
jmp originalcode

countSeconds:
inc [secondsWithoutDamage]
cmp [secondsWithoutDamage],(int)healingDelay
jb originalcode // if less than XX seconds, skip (jmp to orig code)
dec [secondsWithoutDamage]
(...)rest of code(...)



We calculate how many percent of health we have. We can just read OSDH, but, sometimes OSDH isn't updated right after we're taking damage. So, calculations are necessary - divide currentHealth by maximumHealth
Code:
// get current health (percent)
movss xmm0,[currentHealth] // get current health \
divss xmm0,[maximumHealth] // divide by maximum health / get percent

This value is stored in xmm0 register.

OK, we have our "percent of health" (xmm0) value. Now we want to increase this. It depends where xmm0 is. (between "0-40%" or between "40-100%"). We set "regenerate rate" and we set upper limit in xmm1. Of course, if we already have 40% or 100% of health, we skip rest of code:
Code:
// check range1
movss xmm1,[value0_40] // set xmm1 to 0.40 (40%)
comiss xmm0,xmm1 // compare with first limit
je originalcode // skip if equal
mov [regenrate],(float)0.01 // set regeneration rate
jb updateHealth

// check range2
movss xmm1,[value1_0] // set xmm1 to 1.00 (100%)
comiss xmm0,xmm1 // compare with second limit
je originalcode // skip if equal
mov [regenrate],(float)0.05 // set regeneration rate
jb updateHealth

(...)rest of code(...)


Add "regeneration rate" value to "percent of health"
Code:
updateHealth:
addss xmm0,[regenrate] // add a bit of health
minss xmm0,xmm1 // not bigger than limit



Update OSDH (because game engine doesn't synchronize OSDH with currentHealth, if changed manually via memory editing):
Code:
movss [OSDH],xmm0 // overwrite OSDH (on screen display health)



Update currentHealth:
Code:
//calculate&update current health value
mulss xmm0,[maximumHealth] // multiply by maximumHealth
movss [currentHealth],xmm0 // overwrite current health


Final and obvious part:
Code:
originalcode:
fld dword ptr [currentHealth]
jmp returnhere




Of course, full script looks slightly different (initialized variables, defines, labels, alloc, aobscan, etc.).
You can open CT file below and look at my script. You can change healingDelay, limits and regenrate, at the top of script.
Code:
define(healingDelay,50)
define(limit1,0.4)
define(limit2,1.0)
define(regenrate1,0.01)
define(regenrate2,0.05)




Edit:
PS: if you found any mistakes, please tell me about it.
PS2: I made similar script for DS2 if someone want it, write PM.

How to use this cheat table?
  1. Install Cheat Engine
  2. Double-click the .CT file in order to open it.
  3. Click the PC icon in Cheat Engine in order to select the game process.
  4. Keep the list.
  5. Activate the trainer options by checking boxes or setting values from 0 to 1
Attachments
deadspace3_healthregen.ct
(3.51 KiB) Downloaded 86 times

Post Reply