Author Topic: Shame on me.....  (Read 476 times)

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Shame on me.....
« on: October 12, 2015, 02:58:45 pm »


               

Okay I got some trouble with something that is supposedly a very easy script.....basically what I want it to do is this:


 


PC talks to NPC and gets an item he needs to deliver.


 


chat is closed.


 


upon speaking with NPC again the NPC will check if character has the tag of the item and tells pc to get going!


 


I know I should feel ashamed but cannot seem to get it to work :S


 


so would appreciate some help...



               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Shame on me.....
« Reply #1 on: October 12, 2015, 03:45:43 pm »


               

Use the built-in script wizard under the conversation.


Create your conversation line you want the NPC to speak when the player has the item.


 


On that line when highlighted / selected, click the little red wizard hat under the TEXT APPEARS WHEN tab.


 


In the box that opens, check Item in Inventory. Click Next.


 


Enter in the TAG of the item, click Add. Click Next.


Save the script.


 


Now you have a conditional script that checks to make sure the player has a specific item in their inventory, and if they do, the conversation line will be fired by the NPC.


It's just that easy!


FP!



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Shame on me.....
« Reply #2 on: October 12, 2015, 04:24:57 pm »


               


Use the built-in script wizard under the conversation.


Create your conversation line you want the NPC to speak when the player has the item.


 


On that line when highlighted / selected, click the little red wizard hat under the TEXT APPEARS WHEN tab.


 


In the box that opens, check Item in Inventory. Click Next.


 


Enter in the TAG of the item, click Add. Click Next.


Save the script.


 


Now you have a conditional script that checks to make sure the player has a specific item in their inventory, and if they do, the conversation line will be fired by the NPC.


It's just that easy!


FP!




I actually did all that and that is not working.....


               
               

               
            

Legacy_Li'l Rose

  • Jr. Member
  • **
  • Posts: 52
  • Karma: +0/-0
Shame on me.....
« Reply #3 on: October 12, 2015, 04:29:31 pm »


               Make sure that the line of the conversation that checks for the tag of the item, is above the line that gives the item. Also remember that when you give an item to the PC, the res ref is used, but for a check, the tag is used. These may be different.
               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Shame on me.....
« Reply #4 on: October 12, 2015, 04:39:52 pm »


               


Make sure that the line of the conversation that checks for the tag of the item, is above the line that gives the item. Also remember that when you give an item to the PC, the res ref is used, but for a check, the tag is used. These may be different.




I Know that, just do not have it above the given item since it will be a DIFFERENT conversation line.....


               
               

               
            

Legacy_Claiming Light

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
Shame on me.....
« Reply #5 on: October 12, 2015, 10:25:20 pm »


               

You may have more luck with a plot flag. It's actually a cleaner solution anyway.


 


Consider this:


 


• The NPC gives your player "PLOT_ITEM".


• Player drops item.


• NPC checks for item on player and sees he doesn't have it.


• NPC acts as though he never gave PC the item.


 


Within the script wizard, on the part of the conversation that the item is granted, there should be an option to create a variable. Name the variable something like "HasTalkedTo" and set it to 1.


 


Next, you'll need a separate dialogue branch, starting as the very first option in your dialogue tree. Within the script wizard, there should be a conditionals tab. Go in and set the conditional to "HasTalkedTo" = 1. And type in for the dialogue your 'Get going' stuff.


 


Now the NPC will see things like this:


 


• Player talks to NPC.


• NPC checks "HasTalkedTo"


• Does "HasTalkedTo" == 1?


• If yes, say "Get Going!" and end dialogue.


• If no, skip that line.


• On the next line, since there is no conditional, NPC will know that is his default conversation. So he'll start offering the quest.



               
               

               
            

Legacy_MidsummerKnight

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Shame on me.....
« Reply #6 on: October 13, 2015, 12:03:02 am »


               
Put the following script on the Text Appears When...  I use the same script in many places throughout the module so I store the tag of the item on the quest speaker in the variable "questtag". You could delete than line and just set sQuestItem = "tag to look for" directly in the script.

 

#include "nw_i0_tool"

 

int StartingConditional()

{

    string sQuestItem = GetLocalString(OBJECT_SELF, "questtag");

 

    // Make sure the PC speaker has these items in their inventory

    if(!HasItem(GetPCSpeaker(), sQuestItem))

        return FALSE;

 

    return TRUE;

}


               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Shame on me.....
« Reply #7 on: October 13, 2015, 10:14:57 am »


               

Using a journal is key.


 


In the most general non-linear case, it might be possible for the player to find the item before the quest is given, so the quest giver needs three conditionals, based on the quest state:


 


1. Please find the macguffin (journal = 0, set to 1)


2. Have you found the macguffin? (journal = 1)


3. We have no further business (journal = 2, or unconditional).


 


Both case 1 and case 2 should allow the PC to reply "here is the macguffin" when GetIsItemPossessedByParty is true.


 


To prevent an exploit, the NPC line following "here is the macguffin" should repeat the check, then, if still true, remove the item (identified by the same function call) and set the journal to 2. This should be followed by an unconditional NPC line "but you don't have the macguffin!"


 


This is to prevent an exploit whereby the PC has the item, therefore get the option to hand it in, but, before clicking that option, drops the macguffin on the ground. In this example, the PC can't obtain duplicate rewards, because journal is now 2, but it's good to be consistent. Occasionally, the macguffin might be useful or valuable, so you don't want the PC to keep it by cheating. In other cases, such as payment, you might not have a journal entry, but you want to be sure that the PC still has the money when the transaction is completed.



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Shame on me.....
« Reply #8 on: October 13, 2015, 03:53:22 pm »


               


Using a journal is key.


 


In the most general non-linear case, it might be possible for the player to find the item before the quest is given, so the quest giver needs three conditionals, based on the quest state:


 


1. Please find the macguffin (journal = 0, set to 1)


2. Have you found the macguffin? (journal = 1)


3. We have no further business (journal = 2, or unconditional).


 


Both case 1 and case 2 should allow the PC to reply "here is the macguffin" when GetIsItemPossessedByParty is true.


 


To prevent an exploit, the NPC line following "here is the macguffin" should repeat the check, then, if still true, remove the item (identified by the same function call) and set the journal to 2. This should be followed by an unconditional NPC line "but you don't have the macguffin!"


 


This is to prevent an exploit whereby the PC has the item, therefore get the option to hand it in, but, before clicking that option, drops the macguffin on the ground. In this example, the PC can't obtain duplicate rewards, because journal is now 2, but it's good to be consistent. Occasionally, the macguffin might be useful or valuable, so you don't want the PC to keep it by cheating. In other cases, such as payment, you might not have a journal entry, but you want to be sure that the PC still has the money when the transaction is completed.




it is not supposed to be a qquest so using journals (even if you say they are key) doesn't really work....


               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Shame on me.....
« Reply #9 on: October 13, 2015, 09:41:39 pm »


               


I actually did all that and that is not working.....





That sucks. '<img'> It works for me.


FP!


               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Shame on me.....
« Reply #10 on: October 13, 2015, 10:31:47 pm »


               

it is not supposed to be a qquest so using journals (even if you say they are key) doesn't really work....




If you don't want to update the journal, a local integer on the PC will do. Same logic.