Author Topic: [FUNCTION FortitudeSave()] What's oSaveVersus? read  (Read 423 times)

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
[FUNCTION FortitudeSave()] What's oSaveVersus? read
« on: July 20, 2014, 01:03:26 am »


               

/*



// 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();
    } 


               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
[FUNCTION FortitudeSave()] What's oSaveVersus? read
« Reply #1 on: July 20, 2014, 06:03:18 am »


               

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.



               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
[FUNCTION FortitudeSave()] What's oSaveVersus? read
« Reply #2 on: July 20, 2014, 12:17:31 pm »


               

I see... thanks. works both cases  '<img'>