Neverwinter Nights > Script Request

Spell Scripts!

(1/3) > >>

Ser Red Ronnet Connington:
Sorry for this 420. I tried to send a message to you earlier but for some reason LM had a database error. So to be safe il resend what I asked. Basically I am having trouble with 3 scripts. All 3 are spell scripts. All 3 have the same problem. Fod/Implosion?destruction; what I have done to them is I have removed the death effect that occurs when the opponent rolls a 1. I have replaced that with a damage effect of 100 damage, divine in implosions case, magical in fods case and i did not get to destruction. The problem is it is not working consistently. Infact it only worked once. That being Implosion / Fod, destruction i have not yet done. But what happened was the death effect was removed and it applied my 100 damage effect, but normally, and I have tested it about 20 times, all it does is it claims that when they roll a 1 its a success and no damage is done. Now I dont know why. It could be because of the Saves but I am not sure. I have tinkered with them a lot though so il post em to u. Basically what I want is for Fod/Imp/Destruc to do 100 damage when they roll a 1 instead of doing death. Autofail is on 1=1.


--- Quote ---//::///////////////////////////////////////////////
//:: Implosion
//:: NW_S0_Implosion.nss
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    All persons within a 5ft radius of the spell must
    save at +3 DC or die.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: April 13, 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


    //Declare major variables
    object oTarget;
    int nDam = 100;
    effect eDam = EffectDamage(nDam, DAMAGE_TYPE_DIVINE);
    effect eImplode= EffectVisualEffect(VFX_FNF_IMPLOSION);
    float fDelay;

    //Apply the implose effect
    ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eImplode, GetSpellTargetLocation());
    //Get the first target in the shape
    oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, GetSpellTargetLocation());
    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_IMPLOSION));
           fDelay = GetRandomDelay(0.4, 1.2);
           //Make SR check
           if (!MyResistSpell(OBJECT_SELF, oTarget, fDelay))
           {
                //Make Reflex save
                if(!MySavingThrow(SAVING_THROW_FORT, oTarget, GetSpellSaveDC()+3, SAVING_THROW_TYPE_NONE, OBJECT_SELF, fDelay))
                {
                    //Apply damage effect and the VFX impact

                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));

                }
           }
        }
       //Get next target in the shape
       oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, GetSpellTargetLocation());
    }
}

--- End quote ---
thats implosion


--- Quote ---//::///////////////////////////////////////////////
//:: Finger of Death
//:: NW_S0_FingDeath
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
// You can slay any one living creature within range.
// The victim is entitled to a Fortitude saving throw to
// survive the attack. If he succeeds, he instead
// sustains 3d6 points of damage +1 point per caster
// level.
*/
//:://////////////////////////////////////////////
//:: Created By: Noel Borstad
//:: Created On: Oct 17, 2000
//:://////////////////////////////////////////////
//:: Updated By: Georg Z, On: Aug 21, 2003 - no longer affects placeables

#include "x0_I0_SPELLS"
#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
    object oTarget = GetSpellTargetObject();
    int nCasterLvl = GetCasterLevel(OBJECT_SELF);
    int nMetaMagic = GetMetaMagicFeat();
    int nDamage;
    int nDamage2 = 100;
    effect eDam;
    effect eDam2 = EffectDamage(nDamage2, DAMAGE_TYPE_MAGICAL);
    effect eVis = EffectVisualEffect(VFX_IMP_DEATH_L);
    effect eVis2 = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);

    if(nCasterLvl > 25)
    {
     nCasterLvl = 25;
    }

    if(spellsIsTarget(oTarget, SPELL_TARGET_SELECTIVEHOSTILE, OBJECT_SELF))
    {
        //GZ: I still signal this event for scripting purposes, even if a placeable
        SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_FINGER_OF_DEATH));
         if (GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
        {

            //Make SR check
            if (!MyResistSpell(OBJECT_SELF, oTarget))
               {
                 //Make Forttude save
                 if (!MySavingThrow(SAVING_THROW_FORT, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_NONE))
                 {
                    //Apply the death effect and VFX impact
                    ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam2, oTarget);
                    //ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
                 }
                 else
                 {
                    //Roll damage
                    nDamage = d6(3) + nCasterLvl;
                    //Make metamagic checks
                    if (nMetaMagic == METAMAGIC_MAXIMIZE)
                    {
                        nDamage = 18 + nCasterLvl;
                    }
                    if (nMetaMagic == METAMAGIC_EMPOWER)
                    {
                        nDamage = nDamage + (nDamage/2);
                    }
                    //Set damage effect
                    eDam = EffectDamage(nDamage, DAMAGE_TYPE_NEGATIVE);
                    //Apply damage effect and VFX impact
                    ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
                    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis2, oTarget);
                }
            }
        }
    }
}
--- End quote ---
thats fod


--- Quote ---//::///////////////////////////////////////////////
//:: Destruction
//:: NW_S0_Destruc
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    The target creature is destroyed if it fails a
    Fort save, otherwise it takes 10d6 damage.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Aug 13, 2001
//:://////////////////////////////////////////////

#include "NW_I0_SPELLS"
#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
    object oTarget = GetSpellTargetObject();
    int nMetaMagic = GetMetaMagicFeat();
    int nDamage = 100, nDamage2;
    effect eDam, eDam2;
    effect eVis = EffectVisualEffect(234);
    if(!GetIsReactionTypeFriendly(oTarget))
    {
        //Fire cast spell at event for the specified target
        SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_DESTRUCTION));
        //Make SR check
        if(!MyResistSpell(OBJECT_SELF, oTarget))
        {
            //Make a saving throw check
            if(!/*Fort Save*/ MySavingThrow(SAVING_THROW_FORT, oTarget, GetSpellSaveDC()))
            {
                //Apply the VFX impact and effects
                eDam = EffectDamage(nDamage, DAMAGE_TYPE_DIVINE);
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
            }
            else
            {
                nDamage2 = d6(10);
                //Enter Metamagic conditions
                if (nMetaMagic == METAMAGIC_MAXIMIZE)
                {
                    nDamage2 = 60;//Damage is at max
                }
                else if (nMetaMagic == METAMAGIC_EMPOWER)
                {
                    nDamage2 = nDamage2 + (nDamage2/2); //Damage/Healing is +50%
                }
                //Set damage effect
                eDam2 = EffectDamage(nDamage2, DAMAGE_TYPE_DIVINE);
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam2, oTarget);
            }
            //Apply VFX impact
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
        }
    }
}
--- End quote ---
destruction.

Any help with these would be great!

If anyone else can help please give it a shot!

420:

--- Quote ---I tried to send a message to you earlier but for some reason LM had a database error.
[snapback]37589[/snapback]
--- End quote ---
Mo said he was going to fix that...

Anyway, I've been out of town for 4 days and just got back an hour ago so I'll look your scripts over after I get some dinner.

-420

Ser Red Ronnet Connington:

--- Quote ---Mo said he was going to fix that...

Anyway, I've been out of town for 4 days and just got back an hour ago so I'll look your scripts over after I get some dinner.

-420
[snapback]37619[/snapback]
--- End quote ---

Thanks, 420, the scripts in the end were fine, it was the overiding nw_i0_spells script that was messing up the saving throws! But I am trying now to script a delay into a certain spell, namely divine power. The delay will be X amount of rounds before it can be casted again by an individual. Would one do something like that in the spell script or in the spell hook, or even somewhere else! Any advice with that would be appreciated. What function I would use I dont know.

420:

--- Quote ---But I am trying now to script a delay into a certain spell, namely divine power. The delay will be X amount of rounds before it can be casted again by an individual. Would one do something like that in the spell script or in the spell hook, or even somewhere else! Any advice with that would be appreciated. What function I would use I dont know.
[snapback]37628[/snapback]
--- End quote ---
Use the spellhook for this since you want to "intercept" the spell. I do this with Time Stop on Smith Hold so that each PC can only cast it once every 24 game hours (48 minutes real time).

Let's say you want to only allow a PC to cast Divine Power once every 10 rounds (60 seconds real time). The following code should be incorporated into the spellhook script:

--- Quote ---#include "x2_inc_switches"

void main()
{
int nSpell=GetSpellId();

if(nSpell == SPELL_DIVINE_POWER)
    {
    if(GetLocalInt(OBJECT_SELF, "DPTime") == 1)
        {
        FloatingTextStringOnCreature("Divine Power can only be cast once every 10 rounds.", OBJECT_SELF, FALSE);
        SetModuleOverrideSpellScriptFinished();
        }
    else
        {
        SetLocalInt(OBJECT_SELF, "DPTime", 1);
        DelayCommand(60.0, ExecuteScript("dptimeup", OBJECT_SELF));
        }
    }
}

--- End quote ---

Now make a scripted named "dptimeup" that removes temporary ban:

--- Quote ---void main()
{
DeleteLocalInt(OBJECT_SELF, "DPTime");
}

--- End quote ---

-420

Ser Red Ronnet Connington:

--- Quote ---Use the spellhook for this since you want to "intercept" the spell. I do this with Time Stop on Smith Hold so that each PC can only cast it once every 24 game hours (48 minutes real time).

Let's say you want to only allow a PC to cast Divine Power once every 10 rounds (60 seconds real time). The following code should be incorporated into the spellhook script:
Now make a scripted named "dptimeup" that removes temporary ban:
-420
[snapback]37647[/snapback]
--- End quote ---

Thx mate for the help. Unfortunetly its not worked so far. Do i have to set a variable in the mod to activate the spell hook? also do I compile the spell hook with the script in the main body of the rest of the spell hook. or after it?

Navigation

[0] Message Index

[#] Next page

Go to full version