latest and full version of modified ZoDDels damage script rewritten in ccode to more usability and changebility. good to use with table
// default damage multiplier for all damages.
{51, 100.0f, -1, -1, 100, 100, 100, 100, "AR-22C Patriot / AR-23 Liberator / AR-48 Truth Whisperer / Guard Dog / Stalwart"},
Code: Select all
[ENABLE]
aobscanmodule(damage_inject,game.dll,66 0F 6E 59 04 66 0F 6E 49 08 0F 5B C9 0F 5B DB)
alloc(damage_newmem,$10000)
label(damage_return)
//label(damage_change)
//label(damage_and_penetration_change)
//label(damage_no_change)
//label(damage_multiplier)
alloc(damage_ratio,4)
registersymbol(damage_ratio)
damage_newmem:
// push rbx //save rbx as it's going to be changed
{$ccode base_address=rcx jmpaddress=rbx}
extern __cdecl int sprintf(char *, char *, ...);
extern __cdecl void OutputDebugStringA(const char* lpOutputString);
extern float damage_ratio;
//extern void damage_change();
//extern void damage_and_penetration_change();
//extern void damage_no_change();
char debug_string[400];
char* weapon_name;
//float unknown_damage_mult = 0.2f;
//bool damage_is_unknown;
// char* damage_type_name;
typedef struct {
int id;
float damage_mult;
int damage_value;
int armor_damage_value;
int penetration1_no_angle_value;
int penetration2_angle_value;
int penetration3_unknown_value;
int penetration4_unknown_value;
char* weapon_name;
} Weapon;
int *weapon_id=(int*)(base_address);
int *weapon_dmg=(int*)(base_address+0x04);
int *weapon_admg=(int*)(base_address+0x08);
int *weapon_pen1=(int*)(base_address+0x0C);
int *weapon_pen2=(int*)(base_address+0x10);
int *weapon_pen3=(int*)(base_address+0x14);
int *weapon_pen4=(int*)(base_address+0x18);
Weapon weapons[76] = {
{326, 1.0f, -1, -1, -1, -1, -1, -1, "Helldiver melee"},
{50, 1.0f, -1, -1, -1, -1, -1, -1, "AR-23C Liberator Concussive"},
{48, 1.0f, -1, -1, -1, -1, -1, -1, "AR-23P Liberator Penetrator"},
{51, 100.0f, -1, -1, 100, 100, 100, 100, "AR-22C Patriot / AR-23 Liberator / AR-48 Truth Whisperer / Guard Dog / Stalwart"},
{73, 1.0f, -1, -1, -1, -1, -1, -1, "R-63 Diligence"},
{74, 1.0f, -1, -1, -1, -1, -1, -1, "R-63CS Diligence Counter Sniper"},
{65, 1.0f, -1, -1, -1, -1, -1, -1, "AR-20L Justice / BR-14 Adjudicator / Machine Gun / Gatling/Machine Gun Sentry"},
{26, 1.0f, -1, -1, -1, -1, -1, -1, "MP-98 Knight"},
{34, 1.0f, -1, -1, -1, -1, -1, -1, "SG-8S / SMG-37 Defender"},
{117, 1.0f, -1, -1, -1, -1, -1, -1, "ARC-12 Blitzer"},
{93, 1.0f, -1, -1, -1, -1, -1, -1, "Break action shotgun"},
{102, 1.0f, -1, -1, -1, -1, -1, -1, "SG-225 Breaker"},
{103, 1.0f, -1, -1, -1, -1, -1, -1, "SG-225BB Breaker Bugbiter"},
{104, 1.0f, -1, -1, -1, -1, -1, -1, "SG-225NS Breaker Nailspitter"},
{101, 1.0f, -1, -1, -1, -1, -1, -1, "SG-225SP Breaker Spray&Pray"},
{105, 1.0f, -1, -1, -1, -1, -1, -1, "SG-255IE Breaker Incendiary"},
{88, 1.0f, -1, -1, -1, -1, -1, -1, "SG-8 Punisher"},
{99, 1.0f, -1, -1, -1, -1, -1, -1, "SG-8S Slugger"},
{124, 1.0f, -1, -1, -1, -1, -1, -1, "CB-9 Exploding Crossbow"},
{84, 1.0f, -1, -1, -1, -1, -1, -1, "JAR-5 Dominator"},
{80, 1.0f, -1, -1, -1, -1, -1, -1, "R-36 Eruptor"},
{19, 1.0f, -1, -1, -1, -1, -1, -1, "LAS-16 Sickle"},
{297, 1.0f, -1, -1, -1, -1, -1, -1, "LAS-5 Scythe"},
{20, 1.0f, -1, -1, -1, -1, -1, -1, "PLAS-1 Scorcher / SG-8P Punisher Plasma"},
{134, 1.0f, -1, -1, -1, -1, -1, -1, "GP-31 Grenade Pistol"},
{296, 1.0f, -1, -1, -1, -1, -1, -1, "LAS-7 Dagger"},
{44, 1.0f, -1, -1, -1, -1, -1, -1, "P-4 Senator"},
{25, 1.0f, -1, -1, -1, -1, -1, -1, "P-19 Redeemer / P-2 Peacemaker"},
{203, 1.0f, -1, -1, -1, -1, -1, -1, "G-10 Incendiary"},
{201, 1.0f, -1, -1, -1, -1, -1, -1, "G-6 Frag part 1"},
{201, 1.0f, -1, -1, -1, -1, -1, -1, "G-6 Frag part 1"},
{111, 1.0f, -1, -1, -1, -1, -1, -1, "G-6 Frag part 2"},
{213, 1.0f, -1, -1, -1, -1, -1, -1, "G-12 High Explosive / G-16 Impact"},
{204, 1.0f, -1, -1, -1, -1, -1, -1, "G-123 Thermite"},
{122, 1.0f, -1, -1, -1, -1, -1, -1, "Antimaterial Rifle"},
{115, 1.0f, -1, -1, -1, -1, -1, -1, "ARC3 Thrower"},
{127, 1.0f, -1, -1, -1, -1, -1, -1, "Autocannon (part 1/2)"},
{216, 1.0f, -1, -1, -1, -1, -1, -1, "Autocannon (part 2/2)"},
{145, 1.0f, -1, -1, -1, -1, -1, -1, "Commando"},
{135, 1.0f, -1, -1, -1, -1, -1, -1, "EAT-17 Expendable Anti-Tank part 1"},
{189, 1.0f, -1, -1, -1, -1, -1, -1, "EAT-17 Expendable Anti-Tank part 2"},
{226, 1.0f, -1, -1, -1, -1, -1, -1, "EAT-17 Expendable Anti-Tank part 3"},
{129, 1.0f, -1, -1, -1, -1, -1, -1, "EXO-45 Emancipator gun part 1"},
{217, 1.0f, -1, -1, -1, -1, -1, -1, "EXO-45 Emancipator gun part 2"},
{147, 1.0f, -1, -1, -1, -1, -1, -1, "EXO-45 Emancipator rocket part 1"},
{234, 1.0f, -1, -1, -1, -1, -1, -1, "EXO-45 Emancipator rocket part 2"},
{9, 1.0f, -1, -1, -1, -1, -1, -1, "FLAM-40 Flamethrower part 1"},
{220, 1.0f, -1, -1, -1, -1, -1, -1, "GL-21 Grenade launcher part 2 explosion"},
{121, 1.0f, -1, -1, -1, -1, -1, -1, "Heavy Machinegun"},
{149, 1.0f, -1, -1, -1, -1, -1, -1, "Javelin rocket part 1"},
{236, 1.0f, -1, -1, -1, -1, -1, -1, "Javelin rocket part 2"},
{302, 1.0f, -1, -1, -1, -1, -1, -1, "LAS-98 Laser Cannon"},
{227, 1.0f, -1, -1, -1, -1, -1, -1, "Quasar Cannon part 1"},
{228, 1.0f, -1, -1, -1, -1, -1, -1, "Quasar Cannon part 2"},
{280, 1.0f, -1, -1, -1, -1, -1, -1, "Quasar Cannon part 3 (???)"},
{136, 1.0f, -1, -1, -1, -1, -1, -1, "Recoiless Rifle part 1 shell"},
{225, 1.0f, -1, -1, -1, -1, -1, -1, "Recoiless Rifle part 2 explosion"},
{22, 1.0f, -1, -1, -1, -1, -1, -1, "RS-422 Railgun"},
{10, 1.0f, -1, -1, -1, -1, -1, -1, "GL-21 Grenade launcher part 1 / Mortar Sentry shell"},
{11, 1.0f, -1, -1, -1, -1, -1, -1, "Grenade Launcher / EMS Mortar Sentry / Mortar Sentry 1"},
{223, 1.0f, -1, -1, -1, -1, -1, -1, "Mortar Sentry 2"},
{126, 1.0f, -1, -1, -1, -1, -1, -1, "Tesla Tower"},
{241, 1.0f, -1, -1, -1, -1, -1, -1, "AntiPersonal MineField / Eagle 110mm rocket pods part 2"},
{154, 1.0f, -1, -1, -1, -1, -1, -1, "500kg bomb1 shell"},
{273, 1.0f, -1, -1, -1, -1, -1, -1, "500kg bomb2 explosion"},
{152, 1.0f, -1, -1, -1, -1, -1, -1, "Eagle 110mm rocket pods part 1"},
{142, 1.0f, -1, -1, -1, -1, -1, -1, "Eagle airstrike part 1"},
{254, 1.0f, -1, -1, -1, -1, -1, -1, "Eagle airstrike part 2"},
{229, 1.0f, -1, -1, -1, -1, -1, -1, "Eagle cluster bomb"},
{159, 1.0f, -1, -1, -1, -1, -1, -1, "Orbital 120MM HE barrage1"},
{268, 1.0f, -1, -1, -1, -1, -1, -1, "Orbital 120MM HE barrage2"},
{305, 1.0f, -1, -1, -1, -1, -1, -1, "Orbital laser"},
{160, 1.0f, -1, -1, -1, -1, -1, -1, "Orbital precision strike1"},
{267, 1.0f, -1, -1, -1, -1, -1, -1, "Orbital precision strike2"},
{161, 1.0f, -1, -1, -1, -1, -1, -1, "Orbital railcannon strike1"},
{266, 1.0f, -1, -1, -1, -1, -1, -1, "Orbital railcannon strike2"}
};
// damage_type_name = "unknown type";
// strcpy(weapon_name_list, "");
// default damage multiplier for all damages.
damage_ratio = 0.2f;
if (*weapon_id != 0) {
// set default values. May change during analyzing table later.
weapon_name = "unknown damage";
//damage_is_unknown = true;
// analyzing if we have damage_id in table
for (int i = 0; i < sizeof(weapons) / sizeof(weapons[0]); ++i) {
if (weapons[i].id == 0) {
continue;
}
if (*weapon_id == weapons[i].id) {
// damage_is_unknown = false; // we have this damage_id in table. So set flag 'damage_is_unknown' to false, with this we will not apply unknown_damage debuffer to this damage latter
weapon_name = weapons[i].weapon_name; // is only for debugging. Used only in sprintf and OutputDebugString latter
// damage_type_name = weapons[i].damage_type_name;
if (weapons[i].damage_value != -1) {
*weapon_dmg = weapons[i].damage_value;
}
if (weapons[i].armor_damage_value != -1) {
*weapon_admg = weapons[i].armor_damage_value;
}
if (weapons[i].penetration1_no_angle_value != -1) {
*weapon_pen1 = weapons[i].penetration1_no_angle_value;
}
if (weapons[i].penetration2_angle_value != -1) {
*weapon_pen2 = weapons[i].penetration2_angle_value;
}
if (weapons[i].penetration3_unknown_value != -1) {
*weapon_pen3 = weapons[i].penetration3_unknown_value;
}
if (weapons[i].penetration4_unknown_value != -1) {
*weapon_pen4 = weapons[i].penetration4_unknown_value;
}
// apply damage multiplier
damage_ratio = weapons[i].damage_mult;
//strcat(weapon_name_list, " / ");
//strcat(weapon_name_list, weapons[i].name);
//sprintf(debug_string, "HD2. ID %d is for %s", *weapon_id, weapon_name);
//OutputDebugStringA(debug_string);
break;
}
}
// If damage_id was not found in table. Then assume it is some enemy or environmental damage. Apply 'unknown_damage_mult' to it (reduce)
/*
if (damage_is_unknown) {
*weapon_dmg = (int)((float)*weapon_dmg * unknown_damage_mult);
*weapon_admg = (int)((float)*weapon_admg * unknown_damage_mult);
*weapon_pen1 = (int)((float)*weapon_pen1 * unknown_damage_mult);
*weapon_pen2 = (int)((float)*weapon_pen2 * unknown_damage_mult);
*weapon_pen3 = (int)((float)*weapon_pen3 * unknown_damage_mult);
*weapon_pen4 = (int)((float)*weapon_pen4 * unknown_damage_mult);
}*/
sprintf(debug_string, "HD2 %3d | DMG %3d %3d | PEN %3d %3d %3d %3d | %s", *weapon_id, *weapon_dmg, *weapon_admg, *weapon_pen1, *weapon_pen2, *weapon_pen3, *weapon_pen4, weapon_name);
OutputDebugStringA(debug_string);
} // weapon_id != 0
{$asm}
// standart code start
movd xmm3,[rcx+04]
movd xmm1,[rcx+08]
cvtdq2ps xmm1,xmm1
cvtdq2ps xmm3,xmm3
// standart code end
// damage_ratio part
mulss xmm3, dword ptr [damage_ratio]
mulss xmm1, dword ptr [damage_ratio]
jmp damage_return
damage_inject:
jmp far damage_newmem
nop 2
damage_return:
// ------------------------------------------------------
[DISABLE]