Not logged inOpenClonk Forum
Up Topic Development / Scenario & Object Development / Reducing/Removing lava damage
- - By Sayned [kz] Date 2017-01-16 09:37
Hello everyone!

I got into updating Magic Times mod (probably will come up with a new name at some point, because this one is silly) and one thing that apparently has changed is the way lava deals damage now. That being said, one of the potions in my mod (fire protection potion to be more certain) doesn't work anymore.

So what I'm interested in is reducing damage Clonks take from lava or completely removing it [damage].
Parent - By Maikel Date 2017-01-16 10:00
That is easy, just overload this function in a local System.ocg folder. Although a fire damage (or energy loss) blocking effect should also do the trick.
Parent - - By Zapper [de] Date 2017-01-16 11:20
Even in the function Maikel linked, lava should always do fire damage. You should be able to prevent that with an effect.

Like so:

local PreventFireDamageEffect = new Effect
{
    Damage = func (int damage, int cause)
    {
        if (cause & FX_Call_DmgFire || cause & FX_Call_EngFire)
        {
            return 0;
        }
        return damage;
    }
};
...
target->CreateEffect(PreventFireDamageEffect, 1, 0);


PS: if you find the syntax weird: that's the new effect syntax Guenther introduced in the last years. The old one should still work, though
Parent - By Sayned [kz] Date 2017-01-16 16:29
Thank you both for helping me out!

Your option seem to be right what I need, however I already made it a bit differently (I overloaded function Maikel has suggested with a new one, but instead of removing lava damage completely, I made this fucntion check whether or not clonk has fire immunity shield effect). Since I'm currently trying to make my mod compatible with the release, I'm going to stick with that for now. I just want to get as many things working again before I can move onto creating new content or improving existing content!
Up Topic Development / Scenario & Object Development / Reducing/Removing lava damage

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill