Trying to make Eaters work like a second resist check

Darwin

Well-Known Member
Sep 5, 2017
412
4
32
Hi. So I've done some edits to the SAPropEffects script and I attempted to change Eaters from giving health after damage, to outright reducing the damage taken (like a second resist check). My goal is to make it so that if you have like 25 fire eater (for example) and say a flame strike would do 40 damage (after your normal resists check), the fire eater would then reduce it an additional 25% from 40 to 30 damage.

I've done all of my conversions so that the script will compile without errors, but it's not having any effect in game and I'm wondering what I'm getting wrong. I'm self-taught with scripting and never took a class or read a book (and still quite nooby tbh), so if you could post an example code for me, it would probably help me more than telling me what I need to do. There's a lot of scripting concepts that I understand in my head conceptually, but that I don't know the official terms for. Here's what I did with my code:

Code:
	   	 double pe = 0; double fe = 0;
            double ce = 0; double poe = 0;
            double ee = 0; double de = 0;

            double pd = 0; double fd = 0;
            double cd = 0; double pod = 0;
            double ed = 0; double dd = 0;

            double k = (double)GetValue(DamageType.Kinetic,  this.Mobile) / 100;
            double f = (double)GetValue(DamageType.Fire, this.Mobile) / 100;
            double c = (double)GetValue(DamageType.Cold, this.Mobile) / 100;
            double p = (double)GetValue(DamageType.Poison, this.Mobile) / 100;
            double e = (double)GetValue(DamageType.Energy, this.Mobile) / 100;
            double a = (double)GetValue(DamageType.AllTypes, this.Mobile) / 100;

            if (phys > 0 && (k > 0 || a > 0))
            {
                pd = damage * ((double)phys / 100);
                pe = k * pd;

                if (k >= a)
                    damage -= (int)(pe);
                else
                    damage -= (int)(de);
            }