Author Topic: Saving quest status on a PW  (Read 548 times)

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
Saving quest status on a PW
« on: October 16, 2011, 03:28:02 am »


               So after 2 years, my mod is finally ready for beta testing.

Or so I thought.

It turns out my quests don't save. '<img'>

I  had first applied the variables to a plot item the PC carried. And this worked, only, it would update the variable for every single PC because every PC had the same item.

So I  changed it to apply the variable to the PC  itself. This kept every PC from receiving the new variables, but as I  thought would happen, the variable information doesn't save when the server resets.

I  had borrowed a script from the mod I  used to play on that uses SetCampaignString.
  SetCampaignString("PBA", "LastSafePoint", "SafePointPirgalos", oPC);
This would save a location variable so that the PC  could log in from the last town they visited.
I just now tried replacing SetLocalInt with SetCampaignString, but honestly, I  don't really know how to use SetCampaignString.

How can I  get variables to save for PC's and not have them apply to all PC's?
And how can I  echo the information within SetCampaignString inside the game so that I  can see if what I  am doing is working?

As soon as I can get the quests to save I'll be able to begin Beta Testing ':wizard:'

Thanks
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Saving quest status on a PW
« Reply #1 on: October 16, 2011, 04:07:24 am »


               

Zeidae wrote...
I  had first applied the variables to a plot item the PC carried. And this worked, only, it would update the variable for every single PC because every PC had the same item.

it is impossiable for two PC to be carrying an item with the same ID.  Now the items may be identical but they are not the same item.  


So I  changed it to apply the variable to the PC  itself. This kept every PC from receiving the new variables, but as I  thought would happen, the variable information doesn't save when the server resets.

correct locals on a PC do not get saved with the PC.

I  had borrowed a script from the mod I  used to play on that uses SetCampaignString.
  SetCampaignString("PBA", "LastSafePoint", "SafePointPirgalos", oPC);
This would save a location variable so that the PC  could log in from the last town they visited.
I just now tried replacing SetLocalInt with SetCampaignString, but honestly, I  don't really know how to use SetCampaignString.

using campaign vars is an option.   It will however get a litle more complex then useing a DB item.  the base bioware system did a poor job of making sure that PC's had unique ID's


How can I  get variables to save for PC's and not have them apply to all PC's?
And how can I  echo the information within SetCampaignString inside the game so that I  can see if what I  am doing is working?

Go back to the first system you had, save the locals on an item the pc is carrying.   Find your bug so it works right.  Without posted code I dout anybody can tell you what you are doing wrong.  A shot in the dark however is that you where using something like GetObjectByTag  to find the item.  instead of something like  GetItemPossessedBy
 but that is only a guess without seeing code.
               
               

               
            

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
Saving quest status on a PW
« Reply #2 on: October 16, 2011, 04:25:53 am »


               The item that I was using was the server rules.

   object oVariables = GetItemPossessedBy(oPC,"serverrules");
SetLocalInt(oVariables, sQuest, 100);

That is not unique to each individual PC.
               
               

               


                     Modifié par Zeidae, 16 octobre 2011 - 03:48 .
                     
                  


            

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
Saving quest status on a PW
« Reply #3 on: October 16, 2011, 04:58:50 am »


               Ok it seems I was able to get the campaignstring to work. I was fooling myself in my test because I had not updated quest check for, ugh, ZERO '<img'> So it kept appearing that the quest was not updating.

I still would prefer to set the variable on to an item because that is much easier for me to work with than campaignstring.

Here's a couple of my scripts with campaignstring

int StartingConditional()
{
   object oPC = GetPCSpeaker();
   string sQuest  = GetLocalString(OBJECT_SELF, "Quest");
  string nString = (GetCampaignString("MnM", sQuest, oPC));
   int iString = StringToInt(nString);

   if ( iString == 0 )
       {
   SendMessageToPC(oPC, "your sQuest name is " + sQuest);
   SendMessageToPC(oPC, "Your sQuest variable is " + GetCampaignString("MnM", sQuest, oPC));
   SendMessageToPC(oPC, "TRUE nstring is " + nString);
       return TRUE;
       }
   SendMessageToPC(oPC, "your quest name is " + sQuest);
   SendMessageToPC(oPC, "Your quest variable is " + GetCampaignString("MnM", sQuest, oPC));
   SendMessageToPC(oPC, "FALSE nstring is " + nString);

       return FALSE;
}

void main()
{
   object oPC        = GetPCSpeaker();
   string sQuest     = GetLocalString(OBJECT_SELF, "Quest");
   SetCampaignString("MnM", sQuest, "100", oPC);
   string sQuestCheck = GetCampaignString("MnM", sQuest, oPC);

   SendMessageToPC(oPC, "your sQuest name is " + sQuest);
   SendMessageToPC(oPC, "Your sQuest variable is " + GetCampaignString("MnM", sQuest, oPC));
   SendMessageToPC(oPC, "sQuestCheck is " + sQuestCheck );
}