Author Topic: Text appears when the PC has the right Journal entry. Or perhaps a better way of doing it?  (Read 876 times)

Legacy_simomate

  • Full Member
  • ***
  • Posts: 162
  • Karma: +0/-0


               A guy is standing by a tree. PC approaches him, and he says.

"Yes? What do you want?"

PC says, "I have a few questions."

"Well? Spit it out."

PC:

Where am I?

Who are you?

What are you doing here?
---------------------
PC then leaves and talks to another guy, who gives them a quest. PC returns to the guy standing by the tree and says,

"I have a few questions."

"Well? Spit it out."

PC:

Where am I?

Who are you?

What are you doing here?

Do you know where I can find the lost treasure of awesomeness?
-------------------------------------------
So pretty much what I want, is that last question to only appear when the PC has recieved the quest.
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0


               You want to set a variable to guide the quest forward and so you know what stage of the quest it is at.

It's personal choice on how you want to name the variable. For myself, I might call the variable lost_q and when it's given by the first NPC, set the value of the variable to 5. The next time the quest is updated, change the variable to 10, 15, 20, etc. The numeric value of the journal would match the variable.

Example -

NPC#1 - gives out the quest.
NPC#2 - can ask about the quest.
NPC#3 - can ask about the shed.'
SHED  - where to find the treasure.

NPC1 - When you first hand out the quest, set the variable and the journal entry.

SetLocalInt(GetModule(), "lost_q", 5);


You now know the quest has been given to the player and set the variable lost_q to equal 5.

NPC#2 would then have a TEXT APPEARS conditional script on the "Do you know where I can find the lost treasure of awesomeness?" that checks the value of the variable.

int StartingConditional()
{

   // Inspect local variables
   if(!(GetLocalInt(GetModule(), "lost_q") == 5))
       return FALSE;

   return TRUE;
}


If it equals five, display the line, if not, the line is not displayed as an option for the player.

Now somewhere during that conversation option, NPC#2 tells the player where they last heard the treasure of awesomeness was. This is where you'd use the ACTIONS TAKEN TAB and write another script to update the lost_q variable and also use the OTHER ACTIONS TAB to select the appropriate journal entry.

SetLocalInt(GetModule(), "lost_q", 10);


Changing the variable to 10 serves two purposes. First, it updates the quest variable and tells the game what stage the quest is at. Now that it equals 10, the player will no longer receive the "Do you know where I can find the lost treasure of awesomeness?" option. Since they already asked this question and the variable was updated from 5 to 10, it won't be displayed.

Second, it sets up the quest for the next stage of finding the treasure.

This is how I normally put quests together. With each variable update, 5, 10, 15, 20, etc., there is also a journal entry number associated with the variable number. This way, when I'm reading journal entry #25 for this particular quest, I know that quest entry is only handed out when the variable equals 25.

Setting variables is the key.

FP!
               
               

               


                     Modifié par Fester Pot, 20 septembre 2010 - 12:36 .
                     
                  


            

Legacy_Mordaedil

  • Newbie
  • *
  • Posts: 36
  • Karma: +0/-0


               Setting variables on the module does work fine, but remember that if it isn't a single player module, it'll have some side-effects: People unrelated to the quest will get their variables triggered, even if they hadn't gotten that far in the quest. Usually, setting the variable to the player or to every player in the party of the player would give the intended benefits for a more stable and adaptable module.
               
               

               
            

Legacy_simomate

  • Full Member
  • ***
  • Posts: 162
  • Karma: +0/-0


               didn't work... :s
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0


               Guess you did something wrong '<img'>



FP!
               
               

               
            

Legacy_simomate

  • Full Member
  • ***
  • Posts: 162
  • Karma: +0/-0


               Nevermind it's working now.
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0


               Great to read that. Now you have the foundation working and you can use the same example for future quests or conversation trees to become available. Building becomes easier to grasp once you start winning these little battles.

Have fun!

FP!
               
               

               


                     Modifié par Fester Pot, 21 septembre 2010 - 07:32 .
                     
                  


            

Legacy_tmanfoo

  • Full Member
  • ***
  • Posts: 129
  • Karma: +0/-0


               You can directly access the local variables set by AddJournalQuestEntry(), or from conversations with this.



nQuestState = GetLocalInt(oPC,"NW_JOURNAL_ENTRYQuest" + szPlotID);





I do not remember if you can directly set a journal entry with a similar SetLocalInt()