Author Topic: Will save problem.  (Read 354 times)

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
Will save problem.
« on: February 23, 2014, 03:35:34 pm »


               I was confused when I came here. Now it's gotten worse.
I wanted to search the forum for Will save related topics. Now when I enter a search, NWN 1 is not included ?

The following is the script placed On Enter of a trigger.

void main()
{
 object oTrig = GetObjectByTag("TrLucy02");
 object oPC = GetEnteringObject();
 object oGirl = GetObjectByTag("Lucy");
 object oItem = GetItemPossessedBy(oPC,"ScrapofCloth");
 string sSay = "Watch out! There's a trap!";
 string sMesS = "The girl's singing pulls at your mind. You place the scraps of cloth in your ears.";
 string sMesF = "You feel a strange sensation, in your mind.";
 effect eSing = EffectVisualEffect(VFX_DUR_BARD_SONG);
 int nSave = WillSave(oPC,10);
 int nSaveB = WillSave(oPC,19);
 if(GetIsPC(oPC))
 {
  AssignCommand(oGirl,ActionSpeakString(sSay,TALKVOLUME_TALK));
  DelayCommand(3.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,eSing,oGirl,10.0f));
  if(GetIsObjectValid(oItem))
  {
   if(nSave > 0)
   {
    DelayCommand(4.0,SendMessageToPC(oPC,sMesS));
    DestroyObject(oTrig,5.0);
    SetLocalInt(oPC,"Lucy",1);
   }
   else
   {
    DelayCommand(4.0,SendMessageToPC(oPC,sMesF));
    DestroyObject(oTrig,5.0);
    SetLocalInt(oPC,"Lucy",2);
   }
  }
  else
  {
   if(nSaveB > 0)
   {
    DelayCommand(4.0,SendMessageToPC(oPC,sMesS));
    DestroyObject(oTrig,5.0);
    SetLocalInt(oPC,"Lucy",1);
   }
   else
   {
    DelayCommand(4.0,SendMessageToPC(oPC,sMesF));
    DestroyObject(oTrig,5.0);
    SetLocalInt(oPC,"Lucy",2);
   }
  }
 }
}

Build test resulted in the following

Will Save ran twice. first, PC Will Save success( 15- 1 = 14 vs DC 10). The second, Will Save failure ( 13 -1= 12 vs DC 19). Only the failure message was sent, and oGirl on Convo's Int was set to 2.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Will save problem.
« Reply #1 on: February 23, 2014, 03:44:16 pm »


               

Ed Venture wrote...

I was confused when I came here. Now it's gotten worse.
I wanted to search the forum for Will save related topics. Now when I enter a search, NWN 1 is not included ?
 


That's one of the ways the new forums suck, yes. Use the Omnibus by OldTimeRadio - it does not suck, not even remotely. It has all the old forum content, though the formatting is lost, and is searchable. Which is pretty much the opposite of suck. '<img'>

Omnibus

As for the meat of your post, please consider using pastebin with C# setting. Your brackets make my eyes bleed.

Funky
               
               

               


                     Modifié par FunkySwerve, 23 février 2014 - 03:46 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Will save problem.
« Reply #2 on: February 23, 2014, 06:31:48 pm »


               I see no problem with what was returned.  It indicates that your character does not have a "scrap of cloth" and has failed the corresponding will save.  If you did not want the other will save to be displayed you could perform the saving throw within the corresponding paths for having or not having the item.

For example:

int nSave;
if(GetIsObjectValid(oItem))
    {
    nSave = WillSave(oPC, 10);
    if(nSave > 0)
        {
        }
   else
        {
        }
    }
else
    {
    nSave = WillSave(oPC, 19);
    if(nSave > 0)
        {
        }
    else
         {
         }
    }
               
               

               


                     Modifié par WhiZard, 23 février 2014 - 06:34 .
                     
                  


            

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
Will save problem.
« Reply #3 on: February 24, 2014, 05:34:40 am »


               FunkySwerve,
Thanks for the reply. Forgive me for making your eyes bleed. I have seen the pastebin before.
I copy and paste a script in pastebin and then create a link to this page. Now here comes the sad part. I have never created a link in my life. To be fare though, you should see how fast I am on an abacus. I will check out omnibus right after I finish these replies.
Thanks again,
Ed
               
               

               
            

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
Will save problem.
« Reply #4 on: February 24, 2014, 05:44:24 am »


               WhiZard,
Thank you. You were right. The way it was writen, the save throws were firing from the variable list.
I changed the if statements, and now it works fine.
if(WillSave(oPC,10) > 0)
I was also thinking of adding a bonus to the save for examing a sleeping NPC gaurd. The Npc desription tells the player that the NPC has a scrap of cloth in one ear. Is there a way to find if a player has examined a creature ?

Thank you for your help,
Ed