Obscurement Spell

I’m really loving making spells.

I just put together another spell. A spell called: “Obscurement”

The goal is to cause a (Thick) cloud around the caster to hide him (and his party if he has one). Enemies entering it would become blinded. So it effects enemies but not caster and friends (party and familiars and henchmen).

I got most of the spell VFX effects done in the script that compiles (yay!!) but not how to script the blindness for enemies. The cloud I took from the cloud of bewilderment and I put a placeable cloud of dust too. Please take a look at the spell below. Try it out too. I really would like to make the cloud so thick no one can see people inside it. Can I double the cloud effect to make it thicker?

//A mix of the spell cloud of bewilderment and another spell obscurement. Trying to improve a spell
//of Obscurement so itmakes a cloud and the caster and party hide in it. Those outside of
// caster and party entering it will be blinded. That is the pupose of ths spell.

#include “NW_I0_SPELLS”
#include “x0_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_CONJURATION);

/*
Spellcast Hook Code
Added 2003-07-07 by Georg Zoeller
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;
}

       //Declare major variables
effect eAOE = EffectAreaOfEffect(39);
location lTarget = GetSpellTargetLocation();
int nDuration = (GetCasterLevel(OBJECT_SELF)+ GetChangesToCasterLevel(OBJECT_SELF));
effect eImpact = EffectVisualEffect(VFX_IMP_DUST_EXPLOSION);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eImpact, lTarget);
if (nDuration < 1)
{
    nDuration = 1;
}
int nMetaMagic = GetMetaMagicFeat();
//Make metamagic check for extend
if (nMetaMagic == METAMAGIC_EXTEND)
{
    nDuration = nDuration *2;   //Duration is +100%
}
//Create the AOE object at the selected location
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eAOE, lTarget, RoundsToSeconds(nDuration));

{

DeleteLocalInt(OBJECT_SELF, “X2_L_LAST_SPELLSCHOOL_VAR”);
// Erasing the variable used to store the spell’s spell school

}

      location lPC = GetLocation(OBJECT_SELF);
      object oArea = GetArea(OBJECT_SELF);
      int nObjectType = OBJECT_TYPE_PLACEABLE;
      string strTemplate = "plc_dustplume"; // Standard chicken
      int bUseAppearAnimation = TRUE;
      object OM = CreateObject(nObjectType, strTemplate, lPC, bUseAppearAnimation);
      DelayCommand(60.0, DestroyObject(OM));

      int i;
      int pn;
      int iFace;
      vector vOM1;
        while (i < 20)
    {
      pn = d4();
      vOM1 = GetPosition(OM);
      switch (pn)
        {
        case 1:
         vOM1.x += IntToFloat(d4());
         vOM1.y += IntToFloat(d4());
         break;
        case 2:
         vOM1.x -= IntToFloat(d4());
         vOM1.y += IntToFloat(d4());
         break;
        case 3:
         vOM1.x += IntToFloat(d4());
         vOM1.y -= IntToFloat(d4());
         break;
        case 4:
         vOM1.x -= IntToFloat(d4());
         vOM1.y -= IntToFloat(d4());
         break;
         }
      iFace = d100();
      location lPC1 = Location(oArea, vOM1, IntToFloat(iFace));
      object OM1 = CreateObject(nObjectType, strTemplate, lPC1, bUseAppearAnimation);
      DelayCommand(60.0, DestroyObject(OM1));

     i++;
    }

    SendMessageToAllDMs("Obscuring Mist was cast by "+GetPCPlayerName(OBJECT_SELF)+".");

}

I hate that…Why does posting a script do that? I want the whole script to be seen as one script…how do you post it where it shows the whole script without breaking it up?

Here is a zipped copy of the spell.
spell obscurement.zip (1.4 KB)

//A mix of the spell cloud of bewilderment and another spell obscurement. Trying to improve a spell
//of Obscurement so itmakes a cloud and the caster and party hide in it. Those outside of
// caster and party entering it will be blinded. That is the pupose of ths spell.

#include “NW_I0_SPELLS”
#include “x0_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_CONJURATION);

/*
    Spellcast Hook Code
    Added 2003-07-07 by Georg Zoeller
    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;
    }
    
    //Declare major variables
    
    effect eAOE = EffectAreaOfEffect(39);
    location lTarget = GetSpellTargetLocation();
    int nDuration = (GetCasterLevel(OBJECT_SELF)+ GetChangesToCasterLevel(OBJECT_SELF));
    effect eImpact = EffectVisualEffect(VFX_IMP_DUST_EXPLOSION);
    
    ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eImpact, lTarget);
    
    if (nDuration < 1)
        nDuration = 1;

    int nMetaMagic = GetMetaMagicFeat();

    //Make metamagic check for extend

    if (nMetaMagic == METAMAGIC_EXTEND)
        nDuration = nDuration * 2;   //Duration is +100%

    //Create the AOE object at the selected location

    ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eAOE, lTarget, RoundsToSeconds(nDuration));

    DeleteLocalInt(OBJECT_SELF, “X2_L_LAST_SPELLSCHOOL_VAR”);
    // Erasing the variable used to store the spell’s spell school

    location lPC = GetLocation(OBJECT_SELF);
    object oArea = GetArea(OBJECT_SELF);
    int nObjectType = OBJECT_TYPE_PLACEABLE;
    string strTemplate = "plc_dustplume"; // Standard chicken
    int bUseAppearAnimation = TRUE;
    object OM = CreateObject(nObjectType, strTemplate, lPC, bUseAppearAnimation);

    DelayCommand(60.0, DestroyObject(OM));

    int i;
    int pn;
    int iFace;
    vector vOM1;
    while (i < 20)
    {
        pn = d4();
        vOM1 = GetPosition(OM);
        
        switch (pn)
        {
            case 1:
                vOM1.x += IntToFloat(d4());
                vOM1.y += IntToFloat(d4());
                break;
            case 2:
                vOM1.x -= IntToFloat(d4());
                vOM1.y += IntToFloat(d4());
                break;
            case 3:
                vOM1.x += IntToFloat(d4());
                vOM1.y -= IntToFloat(d4());
                break;
            case 4:
                vOM1.x -= IntToFloat(d4());
                vOM1.y -= IntToFloat(d4());
                break;
        }
        
        iFace = d100();
        location lPC1 = Location(oArea, vOM1, IntToFloat(iFace));
        object OM1 = CreateObject(nObjectType, strTemplate, lPC1, bUseAppearAnimation);
        DelayCommand(60.0, DestroyObject(OM1));
        i++;
    }
    SendMessageToAllDMs("Obscuring Mist was cast by "+GetPCPlayerName(OBJECT_SELF)+".");
}

You only need the ``` at the start and end of the code when you post it into a code box.

TR

1 Like

Thanks

Hi Tarot_Redhand

I just tested my spell I thought you fixed you posted above. It is exactly what I uploaded above. No changes were made to it. Did you send me the wrong one?

No, I only illustrated how to post your code in a code box. If you read the sentence below your code that I posted, you’ll see what I was explaining.

TR

Oh…sorry. I had thought you fixed the spell for me.

I still can’t get the spell to hide those (PC and party) in the cloud and blind those who enter. Do you have any suggestions on how to do that in the script bud?