Quantcast
Channel: ZDoom
Viewing all articles
Browse latest Browse all 3391

Scripting • Re: ZScript How to Set Actor DamageFactor dynamically

$
0
0
While I don't know if it's possible to modify damage types on the fly, you can however make an item with a ModifyDamage override that applies its own damage factors.
For example:

Code:

//This is the base class for the damage modifying itemClass DamageModifier : Inventory{Override void ModifyDamage(int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags){If(!passive){Return;}newdamage = ApplyDamageFactors(self.GetClass(),damageType,damage,damage);}}//This is how you can utilize it to create a specific damage type modifier: (Also works in DECORATE)Class DamageModifierRaiDoom : DamageModifier{Default{DamageFactor "Fire", 0.25;DamageFactor "Ice", 2.0;}}//And you can give it to enemies using an event handler:Class DamageModifierHandler : EventHandler{Override void WorldThingSpawned(WorldEvent e){If(e.Thing is "Cacodemon"){e.Thing.GiveInventory("DamageModifierRaiDoom",1);}}}

Statistics: Posted by Jarewill — Fri Mar 08, 2024 5:03 pm



Viewing all articles
Browse latest Browse all 3391

Trending Articles