Author Topic: Warlock  (Read 686 times)

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Warlock
« Reply #15 on: March 15, 2013, 02:25:11 pm »


               

WhenTheNightComes wrote...

Still didn't work, and somehow the beam has switched to the original ray of frost. Help, anyone?

thats not a surprise, the script you posted should always work like that, you made an error somwhere switched the old script for this i guess, but try this:

#include "NW_I0_SPELLS"
#include "x2_inc_spellhook"

void main()
{
    /*
      Spellcast Hook Code
      Added 2003-06-20 by Georg
      If you want to make changes to all spells,
      check x2_inc_spellhook.nss to find out more

    */

        if (!X2PreSpellCastCode())
        {
            // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
            return;
        }

    // End of Spell Cast Hook
    object oTarget = GetSpellTargetObject();
    if(GetTag(GetSpellCastItem()) == "warlock_staff")
    {
        int nTouch = TouchAttackRanged(oTarget);
        if (nTouch > 0)
        {
            int nDam = d8(GetLevelByclass(class_TYPE_SORCERER)/2*nTouch);
            effect eDam = EffectDamage(nDam, DAMAGE_TYPE_NEGATIVE);
            effect eRay = EffectBeam(VFX_BEAM_EVIL, OBJECT_SELF, BODY_NODE_HAND);
            //Apply the VFX impact and damage effect
            ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGBLUE), oTarget);
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eRay, oTarget, 1.7);      
        }
    return;
    }
    //Declare major variables
    int nMetaMagic = GetMetaMagicFeat();
    int nCasterLevel = GetCasterLevel(OBJECT_SELF);
    int nDam = d4(1) + 1;
    effect eDam;
    effect eVis = EffectVisualEffect(VFX_IMP_FROST_S);
    effect eRay = EffectBeam(VFX_BEAM_COLD, OBJECT_SELF, BODY_NODE_HAND);
    if(!GetIsReactionTypeFriendly(oTarget))
    {
        //Fire cast spell at event for the specified target
        SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_RAY_OF_FROST));
        eRay = EffectBeam(VFX_BEAM_COLD, OBJECT_SELF, BODY_NODE_HAND);
        //Make SR Check
        if(!MyResistSpell(OBJECT_SELF, oTarget))
        {
            //Enter Metamagic conditions
            if (nMetaMagic == METAMAGIC_MAXIMIZE)
            {
                nDam = 5 ;//Damage is at max
            }
            else if (nMetaMagic == METAMAGIC_EMPOWER)
            {
                nDam = nDam + nDam/2; //Damage/Healing is +50%
            }
            //Set damage effect
            eDam = EffectDamage(nDam, DAMAGE_TYPE_COLD);
            //Apply the VFX impact and damage effect
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
        }
    }
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eRay, oTarget, 1.7);
}

This should work + I added critical hit damage calculation into beam damage
               
               

               
            

Legacy_WhenTheNightComes

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-0
Warlock
« Reply #16 on: March 15, 2013, 03:35:38 pm »


               Seems to be automatically hitting, successfully getting the ranged touch attack every time. Even though, the roll is nowhere near the AC of the creature it's attacking.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Warlock
« Reply #17 on: March 15, 2013, 07:44:56 pm »


               

WhenTheNightComes wrote...

Seems to be automatically hitting, successfully getting the ranged touch attack every time. Even though, the roll is nowhere near the AC of the creature it's attacking.

the rolls is performed against touch AC which doesnt take into account many sources so its much lower, it is a same roll that you can find in harm spell etc.
               
               

               
            

Legacy_WhenTheNightComes

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-0
Warlock
« Reply #18 on: March 15, 2013, 08:05:27 pm »


               I've got the creatures natural AC. How would I increase this then, to test for sure that this works?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Warlock
« Reply #19 on: March 15, 2013, 08:40:16 pm »


               For more details see NWNWiki to lear how touch attacks works, I believe that Warlock's Eldritch blast uses ranged touch attack normally in PnP, thats why it is so powerful and popular.

In brief, increase dexterity score, dodge AC (boots, haste) or deflection AC (cloak, ring, etc.)