Aller au contenu

Photo

[FUNCTION FortitudeSave()] What's oSaveVersus? read


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
WhiteTiger

WhiteTiger
  • Members
  • 479 messages

/*

// Do a Fortitude Save check for the given DC
// - oCreature
// - nDC: Difficulty check
// - nSaveType: SAVING_THROW_TYPE_*
// - oSaveVersus
// Returns: 0 if the saving throw roll failed
// Returns: 1 if the saving throw roll succeeded
// Returns: 2 if the target was immune to the save type specified
// Note: If used within an Area of Effect Object Script (On Enter, OnExit, OnHeartbeat), you MUST pass
// GetAreaOfEffectCreator() into oSaveVersus!!
int FortitudeSave(object oCreature, int nDC, int nSaveType=SAVING_THROW_TYPE_NONE, object oSaveVersus=OBJECT_SELF)

*/

 

I need to use FortitudeSave() in two circumstances: onhitcast and onareaheartbeat.

 

How should I do for the first case? This way?

object oTarget = GetSpellTargetObject();

int iCheck = FortitudeSave(oTarget, 35, SAVING_THROW_TYPE_DISEASE);
if(iCheck == 0) DoAction();

And for the second? Like this?

object oTarget = GetFirstObjectInArea();
int iCheck;
while (GetIsObjectValid(oTarget))
    {
    if(GetIsPC(oTarget)
        {
            iCheck = FortitudeSave(oTarget, 35, SAVING_THROW_TYPE_DISEASE, GetAreaOfEffectCreator()); 
            if(iCheck == 0) DoAction();
        }
    oTarget = GetNextObjectInArea();
    } 


#2
WhiZard

WhiZard
  • Members
  • 1 204 messages

oSaveVersus is required for finding the alignment of the caster.  For example, if I had protection from evil, then a saving throw vs. mindaffecting would return 2 (for immunity) if oSaveVersus was provided and oSaveVersus was evil.  If I did not include that parameter, then it wouldn't give a 2 return value unless my immunity was not alignment based (e.g. clarity).  However oSaveVersus defaults to OBJECT_SELF so in standard spell scripts it often isn't filled in as it will get the caster anyway.


  • WhiteTiger aime ceci

#3
WhiteTiger

WhiteTiger
  • Members
  • 479 messages

I see... thanks. works both cases  :)