1. Using First Name as a variable name, is insecure. What happens if you are playing, doing a quest, and ur character is called Bob, and If I join your server, and decide to call my Character 'Bob' - My character would have access, and the ability to override/overwrite variables relating to your character.
- An Alternative to using FirstName, is using 'PlayerName' - no two players will have identical player names.
2. Your description of what you are trying to do, differs from what your code is doing.
You say you are going to use the Players Name as part of the variable, but in actual fact, this code seems to be using the NPC's tag as part of the variable. Further more - the variable is stored on the player, not the NPC.
3. There is no easy way of making a singlular unified script that handles All types of conversations, unless you start getting into CustomTokens and lots of complicated LocalVars.
This code might be close to what you need.
It involves 3 conditional scripts, and 3 void main action scripts.
int StartingConditional() //Starting Conditional if the player has said NO
{
object oPC = GetPCSpeaker();
object oNPC = OBJECT_SELF;
string sName = GetPCPlayerName(oPC);
if(GetLocalInt(oNPC, "No_"+"sName")){
return TRUE;
}
return FALSE;
}
int StartingConditional() //Starting Conditional if the player has said YES
{
object oPC = GetPCSpeaker();
object oNPC = OBJECT_SELF;
string sName = GetPCPlayerName(oPC);
if(GetLocalInt(oNPC, "Yes_"+"sName")){
return TRUE;
}
return FALSE;
}
int StartingConditional() //Starting Conditional if the player has Met the NPC
{
object oPC = GetPCSpeaker();
object oNPC = OBJECT_SELF;
string sName = GetPCPlayerName(oPC);
if(GetLocalInt(oNPC, "HasMet_"+"sName")){
return TRUE;
}
return FALSE;
}
void main() //Player Meets the NPC
{
object oPC = GetPCSpeaker();
object oNPC = GetLastSpeaker();
string sName = GetPCPlayerName(oPC);
SetLocalInt(oNPC,"HasMet_"+sName,1); //Player has now met the npc - put this in the Actions Taken for the introduction sequence of the conversation
}
void main() //Player Says NO to the NPC
{
object oPC = GetPCSpeaker();
object oNPC = GetLastSpeaker();
string sName = GetPCPlayerName(oPC);
SetLocalInt(oNPC,"No_"+sName,1); //Player has now said NO to the npc, put this in the Actions Taken for the NO Conversation item.
}
void main() //Player Says Yes to the NPC
{
object oPC = GetPCSpeaker();
object oNPC = GetLastSpeaker();
string sName = GetPCPlayerName(oPC);
SetLocalInt(oNPC,"Yes_"+sName,1); //Player has now said Yes to the npc, put this in the Actions Taken for the Yes Conversation item.
}