//My apologies to anyone who has tried to use my scripts I put on this thread
on page 30. I had altered the scripts before posting but I didn't test them.
//They appear not to be working. When you remove the underscore "_" in the
string "FirstConversation_", everything appears to work again. I have //reposted
my original post with the corrected scripts (I can't edit my original post).
//
//1. Script name: Generic Remember NPC Talked Before
//
//2. What it does: set and test a local int on the PC (the name of the int is
based on the tag of the NPC the PC talks to) to remember that the NPC has
//spoken his first line of dialogue (with greetings and introductions). These
scripts can be used for any conversation with any NPC. So it is not necessary
//to write scripts for every NPC.
//
//3. Notes: See comment in scripts for more information.
//I don't know if this has been done before, but I find that it will make your
life a lot easier when you have lots of NPCs and conversations.
//
//4. The scripts.
//
//conv_set (sets the int):
//::///////////////////////////////////////////////
//:: thadeus' Generic Remember NPC Talked Before
//:: CONV_SET
//:://////////////////////////////////////////////
/*
When an NPC meets you for the first time, he says a certain greeting and
introduction of himself. The next time the PC talks to him, he must
remember that he has spoken to the PC before. This can be done through a
SetLocalInt on the PC. The only problem is that you have to write a script
for every NPC.
This generic script can be used to set a local int on the PC to remember
that the PCs have talked to an NPC before. The name of the local int
is the string "FirstConversation" + the tag of the character talked to.
Every NPC can then set a local int on the PC using the same script.
You just have to put it in the Action Taken part of the first dialogue line
of the NPC (when he meets the PCs for the first time).
This script should be used in conjunction with conv_false and conv_true
which test the variable stored in "FirstConversation" + oName.
*/
//:://////////////////////////////////////////////
//:: Created By: thadeus
//:: Created On: Jul 20, 2002
//:://////////////////////////////////////////////
void main()
{
string oName = GetTag(OBJECT_SELF);
// The tag of the person the PCs talk with
string FirstConversation = "FirstConversation" + oName;
// The name of the variable in which the information is stored.
SetLocalInt(GetLastSpeaker(),FirstConversation,1);
// Setting the int to 1 (the PCs have spoken to the character).
}
conv_true (checks the int to see if it is true):
//::///////////////////////////////////////////////
//:: thadeus' Generic Remember NPC Talked Before Test True
//:: CONV_TRUE
//:://////////////////////////////////////////////
/*
This checks the local int set by conv_set for a certain NPC to see if it it
TRUE, so that the other dialogue line must be displayed. It should be placed
in the Text Appears When part of the appropriate line of dialogue.
*/
//:://////////////////////////////////////////////
//:: Created By: thadeus
//:: Created On: Jul 20, 2002
//:://////////////////////////////////////////////
int StartingConditional()
{
string oName = GetTag(OBJECT_SELF);
// The tag of the person the PCs talk with
string FirstConversation = "FirstConversation" + oName;
// The name of the variable in which the information is stored.
if (!(GetLocalInt(GetLastSpeaker(),FirstConversation) == 1))
return FALSE;
return TRUE;
}
conv_false (checks the int to see if it is false):
//::///////////////////////////////////////////////
//:: thadeus' Generic Remember NPC Talked Before Test False
//:: CONV_FALSE
//:://////////////////////////////////////////////
/*
This checks the local int set by conv_set for a certain NPC to see if it it
FALSE, so that the greeting and introductory speech must be displayed. It
should be placed in the Text Appears When part of the appropriate line of
dialogue.
*/
//:://////////////////////////////////////////////
//:: Created By: thadeus
//:: Created On: Jul 20, 2002
//:://////////////////////////////////////////////
int StartingConditional()
{
string oName = GetTag(OBJECT_SELF);
// The tag of the person the PCs talk with
string FirstConversation = "FirstConversation" + oName;
// The name of the variable in which the information is stored.
if (!(GetLocalInt(GetLastSpeaker(),FirstConversation) == 0))
return FALSE;
return TRUE;
}