D3athlyy 0 Posted May 18 Hello everyone. I'm encountering an error: 'Too many parameters for TotalDamageResult method', and I can't understand what might be causing the issue. Code: modded class PlayerBase { override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef) { Print("[DEBUG] EEHitBy called with ammo: " + ammo); float baseDamage = damageResult.GetHighestDamage("Health"); float armorModifier = 1.0; float projectileModifier = 1.0; EntityAI entity = GetInventory().FindAttachment(InventorySlots.BODY); if (entity) { Print("[DEBUG] Player has armor: " + entity.GetType()); if (entity.IsKindOf("PlateCarrier")) { if (ammo == "Custom_Bullet_545x39_HP") { projectileModifier = 0.1; Print("[DEBUG] Applied projectileModifier for PlateCarrier and HP ammo: " + projectileModifier); } else if (ammo == "Custom_Bullet_545x39_PRS") { projectileModifier = 0.5; Print("[DEBUG] Applied projectileModifier for PlateCarrier and PRS ammo: " + projectileModifier); } } else if (entity.IsKindOf("Vest_Base")) { projectileModifier = 1.0; Print("[DEBUG] Applied projectileModifier for Vest_Base: " + projectileModifier); } } else { Print("[DEBUG] Player has no armor."); } float finalDamage = baseDamage * armorModifier * projectileModifier; Print("[DEBUG] Calculated finalDamage: " + finalDamage); TotalDamageResult newDamageResult = new TotalDamageResult("", finalDamage, "", "", 0); super.EEHitBy(newDamageResult, component, zone, ammo, modelPos, speedCoef); Print("[DEBUG] EEHitBy completed."); } } Share this post Link to post Share on other sites
Sid Debian 112 Posted May 18 4 hours ago, D3athlyy said: Hello everyone. I'm encountering an error: 'Too many parameters for TotalDamageResult method', and I can't understand what might be causing the issue. Code: modded class PlayerBase { override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef) { Print("[DEBUG] EEHitBy called with ammo: " + ammo); float baseDamage = damageResult.GetHighestDamage("Health"); float armorModifier = 1.0; float projectileModifier = 1.0; EntityAI entity = GetInventory().FindAttachment(InventorySlots.BODY); if (entity) { Print("[DEBUG] Player has armor: " + entity.GetType()); if (entity.IsKindOf("PlateCarrier")) { if (ammo == "Custom_Bullet_545x39_HP") { projectileModifier = 0.1; Print("[DEBUG] Applied projectileModifier for PlateCarrier and HP ammo: " + projectileModifier); } else if (ammo == "Custom_Bullet_545x39_PRS") { projectileModifier = 0.5; Print("[DEBUG] Applied projectileModifier for PlateCarrier and PRS ammo: " + projectileModifier); } } else if (entity.IsKindOf("Vest_Base")) { projectileModifier = 1.0; Print("[DEBUG] Applied projectileModifier for Vest_Base: " + projectileModifier); } } else { Print("[DEBUG] Player has no armor."); } float finalDamage = baseDamage * armorModifier * projectileModifier; Print("[DEBUG] Calculated finalDamage: " + finalDamage); TotalDamageResult newDamageResult = new TotalDamageResult("", finalDamage, "", "", 0); super.EEHitBy(newDamageResult, component, zone, ammo, modelPos, speedCoef); Print("[DEBUG] EEHitBy completed."); } } Let's explore the total problem: You are trying to create the new instance for TotalDamageResult. If we get the class definition: DayZ\dta\scripts\3_Game\DamageSystem.c we will find the class: class TotalDamageResult: Managed { proto native float GetDamage(string zoneName, string healthType); proto native float GetHighestDamage(string healthType); }; BUT as you can see the class has no definition of Constructor & Destructor. We have only 2 "proto native"( = We will get that class instance from game engine) aka Get methods and we have no any kind of construction function. Based on that information you have 2 possible solutions: 1. Redefine the base in-game class like so: class TotalDamageResult : Managed { proto native float GetDamage(string zoneName, string healthType); proto native float GetHighestDamage(string healthType); void TotalDamageResult() {} }; // OR modded class TotalDamageResult { string arg1; // Example float finalDamage; // Based on Constructor from code of example string arg2; // Example string arg3; // Example int arg4; // Example proto native float GetDamage(string zoneName, string healthType); proto native float GetHighestDamage(string healthType); void TotalDamageResult(string arg1, float finalDamage, string arg2, string arg3, int arg4) { this.arg1 = arg1; this.finalDamage = finalDamage; this.arg2 = arg2; this.arg3 = arg3; this.arg4 = arg4; } }; But still it can RUIN THE GAME and I isn't suggesting you to use that way. I suppose to think that method EEHitBy - isn't that method that you wishing to override. because it has that structure of the code will not allow you to break the code. But, you shall try to play with float speedCoef. Let's guess that speedCoef is eq 1.0 (that value is like projectileModifier in your code), but what if you'll try to set value from 1.0 to 0.001? And then on you calling of super method you'll get: super.EEHitBy(newDamageResult, component, zone, ammo, modelPos, speedCoef); //that line from your code and it's wrong!!!!! //It shall be: super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef (we setted as 0.001); I hope that you'll understand what do I wish to say to you with those examples. Share this post Link to post Share on other sites
D3athlyy 0 Posted May 18 3 hours ago, Sid Debian said: Let's explore the total problem: You are trying to create the new instance for TotalDamageResult. If we get the class definition: DayZ\dta\scripts\3_Game\DamageSystem.c we will find the class: class TotalDamageResult: Managed { proto native float GetDamage(string zoneName, string healthType); proto native float GetHighestDamage(string healthType); }; BUT as you can see the class has no definition of Constructor & Destructor. We have only 2 "proto native"( = We will get that class instance from game engine) aka Get methods and we have no any kind of construction function. Based on that information you have 2 possible solutions: 1. Redefine the base in-game class like so: class TotalDamageResult : Managed { proto native float GetDamage(string zoneName, string healthType); proto native float GetHighestDamage(string healthType); void TotalDamageResult() {} }; // OR modded class TotalDamageResult { string arg1; // Example float finalDamage; // Based on Constructor from code of example string arg2; // Example string arg3; // Example int arg4; // Example proto native float GetDamage(string zoneName, string healthType); proto native float GetHighestDamage(string healthType); void TotalDamageResult(string arg1, float finalDamage, string arg2, string arg3, int arg4) { this.arg1 = arg1; this.finalDamage = finalDamage; this.arg2 = arg2; this.arg3 = arg3; this.arg4 = arg4; } }; But still it can RUIN THE GAME and I isn't suggesting you to use that way. I suppose to think that method EEHitBy - isn't that method that you wishing to override. because it has that structure of the code will not allow you to break the code. But, you shall try to play with float speedCoef. Let's guess that speedCoef is eq 1.0 (that value is like projectileModifier in your code), but what if you'll try to set value from 1.0 to 0.001? And then on you calling of super method you'll get: super.EEHitBy(newDamageResult, component, zone, ammo, modelPos, speedCoef); //that line from your code and it's wrong!!!!! //It shall be: super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef (we setted as 0.001); I hope that you'll understand what do I wish to say to you with those examples. I tried changing the value of speedCoef to 0.1, but it didn't produce any result Share this post Link to post Share on other sites
Sid Debian 112 Posted May 18 3 hours ago, D3athlyy said: I tried changing the value of speedCoef to 0.1, but it didn't produce any result Sorry mate then you shall try to override another function within events. Because that one is out of ours hands... I think that was done escapely for protection of damage code. You know against of users that broke the rules hardly... Share this post Link to post Share on other sites
DcrClub 0 Posted Thursday at 06:42 AM Keywords: EEOnDamageCalculated Share this post Link to post Share on other sites