Skip to content

Acidfog rewrite

arvutarvut Member Posts: 12
edited 2:54AM in Builders - Scripting
So, I've rewritten a lot of spells (almost all) for the server I devel for, damage calculations based on feats. However the spells for certain AoE cloud effects (acid fog, cloudkill etcetera) won't use the calculated damage dices. The feats acidfog and cloudkill tests for are of course Spellfocus/Greater Spellfocus/Epic Spellfocus Conjuration, the 166, 394 and 611 feat constants.

Here's the nw_s0_acidfoga.nss script for the enter conditions on the spell.
#include "X0_I0_SPELLS"

void main()
{

    //Declare major variables
    int nMetaMagic = GetMetaMagicFeat();
    int nDamage, nRoll, nDice;
    string sMessage;
    object oCaster = OBJECT_SELF;
    int nMax;
    int nCasterLevel = GetCasterLevel(OBJECT_SELF);
    effect eDam;
    effect eVis = EffectVisualEffect(VFX_IMP_ACID_S);
    effect eSlow = EffectMovementSpeedDecrease(50);
    object oTarget = GetEnteringObject();
    float fDelay = GetRandomDelay(1.0, 2.2);
    if (spellsIsTarget(oTarget, SPELL_TARGET_SELECTIVEHOSTILE, GetAreaOfEffectCreator()))
    {
        //Fire cast spell at event for the target
        SignalEvent(oTarget, EventSpellCastAt(GetAreaOfEffectCreator(), SPELL_ACID_FOG));
        //Spell resistance check
        if(!MyResistSpell(GetAreaOfEffectCreator(), oTarget, fDelay))
        {
            //Roll Damage
            //Enter Metamagic and Spellfocus conditions
             if (GetHasFeat(611,oCaster))
             {
                nRoll = d20(6);
                nMax = 120;
             }
             else if (GetHasFeat(394,oCaster))
             {
                nRoll = d12(5);
                nMax = 60;
             }
             else if (GetHasFeat(166,oCaster))
             {
                nRoll = d8(4);
                nMax = 32;
             }
             else if (!GetHasFeat(166,oCaster))
             {
                nRoll = d6(4);
                nMax = 24;
             }
    //             sMessage = "Your spell does: " + IntToString(nDice) + "d" + IntToString(nRoll) + " damage to: " + GetName(oTarget);
             nDamage = nRoll;
            if (nMetaMagic == METAMAGIC_MAXIMIZE)
            {
                nDamage = nMax;//Damage is at max
            }
            else if (nMetaMagic == METAMAGIC_EMPOWER)
            {
                nDamage = nDamage + (nDamage/2); //Damage/Healing is +50%
            }
            //Make a Fortitude Save to avoid the effects of the movement hit.
            if(!MySavingThrow(SAVING_THROW_FORT, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_ACID, GetAreaOfEffectCreator(), fDelay))
            {
                //slowing effect
                ApplyEffectToObject(DURATION_TYPE_PERMANENT, eSlow, oTarget);
                // * BK: Removed this because it reduced damage, didn't make sense nDamage = d6();
            }

            //Set Damage Effect with the modified damage
            eDam = EffectDamage(nDamage, DAMAGE_TYPE_ACID);
            //Apply damage and visuals
            DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
            DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
      //      SendMessageToPC(oCaster,sMessage);
        }
    }
}

I'm beginning to suspect these damage dices are set in either 2da files or hardcoded in the engine? Any suggestions on how to get this to work is welcome!
Sign In or Register to comment.