Author Topic: Elemental Affinities  (Read 334 times)

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Elemental Affinities
« on: June 25, 2012, 02:30:56 pm »


                 Since I was rewriting all of my spells anyways, I figured I'd hook in a system for changing the elemental nature of spells while I was at it.
  I have the elemental affinities that I've included so far (The traditional air, earth, fire, and water, plus ice and lightning) as selectable, usable, feats, also given out as bonus feats based on deity selected.

  For AOE spells, if the selected affinity matches the default spell, the default VFX can be used, otherwise that gets replaced with a generic one based on the element as well.

  I gave each elemental affinity two associated damage types, though the second only gets used in a few spells.  So far, I've  hooked it into fire shield, ice storm, flame strike, and fire storm that use both.

  I'm not happy with some of the VFX I've picked initially, I'll have to go through all those extra ones in the cep to find better ones still, especially for earth and air.
 I also forgot to add the IP damage type constants to the struct, though with only a couple spells that use those I might still add them on a seperate routine.

  Anyways, here's the struct and the script I have so far.  As always, any ideas for optimizing or adding to it would be appreciated.  I have to assume the PRC must have done something similar, if they did I'd be curious if anyone knew how they'd handled it as well.  Any suggestions for vanilla or cep 2.3 VFX to use would also be helpful.

struct EA {int Match;
          int Save1;
          int Save2;
          int Damage1;
          int Damage2;
          int S;
          int M;
          int L;
          int AOE;
          int Beam;
          int Mirv;};

//// nBaseElement, 1 = Air, 2 = Earth, 3 = Fire, 4 = Water/Acid, 5 = Ice, 6 = Lightning
struct EA GetElementalAffinity (int nBaseElement)
{
struct EA VFX;

int nFeat = GetLocalInt (OBJECT_SELF, "ELEMENTAL_AFFINITY");

//// Apply the default element if no affinity is active.
if (!nFeat) nFeat = nBaseElement;

if (nFeat  == nBaseElement) VFX.Match = TRUE;


switch (nFeat)
   {
    case 1:  VFX.Save1 = SAVING_THROW_TYPE_NONE; VFX.Save2 = SAVING_THROW_TYPE_SONIC;
             VFX.Damage1 = DAMAGE_TYPE_SLASHING; VFX.Damage2 = DAMAGE_TYPE_SONIC;
             VFX.S = VFX_IMP_DUST_EXPLOSION; VFX.M = VFX_IMP_DUST_EXPLOSION; VFX.L = VFX_IMP_DUST_EXPLOSION;
             VFX.AOE = VFX_FNF_HOWL_MIND; VFX.Beam = VFX_BEAM_FIRE_W_SILENT;
             VFX.Mirv = VFX_IMP_MIRV; break;

    case 2:  VFX.Save1 = SAVING_THROW_TYPE_NONE; VFX.Save2 = SAVING_THROW_TYPE_NONE;
             VFX.Damage1 = DAMAGE_TYPE_BLUDGEONING; VFX.Damage2 = DAMAGE_TYPE_PIERCING;
             VFX.S = VFX_IMP_HEAD_ODD; VFX.M = VFX_IMP_NIGHTMARE_HEAD_HIT; VFX.L = VFX_IMP_SPIKE_TRAP;
             VFX.AOE = VFX_FNF_SCREEN_SHAKE; VFX.Beam = VFX_BEAM_CHAIN;
             VFX.Mirv = VFX_IMP_MIRV; break;

    case 3:  VFX.Save1 = SAVING_THROW_TYPE_FIRE; VFX.Save2 = SAVING_THROW_TYPE_DIVINE;
             VFX.Damage1 = DAMAGE_TYPE_FIRE; VFX.Damage2 = DAMAGE_TYPE_DIVINE;
             VFX.S = VFX_IMP_FLAME_S; VFX.M = VFX_IMP_FLAME_M; VFX.L = VFX_IMP_FLAME_M;
             VFX.AOE = VFX_FNF_FIREBALL; VFX.Beam = VFX_BEAM_FIRE;
             VFX.Mirv = VFX_IMP_MIRV_FLAME; break;

    case 4:  VFX.Save1 = SAVING_THROW_TYPE_ACID; VFX.Save2 = SAVING_THROW_TYPE_NONE;
             VFX.Damage1 = DAMAGE_TYPE_ACID; VFX.Damage2 = DAMAGE_TYPE_PIERCING;
             VFX.S = VFX_IMP_ACID_S; VFX.M = VFX_IMP_ACID_S; VFX.L = VFX_IMP_ACID_L;
             VFX.AOE = VFX_FNF_GAS_EXPLOSION_ACID; VFX.Beam = VFX_BEAM_DISINTEGRATE;
             VFX.Mirv = VFX_IMP_MIRV; break;

    case 5:  VFX.Save1 = SAVING_THROW_TYPE_COLD; VFX.Save2 = SAVING_THROW_TYPE_NONE;
             VFX.Damage1 = DAMAGE_TYPE_COLD; VFX.Damage2 = DAMAGE_TYPE_BLUDGEONING;
             VFX.S = VFX_IMP_FROST_S; VFX.M = VFX_IMP_FROST_S; VFX.L = VFX_IMP_FROST_L;
             VFX.AOE = VFXPFC_FNF_OTIL_COLDSPHERE_2; VFX.Beam = VFX_BEAM_COLD;
             VFX.Mirv = VFX_IMP_MIRV; break;

    case 6:  VFX.Save1 = SAVING_THROW_TYPE_ELECTRICITY; VFX.Save2 = SAVING_THROW_TYPE_FIRE;
             VFX.Damage1 = DAMAGE_TYPE_ELECTRICAL; VFX.Damage2 = DAMAGE_TYPE_FIRE;
             VFX.S = VFX_IMP_LIGHTNING_S; VFX.M = VFX_IMP_LIGHTNING_M; VFX.L = VFX_IMP_LIGHTNING_M;
             VFX.AOE = VFX_FNF_ELECTRIC_EXPLOSION; VFX.Beam = VFX_BEAM_LIGHTNING;
             VFX.Mirv = VFX_IMP_MIRV_ELECTRIC; break;
   }
return VFX;
}


               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Elemental Affinities
« Reply #1 on: June 25, 2012, 03:11:58 pm »


               

Failed.Bard wrote...

I have to assume the PRC must have done something similar, if they did I'd be curious if anyone knew how they'd handled it as well.


I believe they simply hooked EffectDamage with their own function which reads local int and change damage_type accordingly. Probably the same goes with EffectDamageShield. AFAIK they kept default vfxes. There are no matching vfx for most abilities, and doing this would require recoloring some of them (fireball, ice storm, ...) and adding into haks as new effect, huge ammount of work and you wont be able to change cone based vfxs as those are determined in 2DA, though it might be possible to disable them there and add the vfx effect inside spellscript - that will be however clientside so clients need new spells.2da as well
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Elemental Affinities
« Reply #2 on: June 25, 2012, 05:19:53 pm »


               

ShaDoOoW wrote...
I believe they simply hooked EffectDamage with their own function which reads local int and change damage_type accordingly. Probably the same goes with EffectDamageShield. AFAIK they kept default vfxes. There are no matching vfx for most abilities, and doing this would require recoloring some of them (fireball, ice storm, ...) and adding into haks as new effect, huge ammount of work and you wont be able to change cone based vfxs as those are determined in 2DA, though it might be possible to disable them there and add the vfx effect inside spellscript - that will be however clientside so clients need new spells.2da as well


  With the projectiles from caster to target as well.  It might be possible for the cast vfx to be hooked through nwnx, but as far as I know nobody's done it yet.  I'm willing to accept a little bit of inconsistency in how the spell looks from cast to effects though, since the elemental damage is being applied properly.
  I think I might even have the PRC hak kicking around, I'll have to see how they made the effects.  That's something I haven't gotten around to trying yet.  This is just a wrapper function for it, or did they manage to make actual applyable effects?