Aller au contenu

Photo

Possible glitch?


  • Veuillez vous connecter pour répondre
1 réponse à ce sujet

#1
Laugh out loud

Laugh out loud
  • Members
  • 117 messages

I was writing a script for a spell that would render the caster and close-by allies immune to sleep and charm effects but in the game it somehow turns into immunity to sneak attack and AC decrease.  Here is a copy of the spell's script:

 

#include "nwn2_inc_spells"
#include "x2_inc_spellhook" 
const int SPELL_ELVEN_HYMN = 1564;
 
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
    int nCasterLvl = GetCasterLevel(OBJECT_SELF);
    float fDuration = TurnsToSeconds(nCasterLvl);
 
    effect eSleep = EffectImmunity(EFFECT_TYPE_SLEEP);
    effect eCharm = EffectImmunity(EFFECT_TYPE_CHARMED);
    effect eVis = EffectVisualEffect(VFX_DUR_SPELL_AID);
effect eVis1 = EffectVisualEffect(VFX_DUR_PIXIEDUST);
    object oTarget = GetSpellTargetObject();
    effect eLink0 = EffectLinkEffects(eSleep, eCharm);
effect eLink1 = EffectLinkEffects(eLink0, eVis);
effect eLink2 = EffectLinkEffects(eLink1, eVis1);    
    //Does not stack with Mass Aid
    if (GetHasSpellEffect(SPELL_ELVEN_HYMN, oTarget))
    {
        return;
    }
 
    float fDelay;
    location lLoc = GetSpellTargetLocation();
 
    //Get the first target in the radius around the caster
    oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_GARGANTUAN, lLoc);
    while(GetIsObjectValid(oTarget))
    {
        if (spellsIsTarget(oTarget, SPELL_TARGET_ALLALLIES, OBJECT_SELF))
        {
   SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_ELVEN_HYMN, FALSE));
   ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink2, oTarget, fDuration);
}
        oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_GARGANTUAN, lLoc);
}
}
 
 
Is there something wrong with my script or is there a problem with the "IMMUNITY_TYPE_SLEEP" and "IMMUNITY_TYPE_CHARM" constants within the game?


#2
Laugh out loud

Laugh out loud
  • Members
  • 117 messages

Never mind, I found the problem.

 

I was using an effect constant and not an immunity.