[ZScript]Changing damage reduction based on amount of armor

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)

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 OFF
Smilies are ON

Topic review
   

Expand view Topic review: [ZScript]Changing damage reduction based on amount of armor

Re: [ZScript]Changing damage reduction based on amount of ar

by StroggVorbis » Mon Jan 14, 2019 2:09 pm

So now it's more like Hexen, S.T.A.L.K.E.R., Oblivion, Fallout 3, New Vegas and any other game that employs a condition system? Neat :)

Re: [ZScript]Changing damage reduction based on amount of ar

by Matt » Sat Jan 12, 2019 12:44 pm

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.
That in my view is the easiest way, just going around the old Doom armour system instead of trying to work with it to do things it was never designed to do or even allow to be done.

Re: [ZScript]Changing damage reduction based on amount of ar

by Boondorl » Sat Jan 12, 2019 5:22 am

Ok, I got a solution working that I was looking for:
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.

Re: [ZScript]Changing damage reduction based on amount of ar

by Apeirogon » Fri Jan 11, 2019 3:42 am

Use absorb damage override virtual on armor class.

For example

Code: Select all

version "2.4"

class ar_mor : bluearmor
{

override void AbsorbDamage (int damage, Name damageType, out int newdamage) 
{
	super.absorbdamage(damage, damagetype, newdamage);
	if(self.SaveAmount >= 100) {newdamage = damage * 0.5;}
	if(self.SaveAmount < 100) {newdamage = damage * 0.66;}
}

states
{
	spawn:
		ARM1 A 6 bright;
		ARM2 A 6 bright;
	loop;
}

}

Re: [ZScript]Changing damage reduction based on amount of ar

by Boondorl » Thu Jan 10, 2019 11:38 pm

Is there a way for me to directly access the player's armor and what savepercent it has? If not to the second question, what's the easiest way to swap between green armor and blue armor seamlessly?

Re: [ZScript]Changing damage reduction based on amount of ar

by Matt » Thu Jan 10, 2019 7:10 pm

If you've got a custom playerpawn and you only care about the player, you can use a DamageMobj override.

For a general solution I think a ThingDamaged eventhandler works but I've never tried it.

[ZScript]Changing damage reduction based on amount of armor

by Boondorl » Thu Jan 10, 2019 5:46 pm

Is there a simple way to do this? E.g. if the player picks up an armor bonus that puts them above 100 armor, it gives them damage reduction similar to blue armor. Alternatively, if the player takes damage that puts them at 100 armor or lower, it downgrades the damage reduction to match green armor.

Top