This
Code: Select all
override void WorldThingDamaged(WorldEvent e)
{
if(e.thing is "playerpawn")
{e.damage * 0;} and {e.damage *= 0;}
}
Moderator: GZDoom Developers
Code: Select all
override void WorldThingDamaged(WorldEvent e)
{
if(e.thing is "playerpawn")
{e.damage * 0;} and {e.damage *= 0;}
}
You would need to "heal" this thing damaged, and then apply some other damage.Apeirogon wrote:How change damage using world thing damage?
Thisdont work.Code: Select all
override void WorldThingDamaged(WorldEvent e) { if(e.thing is "playerpawn") {e.damage * 0;} and {e.damage *= 0;} }
I haven't tried it, but given how everything else works I'd be willing to be at least three drinks that anything that's taken a lethal amount of damage would be dead by this point, so it would only work for non-lethal hits.krokots wrote:You would need to "heal" this thing damaged, and then apply some other damage.
Yes of course, that only counts if the victim hasn't died. I would suggest to make own Actor class (MyActor), and make all monsters inherit from this class. Inside MyActor override DamageMobj and do whatever you want with it.Matt wrote:I haven't tried it, but given how everything else works I'd be willing to be at least three drinks that anything that's taken a lethal amount of damage would be dead by this point, so it would only work for non-lethal hits.krokots wrote:You would need to "heal" this thing damaged, and then apply some other damage.
If you can afford to change EVERY monster in your mod to inherit from a custom actor class, then do it. The only downside is, if your monsters already inherit from some other monsters. So, if you have a CustomZombieman : Zombieman, and only differance between him and default zombieman is, say, health, that sucks, because you'll need to COPY all code from zombieman, inside gzdoom.pk3.Apeirogon wrote:Reason I ask this not because I dont know how override virtual function and inherit one actor from another.
I made monster randomization mod, which among other things, change damage of monsters. And I made it based on inventory items, for compatibility with all other mods.
But it can change only damage of a projectile, since projectile can point to actor which shot it. Hitscan and splash damage cant be changed in such way, because to force puff point to actor which "shot" it I must change flags on it before it spawn.
I found way to bypass this limitation, make another inventory item which add to actor buddha flag and then await command to remove it.
But this way hurt to performance and now I search way to force engine "ignore" monsters, which player dont see, as much as possible.
Code: Select all
Class CustomZombieman : CustomActor
{
(...)
}
Code: Select all
Class CustomActor : Actor
{
//This is empty
}
Code: Select all
Class CustomActor : Actor
{
override int DamageMobj(Actor inflictor, Actor source, int damage, Name mod, int flags = 0, double angle = 0)
{
return Super.DamageMobj(inflictor, source, damage, mod, flags, angle);
}
}
Code: Select all
Class CustomActor : Actor
{
override int DamageMobj(Actor inflictor, Actor source, int damage, Name mod, int flags = 0, double angle = 0)
{
damage *= 0.5; //Example - all damage is halved
return Super.DamageMobj(inflictor, source, damage, mod, flags, angle);
}
}
Code: Select all
class DamageProcessor
{
static int ScaleDamage(Actor target, int damage) {
return damage * 0.5;
}
}
Code: Select all
class CustomZombieman : Zombieman replaces Zombieman
{
override int DamageMobj(Actor inflictor, Actor source, int damage, Name mod, int flags = 0, double angle = 0)
{
damage = DamageProcessor.ScaleDamage(self, damage);
return Super.DamageMobj(inflictor, source, damage, mod, flags, angle);
}
}
That what I means.Apeirogon wrote:And I made it based on inventory items, for compatibility with all other MONSTER REPLACING mods.