Author Topic: How do you make persistant quests?  (Read 667 times)

Legacy_Haunted-Within

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
How do you make persistant quests?
« on: February 24, 2015, 05:59:11 am »


               

Hi, I am trying to get my mod to have some kind of persistence?


I need to know how I would be able to save quest info after a reset? 


My mod has about 10 quests that have to be done in order to be


able to move on to the next one. I have no script writing ablity and


am just learning how to look at scripts to see what they do.


Could someone help me with the scripts and where to put them?


                                                                                               Thx.



               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
How do you make persistant quests?
« Reply #1 on: February 24, 2015, 02:23:49 pm »


               

Persistence is usually implemented via database. I don't know what you exactly need, but if, say, you want to set or retrieve quests which were achieved by each PC, and if you only have 10 quests, you should go simpler and use a single variable for each PC. The variable could hold bitwise values indicating which quests were done. You could store the variable on an undroppable plot item, or on the PC hide, or eventually in the DB if you have more data to store and need flexibility. There are many ways, depends what you need.


 


 


Kato 



               
               

               
            

Legacy_Haunted-Within

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
How do you make persistant quests?
« Reply #2 on: February 24, 2015, 10:16:23 pm »


               

Hmm im struggling here its all greek to me lol, I have no clue how to set up a database, but not sure if i need one either. I am just building a small mod for my friends and family to play online, but most are in other parts of the world so, I need away to store quest info. I think the server vault saves the character info, items and such, so know I need to implement some sort of quest saving system or some way for the game to see that quests have been complete. The storing info on an item sounds great if I just knew how to do that.



               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
How do you make persistant quests?
« Reply #3 on: February 24, 2015, 10:57:39 pm »


               

This could form the base of your include file. You can call the functions from wherever you need, provided that your script includes this file. If your quests are given through conversation, the scripts calling these functions will be placed in either "Text appears when" or "Action taken" tabs of the convo.


 


 


// CONSTANTS

 

const string QUEST_ITEM_TAG = ""; // put the tag of your undroppable item here

const string QUEST_ITEM_VAR = "quests";

 

const int QUEST_1 = 1; // these are the quest IDs

const int QUEST_2 = 2;

const int QUEST_3 = 4;

const int QUEST_4 = 8;

const int QUEST_5 = 16;

const int QUEST_6 = 32;

const int QUEST_7 = 64;

const int QUEST_8 = 128;

const int QUEST_9 = 256;

const int QUEST_10 = 512;

 

 

// PROTOTYPES

 

// Returns TRUE if nQuest is done for oPC

int GetQuestDone(object oPC, int nQuest);

 

// Sets nQuest as done for oPC.

void SetQuestDone(object oPC, int nQuest);

 

 

 

// DEFINITIONS

 

int GetQuestDone(object oPC, int nQuest)

{

   object oQuestItem = GetItemPossessedBy(oPC, QUEST_ITEM_TAG);

   int nDone = GetLocalString(oQuestItem, QUEST_ITEM_VAR);

   return nDone & nQuest;

}

 

 

void SetQuestDone(object oPC, int nQuest)

{

   object oQuestItem = GetItemPossessedBy(oPC, QUEST_ITEM_TAG);

   int nDone = GetLocalString(oQuestItem, QUEST_ITEM_VAR);

   SetLocalInt(oQuestItem, QUEST_ITEM_VAR, nDone|nQuest);

}


 


 


 


Kato 



               
               

               
            

Legacy_Haunted-Within

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
How do you make persistant quests?
« Reply #4 on: February 25, 2015, 12:12:16 am »


               

Ok, I put the script in my actions taken script and get an error msg that says Error: PARSING VARIABLE LIST on the line


// Returns TRUE if nQuest is done for oPC

int GetQuestDone(object oPC, int nQuest); and i made a undropable plot item with the tag QuestToken.Thank you very much for the help.


               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
How do you make persistant quests?
« Reply #5 on: February 25, 2015, 10:23:05 am »


               

This is a pretty good set up that most people use or start with, I'm using a modified version of it:


 


http://neverwinterva...quests-journals



               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
How do you make persistant quests?
« Reply #6 on: February 25, 2015, 01:45:32 pm »


               


 


Ok, I put the script in my actions taken script and get an error msg that says Error: PARSING VARIABLE LIST on the line


// Returns TRUE if nQuest is done for oPC

int GetQuestDone(object oPC, int nQuest); and i made a undropable plot item with the tag QuestToken.Thank you very much for the help.

 

 



 


 


Actually the script from post #4 is an include file example, so it is not the script you must put in in the actions taken. You only need to have it in your module, and include it in the scripts which use it. So, for the actions taken script of your convo, it would look like this, assuming for instance that the include is named "quests_include":

 

#include "quests_include"

void main()

{

      object oPC = GetPCSpeaker();

      SetQuestDone(oPC, QUEST_1); // player has done quest 1, let's update the variable. Note that this could be called from anywhere else when the PC finishes a quest      


 

 

However, in your conversation you will also want to check if the player has finished a given quest, and this would take place in the "Appears when" tab:

 

#include "quests_include"

int StartingConditional()

{

     object oPC = GetPCSpeaker();

     return GetQuestDone(oPC, QUEST_1); // returns TRUE if oPC has done quest 1, which means that the convo node having this script will be displayed

}

 

 

And there you are. This is only a very basic setup but it does the job and it is very easy to modify to your taste. If you don't feel comfortable with the code, then GhostOfGod's suggestion might be the way to go.

 

 

 

Kato


               
               

               
            

Legacy_Haunted-Within

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
How do you make persistant quests?
« Reply #7 on: February 26, 2015, 12:37:33 am »


               

Thank you guys for the info and the help i will do my best to get one of the systems in place.


Thanks again. 



               
               

               
            

Legacy_Haunted-Within

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
How do you make persistant quests?
« Reply #8 on: February 26, 2015, 07:48:56 am »


               

Alright, I got the PQJ to work. WOOt!! The only problem I have now, is that when i make journal entrys it shows up in the dialog screen on the first quest but no message on the 2nd or 3rd one? Is there a way i can fix that? The journal entrys show up in the journal just fine, its the yellow message in the dialog box thats not showing up . Thank you Kato and GhostOfGod.