Author Topic: Re-setting quest's journal after reset  (Read 379 times)

Legacy_Omnifarious'

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re-setting quest's journal after reset
« on: January 12, 2015, 04:05:25 pm »


               

Hi i'm having a bit of a dilema i need to re apply a player's journal update status after a server reset heres what i have in my on enter script. take note im using NWNX2 already i just need a better script


 


#include "aps_include"

 

/// Blooded 1

 

void main()

{

 

object oPC = GetEnteringObject();

 

if (!GetIsPC(oPC)) return;

 

if (GetPersistentInt(oPC, "Blooded", "pwdata")!= 1)

   return;

 

AddJournalQuestEntry("Blooded", 1, oPC, FALSE, FALSE);

}

 

Okay heres what the problem is the script above will re apply the journal entry for the quest "Blooded" 1 but when not the second part of the quest  so when i make the script look like this it only applys the first part even if they have the second part 

 


#include "aps_include"

 

/// Blooded 1

 

void main()

{

 

object oPC = GetEnteringObject();

 

if (!GetIsPC(oPC)) return;

 

if (GetPersistentInt(oPC, "Blooded", "pwdata")!= 1)

   return;

 

AddJournalQuestEntry("Blooded", 1, oPC, FALSE, FALSE);

 

 

/// Blooded2


 

 

if (!GetIsPC(oPC)) return;

 

if (GetPersistentInt(oPC, "Blooded", "pwdata")!= 2)

   return;

 

AddJournalQuestEntry("Blooded", 2, oPC, FALSE, FALSE);


}


 

when the player is on the second part of the quest it will only apply the first part because they have both of the persistent integers i need a script that will overwrite the first integer to apply the second integer only if they have the second integer or just a whole new script in general that takes care of it can anybody help. take note that this script is NWNX mod

 


 



               
               

               
            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
Re-setting quest's journal after reset
« Reply #1 on: January 14, 2015, 11:57:17 pm »


               You're just trying to restore the quest state to what it was before the reset, yes? Do this:
#include "aps_include"
 
void main()
{
    object oPC = GetEnteringObject();
    int nState = GetPersistentInt(oPC, "Blooded", "pwdata");
   
    // Restore the PC's quest state only if he's started the quest.
    if (nState)
        AddJournalQuestEntry("Blooded", nState, oPC, FALSE, FALSE);
}
Also, this sort of thing is better suited to the scripting forum even though it's NWNX-related.