Making a new curse spell (RESOLVED)

I want to create a new curse spell. Going to call it: “Zedlir’s Curse” a 5th lv spell

I want it to do the following:

Reduce AC by 5 points, reduce Str by 5 points and reduce Cons by 5 points.

I was going to use the Bestow Curse spell as a template, but the script shows only in brackets:

effect eCurse = EffectCurse(2, 2, 2, 2, 2, 2);

It doesn’t give the specific ability scores (i.e. -5 Str) I thought it would. I thought I would just use the str and cons values and try to add an AC value…but…sigh…it is never that straight forward like I thought it would be.

How can I use the template below to do this?

//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Afflicted creature must save or suffer a -2 penalty
    to all ability scores. This is a supernatural effect.
*/
//:://////////////////////////////////////////////
//:: Created By: Bob McCabe
//:: Created On: March 6, 2001
//:://////////////////////////////////////////////
//:: Last Updated By: Preston Watamaniuk
//:: VFX Pass By: Preston W, On: June 20, 2001
//:: Update Pass By: Preston W, On: July 20, 2001


//:: modified by mr_bumpkin Dec 4, 2003
#include "prc_alterations"

#include "NW_I0_SPELLS"
#include "x2_inc_spellhook"

void main()
{
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
SetLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_TRANSMUTATION);
/*
  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();
    effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);
    effect eCurse = EffectCurse(2, 2, 2, 2, 2, 2);

    //Make sure that curse is of type supernatural not magical
    eCurse = SupernaturalEffect(eCurse);
    if(!GetIsReactionTypeFriendly(oTarget))
    {
        //Signal spell cast at event
        SignalEvent(oTarget, EventSpellCastAt(oTarget, SPELL_BESTOW_CURSE));
         //Make SR Check
         if (!MyPRCResistSpell(OBJECT_SELF, oTarget))
         {
            //Make Will Save
            if (!/*Will Save*/ MySavingThrow(SAVING_THROW_WILL, oTarget, (GetSpellSaveDC()+ GetChangesToSaveDC(OBJECT_SELF))))
            {
                //Apply Effect and VFX
                ApplyEffectToObject(DURATION_TYPE_PERMANENT, eCurse, oTarget);
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
            }
        }
    }
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
// Getting rid of the local integer storing the spellschool name

}

Check the NWN Lexicon. It describes the EffectCurse function:

I know you have been pointed to the nwn lexicon before. If you would bother to look in it for EffectCurse you would see that the arguments are explained. It does not do AC.

effect EffectCurse (
int nStrMod = 1,
int nDexMod = 1,
int nConMod = 1,
int nIntMod = 1,
int nWisMod = 1,
int nChaMod = 1
);

Make an effort… :confused:

So in your case it would look like this:

effect eCurse = EffectCurse(5, 5, 0, 0, 0, 0);

1 Like

Ok I looked…but to me I still do not know how to implement it

For example…do I do it like this?

effect eCurse = EffectCurse(2, 2, 2, 2, 2, 2);

effect eCurse = EffectCurse(int nStrMod = 5, int nConMod = 5…AC???)

Ah…thanks andgalf

How would I put a reduction of AC -5 then in there?

You can’t do it in that function, just as @meaglyn said.

You would have to use another function for that. I don’t know which at the moment.

1 Like

Then how can it be done then?

I suspect you could try and use this function:

No wait. That’s not right. Sorry.,

It gives this snippet of script at the bottom I could use, but it has no duration for how long to have it last? And how do I decrease AC still?

// Sample code for applying 1 strength damage to a target

void main()
{
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;

    // Create the effect to apply
    effect eDrain = EffectAbilityDecrease(ABILITY_STRENGTH, 1);

    // Create the visual portion of the effect. This is instantly
    // applied and not persistent with whether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);

    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    // Apply the effect to the object  
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDrain, oTarget);
}

I’m a obviously a bit too tired to think straight right now. Gotta eat something. I’ll investigate and see if I can find a function that does this… Please do some digging in the lexicon yourself too. That would make things easier.

1 Like

I found this on the lexicon, but now I need to know how to mesh it together and add a duration.

// Apply a penalty of 5 Dodge AC to the target. This should just
// lower their AC by 5.

void main()
{
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;

    // Create the effect to apply
    effect eDodgePenalty = EffectACDecrease(5, AC_DODGE_BONUS);

    // Create the visual portion of the effect. This is instantly
    // applied and not persistent with whether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);

    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    // Apply the effect to the object  
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDodgePenalty, oTarget);
}

“Effect sets to remove the specified amount of bonus from an object.”

So you want to remove the AC dodge bonus from an armor or something…is that it?
That’s what it looks like in your script at the moment.

My guess is you could try with

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDodgePenalty, oTarget);

EDIT: You can’t use the above since it has the duration of 0 seconds.

1 Like

I guess…I would settle for the dodge…not sure what the other AC constants are

So yeah…reduce the str, cons, and AC by 5 for say the duration of 10 rounds

Eh, looking at the function again. You always have to look at the function and see what it needs to be put in there:

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDodgePenalty, oTarget, 10.0f);
1 Like

Ok so I played around with those snippets and put this together:

Including the saving throw vs WILL from the bestow curse spell and the other stuff from that script mixed together:

//::///////////////////////////////////////////////
//:: Bestow Curse
//:: NW_S0_BesCurse.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Afflicted creature must save or suffer a -2 penalty
    to all ability scores. This is a supernatural effect.
*/
//:://////////////////////////////////////////////
//:: Created By: Bob McCabe
//:: Created On: March 6, 2001
//:://////////////////////////////////////////////
//:: Last Updated By: Preston Watamaniuk
//:: VFX Pass By: Preston W, On: June 20, 2001
//:: Update Pass By: Preston W, On: July 20, 2001


//:: modified by mr_bumpkin Dec 4, 2003
#include "prc_alterations"

#include "NW_I0_SPELLS"
#include "x2_inc_spellhook"

void main()
{
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
SetLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_TRANSMUTATION);
/*
  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;
    }

{
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;

    // Create the effect to apply
    effect eDrain = EffectAbilityDecrease(ABILITY_STRENGTH, 5);

    // Create the visual portion of the effect. This is instantly
    // applied and not persistent with whether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);


 // Create the effect to apply
    effect eDrain = EffectAbilityDecrease(ABILITY_CONSTITUTION, 5);

    // Create the visual portion of the effect. This is instantly
    // applied and not persistent with whether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);

    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    // Apply the effect to the object

}

// Apply a penalty of 5 Dodge AC to the target. This should just
// lower their AC by 5.

{
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;

    // Create the effect to apply
    effect eDodgePenalty = EffectACDecrease(5, AC_DODGE_BONUS);

    // Create the visual portion of the effect. This is instantly
    // applied and not persistent with whether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);

    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    // Apply the effect to the object
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDodgePenalty, oTarget, 10.0f);
}

  //Make Will Save
            if (!/*Will Save*/ MySavingThrow(SAVING_THROW_WILL, oTarget, (GetSpellSaveDC()+ GetChangesToSaveDC(OBJECT_SELF))))
            {
                //Apply Effect and VFX
                ApplyEffectToObject(DURATION_TYPE_PERMANENT, eCurse, oTarget);
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
            }
        }

DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
// Getting rid of the local integer storing the spellschool name

}

It almost compiled…got this mesage

Can you look through it

See if it will reduce the effects and also use the save vs WILL and the duration is correct

Your curly brackets are all wrong. That’s why it doesn’t compile. It seems you’ve just put them there at random.

OK…took a bunch of stuff out…added a “{” in between the Abilities

It compiled…cross fingers

//::///////////////////////////////////////////////
//:: Bestow Curse
//:: NW_S0_BesCurse.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Afflicted creature must save or suffer a -2 penalty
    to all ability scores. This is a supernatural effect.
*/
//:://////////////////////////////////////////////
//:: Created By: Bob McCabe
//:: Created On: March 6, 2001
//:://////////////////////////////////////////////
//:: Last Updated By: Preston Watamaniuk
//:: VFX Pass By: Preston W, On: June 20, 2001
//:: Update Pass By: Preston W, On: July 20, 2001


//:: modified by mr_bumpkin Dec 4, 2003
#include "prc_alterations"

#include "NW_I0_SPELLS"
#include "x2_inc_spellhook"

void main()
{
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
SetLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_TRANSMUTATION);
/*
  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;
    }

{
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;

    // Create the effect to apply
    effect eDrain = EffectAbilityDecrease(ABILITY_STRENGTH, 5);

    // Create the visual portion of the effect. This is instantly
    // applied and not persistent with whether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);
{

 // Create the effect to apply
   effect eDrain = EffectAbilityDecrease(ABILITY_CONSTITUTION, 5);

    // Create the visual portion of the effect. This is instantly
    // applied and not persistent with whether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);

    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    // Apply the effect to the object

}

// Apply a penalty of 5 Dodge AC to the target. This should just
// lower their AC by 5.

{
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;

    // Create the effect to apply
    effect eDodgePenalty = EffectACDecrease(5, AC_DODGE_BONUS);

    // Create the visual portion of the effect. This is instantly
    // applied and not persistent with whether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);

    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    // Apply the effect to the object
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDodgePenalty, oTarget, 10.0f);
}

  //Make Will Save
            if (!/*Will Save*/ MySavingThrow(SAVING_THROW_WILL, oTarget, (GetSpellSaveDC()+ GetChangesToSaveDC(OBJECT_SELF))))
            {
                //Apply Effect and VFX

                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
            }
      }
 }

Gaah. Your curly brackets are still all wrong. Gaah…