[zscript] Where does armor factor into damage

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

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.

[zscript] Where does armor factor into damage

Postby zrrion the insect » Mon Jan 08, 2018 11:12 pm

I have overridden DamageMobj on the player to do some extra things, but I would also like to take armor into account. Where in zscript is depletion of armor/reduction of damage based on armor handled?
User avatar
zrrion the insect
Like a fish in a child's hands.
 
Joined: 25 Jun 2009
Location: Time Station 1: Moon of Glendale

Re: [zscript] Where does armor factor into damage

Postby Apeirogon » Mon Jan 08, 2018 11:56 pm

Override void AbsorbDamage (int damage, Name damageType, out int newdamage) in armor definitions.
Last edited by Blue Shadow on Tue Jan 09, 2018 6:23 am, edited 1 time in total.
Reason: Enabled BBCode.
User avatar
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: [zscript] Where does armor factor into damage

Postby krokots » Tue Jan 09, 2018 3:09 am

Armor reduction is handled inside DamageMobj. You can call virtual method AbsorbDamage for your own armor types.
Code: Select allExpand view
virtual void AbsorbDamage (int damage, Name damageType, out int newdamage) {}

from inventory.txt in gzdoom.pk3
User avatar
krokots
 
Joined: 19 Jan 2010


Return to Scripting

Who is online

Users browsing this forum: No registered users and 3 guests