Spell almost complete need a bit of help - RESOLVED

I am making the second set of cantrips and orisons

I just can’t get this spell to do the -1 penalty on dext. Anyone help?

// Sneeze Cantrip
// sp_sneeze_cant

#include "x0_i0_spells"
#include "x2_inc_spellhook"

// Define constants for the sneeze VFX, sound, and Dexterity penalty.
int nDexPenalty = 1; // Dexterity decrease.
float fDuration = RoundsToSeconds(2); // Duration of the effect (2 rounds).

void main()
{
    // Get the target of the spell.
    object oTarget = GetSpellTargetObject();

    // Check if the target is valid.
    if (GetIsObjectValid(oTarget))
    {
        // Make the target perform the sneeze animation (use laugh or other animation as proxy).
        AssignCommand(oTarget, ActionPlayAnimation(ANIMATION_LOOPING_TALK_LAUGHING));

        // Apply an instant visual effect for the sneeze (using VFX_IMP_NEGATIVE_ENERGY as a proxy).
        effect eVis = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);

        // Make the target say something after sneezing.
            string sSneezeTalk = "Achoo!";
            AssignCommand(oTarget, ActionSpeakString(sSneezeTalk));


        // Check for the Fortitude saving throw.
        int nSaveResult = FortitudeSave(oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_SPELL);

        // If the target fails the save, apply the Dexterity penalty first, followed by visual and sound effects.
        if (nSaveResult == FALSE)
        {

          // Play a sound effect for the sneeze.
            PlaySound("sneeze");

            // Apply the Dexterity decrease for 2 rounds.
            int nDexterity = GetAbilityScore(oTarget, ABILITY_DEXTERITY);
            effect eDexterity = EffectAbilityDecrease(ABILITY_DEXTERITY, nDexterity - 1);

            // Apply a secondary visual effect for the duration (use VFX_DUR_NEGATIVE_ENERGY for feedback).
            eVis = EffectVisualEffect(84);
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oTarget, fDuration);
        }
        else
        {
            // If the save is successful, have the target comment.
            string sLaughTalk = "Ah...ah...whew...that was close, I almost sneezed!";
            AssignCommand(oTarget, ActionSpeakString(sLaughTalk));
        }

        // Stop the sneeze animation after 3 seconds.
        DelayCommand(3.0, AssignCommand(oTarget, ClearAllActions()));
    }
}

Well because you not applying it. I see you applying a visual effect and that all. You defined it with eDexterity but did not put it on the target. Add another ApplyEffectToObject with eDexterity. Good luck :slight_smile: Wow you also have it defined as the target Dex score - 1. Use nDexPenalty that you defined at the top.

Hi Shadow,

Thanks for the quick reply.

Could you script that part for me? And post it here please.

Could you just help me with that part ShadowM?

// sp_sneeze_cant

#include "x0_i0_spells"
#include "x2_inc_spellhook"

// Define constants for the sneeze VFX, sound, and Dexterity penalty.
int nDexPenalty = 1; // Dexterity decrease.
float fDuration = RoundsToSeconds(2); // Duration of the effect (2 rounds).

void main()
{
    // Get the target of the spell.
    object oTarget = GetSpellTargetObject();

    // Check if the target is valid.
    if (GetIsObjectValid(oTarget))
    {
        // Make the target perform the sneeze animation (use laugh or other animation as proxy).
        AssignCommand(oTarget, ActionPlayAnimation(ANIMATION_LOOPING_TALK_LAUGHING));

        // Apply an instant visual effect for the sneeze (using VFX_IMP_NEGATIVE_ENERGY as a proxy).
        effect eVis = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);

        // Make the target say something after sneezing.
            string sSneezeTalk = "Achoo!";
            AssignCommand(oTarget, ActionSpeakString(sSneezeTalk));


        // Check for the Fortitude saving throw.
        int nSaveResult = FortitudeSave(oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_SPELL);

        // If the target fails the save, apply the Dexterity penalty first, followed by visual and sound effects.
        if (nSaveResult == FALSE)
        {

          // Play a sound effect for the sneeze.
            PlaySound("sneeze");

            // Apply the Dexterity decrease for 2 rounds.
           //  Not needed for example if the target had 13 dex you would do 12 dex damage.
           //  int nDexterity = GetAbilityScore(oTarget, ABILITY_DEXTERITY);
           //  Apply the dex penalty defined at the top for the time defined at the top
            effect eDexterity = EffectAbilityDecrease(ABILITY_DEXTERITY, nDexPenalty);
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDexterity, oTarget, fDuration);

            // Apply a secondary visual effect for the duration (use VFX_DUR_NEGATIVE_ENERGY for feedback).
            eVis = EffectVisualEffect(84);
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oTarget, fDuration);
        }
        else
        {
            // If the save is successful, have the target comment.
            string sLaughTalk = "Ah...ah...whew...that was close, I almost sneezed!";
            AssignCommand(oTarget, ActionSpeakString(sLaughTalk));
        }

        // Stop the sneeze animation after 3 seconds.
        DelayCommand(3.0, AssignCommand(oTarget, ClearAllActions()));
    }
}```

Hi ShawdowM,

It compiled, but it did not work. It did not apply the penalty.

I’ll send you my test mod if you want to test it.

Here is the demo module with tlk and hak.

Cantrip_Spells2.zip (2.1 MB)

Did the target fail the saving throw? if you want sure. I check the script too.

I have 2 of the 6 cantrips working. I plan to release to the vault. Credit goes to you…if you can help.

Penalty did not work on failed save

Oh the spells in the folder need updating…but the spells in the demo module are the more recent ones.

I tested it and worked fine. What did you target it on?

I targeted on the NPC’s in the demo mod I attached above and the monsters.

It worked for you in my demo mod?

You downloaded it? Did you examine the NPC to see the effect? Even in the messages in the talk window did not show it was applied

You have some kind of script that setting your little girl and monsters to 3 dexterity so the spell has no affect on them. Put down one of the henchmen and go in as a dm and use the scroll on the henchmen. Examine the creature and girl and you see somehow their stats have been modded on spawn.

But they are not spawned in…

I am using a vanilla module. Why would the NPCS and monsters have a dext of 3? It worked for you in that demo mod?

I found it, it because they are set to immobile. Set the little girl to very slow and test again. Weird I do not remember immobile doing that to stats.

ok…will test. But if you test the “holiness” spell the charisma bonus is given to the immobile creatures…weird

Yeah immobile is affecting dex only go in as a dm an look at the character sheet of the girl and compare to it in the toolset.

1 Like

Well son-0f-a-gun…it worked as you said. i set the NPC gal and guy to default movement and it worked.