by Boondorl » Sat Jan 12, 2019 5:22 am
Ok, I got a solution working that I was looking for:
Spoiler:Code: Select all
// Custom armor degradation system (no more obnoxiously avoiding green armor)
override int DamageMObj(Actor inflictor, Actor source, int damage, Name mod, int flags, double angle)
{
int armorAmount = CountInv("BasicArmor");
// Intentional full checking so that armor can update damage values accordingly if damage goes beyond break points
if (armorAmount > 0 && !CheckInventory("PowerInvulnerable", 1))
{
int armorToRemove = damage;
if (armorAmount > 100)
{
armorToRemove = floor(damage * 0.5);
if (armorToRemove > armorAmount - 100)
{
A_TakeInventory("BasicArmor", armorAmount - 100);
damage -= (armorAmount - 100);
armorToRemove -= (armorAmount - 100);
armorAmount = 100;
}
else
{
A_TakeInventory("BasicArmor", armorToRemove);
damage -= armorToRemove;
}
}
if (armorAmount <= 100)
{
// If carrying over, make sure not to absorb more damage than intended
if (armorToRemove > floor(damage * 0.33335))
{
armorToRemove = floor(damage * 0.33335);
}
if (armorToRemove > armorAmount)
{
A_TakeInventory("BasicArmor", armorAmount);
damage -= armorAmount;
}
else
{
A_TakeInventory("BasicArmor", armorToRemove);
damage -= armorToRemove;
}
}
}
return super.DamageMObj(inflictor, source, damage, mod, flags, angle);
}
Basically, I had to write in my own armor functionality. This unfortunately involves changing all of the Doom armor types so that their SavePercent is 0 as to not absorb any damage when taking a hit. This armor works off a degradation system instead of the normal system to avoid having to dance around green armor that always seems to be placed right in the middle of the path you need to take. Now you can pick up armor whenever without feeling like you're wasting blue armor. Also a nice buff for armor bonuses since they can now give blue armor tier damage absorption without needing to first pick up blue armor.
Ok, I got a solution working that I was looking for: [spoiler][code] // Custom armor degradation system (no more obnoxiously avoiding green armor) override int DamageMObj(Actor inflictor, Actor source, int damage, Name mod, int flags, double angle) { int armorAmount = CountInv("BasicArmor"); // Intentional full checking so that armor can update damage values accordingly if damage goes beyond break points if (armorAmount > 0 && !CheckInventory("PowerInvulnerable", 1)) { int armorToRemove = damage; if (armorAmount > 100) { armorToRemove = floor(damage * 0.5); if (armorToRemove > armorAmount - 100) { A_TakeInventory("BasicArmor", armorAmount - 100); damage -= (armorAmount - 100); armorToRemove -= (armorAmount - 100); armorAmount = 100; } else { A_TakeInventory("BasicArmor", armorToRemove); damage -= armorToRemove; } } if (armorAmount <= 100) { // If carrying over, make sure not to absorb more damage than intended if (armorToRemove > floor(damage * 0.33335)) { armorToRemove = floor(damage * 0.33335); } if (armorToRemove > armorAmount) { A_TakeInventory("BasicArmor", armorAmount); damage -= armorAmount; } else { A_TakeInventory("BasicArmor", armorToRemove); damage -= armorToRemove; } } } return super.DamageMObj(inflictor, source, damage, mod, flags, angle); }[/code][/spoiler] Basically, I had to write in my own armor functionality. This unfortunately involves changing all of the Doom armor types so that their SavePercent is 0 as to not absorb any damage when taking a hit. This armor works off a degradation system instead of the normal system to avoid having to dance around green armor that always seems to be placed right in the middle of the path you need to take. Now you can pick up armor whenever without feeling like you're wasting blue armor. Also a nice buff for armor bonuses since they can now give blue armor tier damage absorption without needing to first pick up blue armor.