ModifyDamage called on Items but not on BasicArmor?

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is ON
[img] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: ModifyDamage called on Items but not on BasicArmor?

Re: ModifyDamage called on Items but not on BasicArmor?

by Zhs2 » Sun Mar 02, 2025 11:40 am

Short answer: Yes, this is by design.

Long answer: You have some mistaken assumptions about how BasicArmor works. A player can only ever have one BasicArmor class, and that's the BasicArmor class the player started with. The default BasicArmor class can be defined in MAPINFO: https://zdoom.org/wiki/MAPINFO/GameInfo ... ArmorClass

Further, the only time a player can carry BasicArmorPickups or BasicArmorBonuses is if they are intended to be used with the Use Inventory key to add armor stats to BasicArmor. Otherwise, whenever BasicArmorPickup or BasicArmorBonus items are collected BasicArmor conditionally absorbs all of their stats. BasicArmor basically acts as a be-all end-all global armor tracker. To use ModifyDamage or AbsorbDamage virtuals on it effectively you can check for the armor type it currently has and apply special effects based on that. Or you can forgo BasicArmor completely to engineer armor that understands when it is worn and when it is not. Just some suggestions.

ModifyDamage called on Items but not on BasicArmor?

by merlin86 » Wed Feb 26, 2025 6:37 pm

Hello there, with this simple item

Code: Select all

version "4.12"

class MySuperArmor : BasicArmor
{

	override void ModifyDamage(int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags)
	{
		Console.printf("foo");
		if (passive && damage > 0)
		{
			Console.printf("bar!");
			newdamage = 0;
		}
	}
}
I've noticed if the item is derived from item such function is called and it works, but if I derive my class from BasicArmor is not called.
It this by design?
I've tested with the GIT version.

Top