Author Topic: Scripting Conversation with multiple quests.  (Read 308 times)

Legacy_AmbrosiaPW

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +0/-0
Scripting Conversation with multiple quests.
« on: April 21, 2011, 11:41:42 pm »


               Hello, I am an intermediate programmer new to NWN Scripting and this site. 

I am modifying an existing module "Ambrosia" made by UOAbigail. It's a great module. It uses a lot of scripting and I decided to do the same instead of using wizards. I figure it will work better with the existing world.

Right now I am working on adding the ability to give an NPC multiple delivery quests. You only see the next quest available. When you finish one, you can try the next quest in the list. I set a variable on the pc that is the
quest
number  they are on. 

I've come to the point where I'm ready to give the PC a quest in the conversation. Let's say the NPC has 2 quests and the PC is new.

How do I show the next available quest only? I figure I need a line in the conversation for each quest the npc has to offer, then I have to check if the PC is on that quest to show it.
  • NPC: Would you mind helping me?
  •   PC: Sure!
  • if Quest_ID_# == 1 "Please do quest 1"
  • else if Quest_ID_# == 2 "Please do quest 2"
I don't want to write a script for each quest line, do I?
  • is quest 1? return True; else return FALSE;
  • is quest2? return True; else return FALSE;
I'd like to be able to simply show the quest that is on the variable. Can you guys give me some ideas how to do this? Can I store conversations elsewhere, then refer to them dynamically? Does that make sense?

Any questions? Thank you for your help!
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Scripting Conversation with multiple quests.
« Reply #1 on: April 22, 2011, 02:41:05 am »


               If you have not already, You may want to read chapter 5 out of The Guide to Building Volume I – The Aurora Toolset Manual . It will answer most of your questions on how to set up a conversation.  


 

AmbrosiaPW wrote...
I'd like to be able to simply show the quest that is on the variable. Can you guys give me some ideas how to do this? Can I store conversations elsewhere, then refer to them dynamically? Does that make sense?



The Script on the Text appears when tab will fire before the line is shown.  So you can use it to set the information that is going to be displayed on that node useing a custom token.    Something like:

int StartingConditional()
{
  object oPC = GetPCSpeaker();
  int nQuestID = GetLocalInt(oPC,"Quest_ID_#");
  string sQuestText;

  if (nQuestID  == 1)     sQuestText = "Please do quest 1";
  else if (nQuestID == 2) sQuestText = "Please do quest 2";

 SetCustomToken(100,sQuestText);
 
return TRUE;


To display the text the custom token is set to just use it in your conversation node.

NPC: < CUSTOM100 >;

Function - SetCustomToken
               
               

               


                     Modifié par Lightfoot8, 22 avril 2011 - 01:41 .
                     
                  


            

Legacy_AmbrosiaPW

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +0/-0
Scripting Conversation with multiple quests.
« Reply #2 on: April 22, 2011, 02:49:46 am »


               SetCustomToken!!! Awesome thanks so much! I am looking forward to scripting this!
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Scripting Conversation with multiple quests.
« Reply #3 on: April 23, 2011, 06:24:08 pm »


               AmbrosiaPW  - One thing to remember is to look at your module resources that you currently have, there is a maximum # of resources a module can have, and you DO NOT want to exceed this number.  Any time you take on altering a module you need to be conscious of this, as I have seen many Server Modules go south after someone tinkered with it, adding more stuff / areas / mobs /etc, because they exceed the maximum resource limit...

I won't go into any names, but a PW that becomes buggy (scripts not firing / monsters do nothing) etc, is because the Server Module is too bloated, keep this in mind when building!

Just a tip..
               
               

               


                     Modifié par _Guile, 23 avril 2011 - 05:24 .