Hold Undead Spell (RESOLVED)

Hi everyone…again.

As you see lately I have been trying to make new spells. Here is another one. I got this one to compile. I based it on the Hold Person spell. Only one drawback:

I Changed the constant to undead and outsiders. I tried to just make it undead (Hold Undead - ideally I would just like this), but when I pulled the other creatures out of that Hold Person spell…it would not compile unless there were at least two creatures in the script. So technically the spell is “Hold Undead and Outsiders”…kind of like how some outsiders can be grouped in with undead…like higher level Clerics and Paladins can effect outsiders with turning at higher levels. One big problem. Undead cannot be paralyzed. Ugh…how do I script around this in this script?

Here is the script below (I attach it too):

//::///////////////////////////////////////////////
//:: Hold Undead & Outsiders
//:: sp_holdundead
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
//:: The target freezes in place, standing helpless.

*/

//:://////////////////////////////////////////////

//:: modified by me Dec/2022
#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_NECROMANCY);
/*
Spellcast Hook Code
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) + GetChangesToCasterLevel(OBJECT_SELF));
int nMeta = GetMetaMagicFeat();
int nDuration = nCasterLvl;
nDuration = GetScaledDuration(nDuration, oTarget);
effect eParal = EffectParalyze();
effect eVis = EffectVisualEffect(82);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
effect eDur2 = EffectVisualEffect(VFX_DUR_PARALYZED);
effect eDur3 = EffectVisualEffect(VFX_DUR_PARALYZE_HOLD);

effect eLink = EffectLinkEffects(eDur2, eDur);
eLink = EffectLinkEffects(eLink, eParal);
eLink = EffectLinkEffects(eLink, eVis);
eLink = EffectLinkEffects(eLink, eDur3);

if(!GetIsReactionTypeFriendly(oTarget))
{
    //Fire cast spell at event for the specified target
    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_HOLD_PERSON));
    //Make sure the target is undead or outsider
      if (GetIsPlayableRacialType(oTarget) ||
       GetRacialType(oTarget) == RACIAL_TYPE_UNDEAD||
       GetRacialType(oTarget) == RACIAL_TYPE_OUTSIDER)
       {
        //Make SR Check
        if (!MyPRCResistSpell(OBJECT_SELF, oTarget))
        {
            //Make Fortitude save
            if (!/*Fortitude Save*/ MySavingThrow(SAVING_THROW_FORT, oTarget, (GetSpellSaveDC()+ GetChangesToSaveDC(OBJECT_SELF))))
            {
                //Make metamagic extend check
                if (nMeta == METAMAGIC_EXTEND)
                {
                    nDuration = nDuration * 2;
                }

                //Apply paralyze effect and VFX impact
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(nDuration));
            }
        }
    }
}

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

sp_holdundead.zip (1.3 KB)

1 Like

Below I did a Demo module to test this in. If anyone wants to fix my script and test it. Any advice would be welcome like tlk file entry changes, 2da changes, effects changes, etc.
hold undead & outsiders spell.zip (137.4 KB)

Once I get feedback and scripting done…I will release the final to the vault and also give credit to those who helped. Heck…fix it and release it yourself if you want. You can even use the stuff I already did in the attachment…no pride here…take all the credit. I just want this for the community…and myself to use :slight_smile:

1 Like

So, if you read the code as if it were english that if statement under //Make sure the targer is undead or outsider is something like:

“if the target is a playable race or if the racialtype of the target is UNDEAD or if the racialtype of the target is OUTSIDER then do the spell stuff…”

How would you change that above to do what you want?

But, the undead have protection from paralyze on their skins. How do I overcome that in this script. That’s all I need in the script to finalize it.

I don’t think you read what I wrote… (and yes, it doesn’t do anything about protection but does point you at fixing a couple of other issues in the script).

Bud…I don’t know how to do it…why I’m asking.

Do you model meaglyn? Do you know how to do it or bother to learn it? If not…probably because of the same reasons I do not also with scripting.

I had a stroke 4 years ago. I have some “issues” with working through more complicated things. I do the best I can. My head had 4 small clots plus I had a CVST (where the main blood vessel that runs down the middle of your brain was fully blocked in my case. So I have troubles with attention span and eye issues and other cognitive issues…I try my best bud.

1 Like

I just asked you to read the part I put in quotes and see what you could do to that english sentence, not scripting, to make it do more of what you wanted for this spell, which right now should be called “hold human, elf, dwarf, halfling, gnome, half-elf, half-orc, undead or outsider” :slight_smile:

Sorry to hear about your medical issues.

And no, I don’t model. But it’s because I haven’t any real interest in it. If I were working with models to the extent that you are working scripts then I’d learn how to do it.

I was trying to help you do just that. But I certainly don’t have to.

I know meaglyn…sorry meant no offense.

I just get a bit frustrated at times when people keep telling me I need to learn how to script when i have limitations in learning. It’s why I reach out to guys like you in the community. I really appreciate your help…believe me I do. Like I mentioned I’m an “ideas” guy…I can do some stuff, but I’m limited in my abilities and it’s why I get frustrated with myself trying to learn this stuff. It’s why I depend on the kindness of this community. I really do appreciate your help bud.

And I still don’t know how to do this last part…lol…I just need that part of the script I changed around to finish this. It’s easy for me to pull out “Constants” I see and replace them with others…I can add brackets here and there I fidget around with scripts…

I hope you and your family had a Merry Christmas meaglyn,

Would you be able to help me finish this last part of the script…

At line 62-64, as meaglyn pointed out, you have

          if (GetIsPlayableRacialType(oTarget) ||
           GetRacialType(oTarget) == RACIAL_TYPE_UNDEAD||
           GetRacialType(oTarget) == RACIAL_TYPE_OUTSIDER)

but you only probably want

          if (GetRacialType(oTarget) == RACIAL_TYPE_UNDEAD||
           GetRacialType(oTarget) == RACIAL_TYPE_OUTSIDER)

My only other question is line 60, where you have the holdover

        SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_HOLD_PERSON));

but I am not sure what you could change this too, but SPELLABILITY_TURN_UNDEAD comes to mind.

Hi Mannast,

Thanks for your input on this too…

Ok, I replaced all the above you suggested. But this spell still does not work as intended. The undead’s immunity to paralyzation can’t be overcome. I need the spell to hold (freeze) the undead.

Looking at the Turn Undead scripts, they use

effect eParalyze = EffectCutsceneParalyze();
effect eImmobilize = EffectCutsceneImmobilize();

instead of just EffectParalyze() which you have in line 46.

Nope…didn’t work. Test out my demo module above in this thread.

Just checking if you linked those new effects to the other effects?

effect eParal = EffectCutsceneParalyze();
effect eImmobilize = EffectCutsceneImmobilize();
effect eVis = EffectVisualEffect(82);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
effect eDur2 = EffectVisualEffect(VFX_DUR_PARALYZED);
effect eDur3 = EffectVisualEffect(VFX_DUR_PARALYZE_HOLD);

effect eLink = EffectLinkEffects(eDur2, eDur);
eLink = EffectLinkEffects(eLink, eParal);
eLink = EffectLinkEffects(eLink, eImmobilize);
eLink = EffectLinkEffects(eLink, eVis);
eLink = EffectLinkEffects(eLink, eDur3);

yup…but did not work…

Try it

Unfortunately, while I can type and mess around with the toolset at work, running the game is an absolute nope. Will try when I get a chance.

1 Like

Thanks Mannast