Author Topic: Warlock  (Read 770 times)

Legacy_Kingdom_Of_Hearts

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Warlock
« on: June 11, 2012, 01:11:30 pm »


               Hello! I'm trying to script warlocks for my module. What I wanted to do was just use the bard class, as warlock. Just as the server Arelith does. I am not sure how to script the eldritch abilities though. Heres what I know...

The warlock powers come off a item that the warlock is given when choosing a pact. They are then able to shoot beams out of the staff from casting the spell Ray of Frost from the staff. What I need to know is how I get the Ray of Frost to behave like warlock eldritch rays, doing the 1d6 more damage on odd levels.

Eventually I would like to have it like Arelith has, on a certain level get a chain beam where you can hit multiple enemies with one blast. Thanks!
               
               

               
            

Legacy_Kingdom_Of_Hearts

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Warlock
« Reply #1 on: June 12, 2012, 03:29:08 pm »


               I've figured out some of this. I was able to script for when warlock's level up they get the spells. (discplacement, ray of frost, etc.) But now I just need to have it so when they use the warlock ray of frost from the staff, it will do the damage (1d6/2 levels from level 1) and that only ray of frost from warlock staffs will do it. Along with the nice beam vfx instead of the cold one.
               
               

               
            

Legacy_Alex Warren

  • Sr. Member
  • ****
  • Posts: 326
  • Karma: +0/-0
Warlock
« Reply #2 on: June 12, 2012, 07:34:49 pm »


               You need to edit nw_s0_rayfrost.nss script. Example here:
http://pastebin.com/QqT3frRw
When you compile the script and cast ray of frost from item with "warlock_staff" tag it will trigger "eldritch blast". It's just a sample - you should tweak it the way you like.
               
               

               
            

Legacy_Kingdom_Of_Hearts

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Warlock
« Reply #3 on: June 13, 2012, 04:05:44 am »


               Worked fantastic! I tried the same thing with two other scripts and am having some trouble though..


My script for call lightning overriden.. Trying to get it to do d8 damage/2 levels and do fire strike animations on all the enemies, it compiles but just does regular spell.

//::///////////////////////////////////////////////
//:: Call Lightning
//:: NW_S0_CallLghtn.nss
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    This spells smites an area around the caster
    with bolts of lightning which strike all enemies.
    Bolts do 1d10 per level up 10d10
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: May 22, 2001
//:://////////////////////////////////////////////
//:: VFX Pass By: Preston W, On: June 20, 2001
#include "X0_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
   if(GetTag(GetSpellCastItem()) == "warlock_staff")
    {
      object oCaster = OBJECT_SELF;
    int nCasterLvl = GetCasterLevel(oCaster);
    int nMetaMagic = GetMetaMagicFeat();
    int nDamage = d8(GetLevelByclass(class_TYPE_BARD)/2);
// = EffectBeam(VFX_BEAM_EVIL, OBJECT_SELF, BODY_NODE_HAND);
    float fDelay;
   // effect eVis = EffectVisualEffect(VFX_IMP_LIGHTNING_M);
    effect eVis = EffectVisualEffect(VFX_IMP_FLAME_M);
    effect eDam;
    //Get the spell target location as opposed to the spell target.
    location lTarget = GetSpellTargetLocation();
 object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
    //Cycle through the targets within the spell shape until an invalid object is captured.
    while (GetIsObjectValid(oTarget))
    {
        if (spellsIsTarget(oTarget, SPELL_TARGET_SELECTIVEHOSTILE, OBJECT_SELF))
        {
           //Fire cast spell at event for the specified target
            SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_CALL_LIGHTNING));
            //Get the distance between the explosion and the target to calculate delay
            fDelay = GetRandomDelay(0.4, 1.75);
            if (!MyResistSpell(OBJECT_SELF, oTarget, fDelay))
            {
                //Roll damage for each target
                nDamage = d6(nCasterLvl);
                //Resolve metamagic
                if (nMetaMagic == METAMAGIC_MAXIMIZE)
                {

                }
                else if (nMetaMagic == METAMAGIC_EMPOWER)
                {
                   nDamage = nDamage + nDamage / 2;
                }
                //Adjust the damage based on the Reflex Save, Evasion and Improved Evasion.
                //Set the damage effect
                eDam = EffectDamage(nDamage, DAMAGE_TYPE_FIRE);
                if(nDamage > 0)
                {
                    // Apply effects to the currently selected target.
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
                    //This visual effect is applied to the target object not the location as above.  This visual effect
                    //represents the flame that erupts on the target not on the ground.
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
                }
             }
        }
       //Select the next target within the spell shape.
       oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
    }
 
 
 
 
 

   }
    //Declare major variables
    object oCaster = OBJECT_SELF;
    int nCasterLvl = GetCasterLevel(oCaster);
    int nMetaMagic = GetMetaMagicFeat();
    int nDamage;
    float fDelay;
    effect eVis = EffectVisualEffect(VFX_IMP_LIGHTNING_M);
    effect eDam;
    //Get the spell target location as opposed to the spell target.
    location lTarget = GetSpellTargetLocation();
    //Limit Caster level for the purposes of damage
    if (nCasterLvl > 10)
    {
        nCasterLvl = 10;
    }
    //Declare the spell shape, size and the location.  Capture the first target object in the shape.
    object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
    //Cycle through the targets within the spell shape until an invalid object is captured.
    while (GetIsObjectValid(oTarget))
    {
        if (spellsIsTarget(oTarget, SPELL_TARGET_SELECTIVEHOSTILE, OBJECT_SELF))
        {
           //Fire cast spell at event for the specified target
            SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_CALL_LIGHTNING));
            //Get the distance between the explosion and the target to calculate delay
            fDelay = GetRandomDelay(0.4, 1.75);
            if (!MyResistSpell(OBJECT_SELF, oTarget, fDelay))
            {
                //Roll damage for each target
                nDamage = d6(nCasterLvl);
                //Resolve metamagic
                if (nMetaMagic == METAMAGIC_MAXIMIZE)
                {
                    nDamage = 6 * nCasterLvl;
                }
                else if (nMetaMagic == METAMAGIC_EMPOWER)
                {
                   nDamage = nDamage + nDamage / 2;
                }
                //Adjust the damage based on the Reflex Save, Evasion and Improved Evasion.
                nDamage = GetReflexAdjustedDamage(nDamage, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_ELECTRICITY);
                //Set the damage effect
                eDam = EffectDamage(nDamage, DAMAGE_TYPE_ELECTRICAL);
                if(nDamage > 0)
                {
                    // Apply effects to the currently selected target.
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
                    //This visual effect is applied to the target object not the location as above.  This visual effect
                    //represents the flame that erupts on the target not on the ground.
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
                }
             }
        }
       //Select the next target within the spell shape.
       oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
    }
}





And my summon creature 1 override.. Works as normal spell, but I want it to summon the warlock minion.

//::///////////////////////////////////////////////
//:: Summon Monster I
//:: NW_S0_Summon1
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Summons a dire badger to fight for the character
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: April 12 , 2001
//:://////////////////////////////////////////////
//:: VFX Pass By: Preston W, On: June 25, 2001
#include "x2_inc_spellhook"
void main()
{
    /*
      Spellcast Hook Code
      Added 2003-06-23 by GeorgZ
      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

    //Declare major variables
    int nMetaMagic = GetMetaMagicFeat();
    int nDuration = GetCasterLevel(OBJECT_SELF);
    effect eSummon = EffectSummonCreature("NW_S_badgerdire");
    if(GetHasFeat(FEAT_ANIMAL_DOMAIN_POWER))
    {
        eSummon = EffectSummonCreature("NW_S_BOARDIRE");
    }
    if(GetTag(GetSpellCastItem()) == "warstaff")
    eSummon = EffectSummonCreature("WARLOCKMIN1");
    {
    effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1);
    //Make metamagic check for extend
    if (nMetaMagic == METAMAGIC_EXTEND)
    {
        nDuration = nDuration *2;   //Duration is +100%
    }
    //Apply the VFX impact and summon effect
    ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eVis, GetSpellTargetLocation());
    ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eSummon, GetSpellTargetLocation(), TurnsToSeconds(nDuration));
}
}
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Warlock
« Reply #4 on: June 13, 2012, 12:22:15 pm »


               You said it compiled but still calls the regular spell? Did you compile it under a different name? Did you have the call ingame call the new name?
               
               

               
            

Legacy_Kingdom_Of_Hearts

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Warlock
« Reply #5 on: June 13, 2012, 02:48:45 pm »


               The names are the same.. Though I don't understand your last quesiton. Thanks! '<img'>
               
               

               
            

Legacy_Kingdom_Of_Hearts

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Warlock
« Reply #6 on: June 14, 2012, 02:49:43 pm »


               Still have not been able to get it to work.. Anyone have any thoughts or solutions or whatever?
               
               

               
            

Legacy_Alex Warren

  • Sr. Member
  • ****
  • Posts: 326
  • Karma: +0/-0
Warlock
« Reply #7 on: June 14, 2012, 04:55:23 pm »


               Could you check if this script works for you?
http://pastebin.com/uZRDtZhr
it's for summon creature I - when cast from item with 'warlock_staff' tag it will summon creature with 'WARLOCKMIN1' resref.
               
               

               
            

Legacy_Kingdom_Of_Hearts

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Warlock
« Reply #8 on: June 14, 2012, 09:55:51 pm »


               Nope, variable defined without type on line 33...
               
               

               
            

Legacy_Alex Warren

  • Sr. Member
  • ****
  • Posts: 326
  • Karma: +0/-0
Warlock
« Reply #9 on: June 15, 2012, 04:47:33 pm »


               yes, it should be
effect  eSummon = EffectSummonCreature("WARLOCKMIN1");
instead of
eSummon = EffectSummonCreature("WARLOCKMIN1");
sorry
               
               

               
            

Legacy_Kingdom_Of_Hearts

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
Warlock
« Reply #10 on: June 16, 2012, 02:06:58 am »


               Thanks! '<img'>
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Warlock
« Reply #11 on: June 16, 2012, 03:52:09 am »


               

Kingdom_Of_Hearts wrote...

Nope, variable defined without type on line 33...



Change Line   39 to :

eSummon = EffectSummonCreature("NW_S_badgerdire");


On line 29 add :
effect eSummon;
               
               

               


                     Modifié par Lightfoot8, 16 juin 2012 - 02:52 .
                     
                  


            

Legacy_WhenTheNightComes

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-0
Warlock
« Reply #12 on: March 14, 2013, 09:02:40 pm »


               Not to commit thread necromancy, or anything. But I'm also using this script, and when using it, I have it as..

   #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();
        int nTouch = TouchAttackRanged(oTarget);
        int nAC =GetAC(oTarget);
        if(GetTag(GetSpellCastItem()) == "warlock_staff")
        {

     if (nTouch > nAC )
         {
            int nDam = d8(GetLevelByclass(class_TYPE_SORCERER)/2);
            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);
    }


Problem is, it's hitting all the time no matter what. I'm trying to get the beam only hit on ranged touch attacks. Help please?
               
               

               


                     Modifié par WhenTheNightComes, 14 mars 2013 - 09:12 .
                     
                  


            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Warlock
« Reply #13 on: March 15, 2013, 04:03:27 am »


               What is the ranged touch and ac of the target?
What is the value of: 
int nTouch = TouchAttackRanged(oTarget);
?

you could add the true parameter and see if you get any feedback:
// The caller will perform a Ranged Touch Attack on oTarget
// * Returns 0 on a miss, 1 on a hit and 2 on a critical hit
int TouchAttackRanged(object oTarget, int bDisplayFeedback=TRUE)
               
               

               


                     Modifié par ffbj, 15 mars 2013 - 04:37 .
                     
                  


            

Legacy_WhenTheNightComes

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


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