Author Topic: Changes from first SP module reflected in second SP module  (Read 733 times)

Legacy_UnrealJedi

  • Full Member
  • ***
  • Posts: 226
  • Karma: +0/-0
Changes from first SP module reflected in second SP module
« on: June 21, 2012, 08:34:39 pm »


               I have a dilemma and wanted to see how you all might have handled this same issue or would handle it.
 
My SP campaign will be split into several modules. I am almost done with my first one. Most of the story takes place in the PC’s hometown. The main quest sends the PC to a dungeon outside of the town. There is a side quest dungeon under the town itself that the PC may or may not find, depending on whether he/she has the patience to poke around, discover, puzzle out and follow the clues placed throughout the town.
 
This side quest dungeon will also be in the second module, as the PC begins branching out from their hometown (which will still be a base of operations). If the PC doesn’t discover this side quest dungeon in the first module there will be even more direct clues in the second module pointing to it. Additionally, there is a part of the side quest dungeon that is inaccessible by the PC via a locked door. The key to the door will be located in the second module. I’d prefer not to move the key to the first module; it makes more sense for story purposes to leave it where it is at.
 
So the issue is this: How can I have the actions of the PC in the first module be reflected in the second module? My main concern is the containers in the side quest dungeon that will have randomly generated treasure. It doesn’t make sense for the PC to take the treasure, leaving the containers empty only to have them miraculously have treasure again if the PC visits this side quest dungeon in the second module (or future modules).
 
Thoughts?
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Changes from first SP module reflected in second SP module
« Reply #1 on: June 23, 2012, 02:57:07 pm »


               Store a variable on the PC when they initiate this quest in the first module.

When they reach the end of the module, store this variable to the database.

When you load up the second module, read the variable from the database and do what is required.

This is how I handled quest transitions from one module to another. At the end of each module, quest information is stored in the database and I read it upon loading the next in the series.

If a player goes to replay the first module, the entire database is cleaned, starting with a clean slate. If a player goes to replay the second module, only those variables are cleaned, and so forth. It's important to store a variable too at the very end of the module when the player is about to move forward, so you know they actually completed the module. That's how I notified a player when they went to replay the module from the beginning. A conversation checks the database for the module completed variable, then fires a warning letting them know any choices they made during the adventure will be lost if they replay.

FP!
               
               

               
            

Legacy_Mr. Versipellis

  • Full Member
  • ***
  • Posts: 236
  • Karma: +0/-0
Changes from first SP module reflected in second SP module
« Reply #2 on: June 23, 2012, 03:41:50 pm »


               

Fester Pot wrote...

Store a variable on the PC when they initiate this quest in the first module.

When they reach the end of the module, store this variable to the database.

When you load up the second module, read the variable from the database and do what is required.

This is how I handled quest transitions from one module to another. At the end of each module, quest information is stored in the database and I read it upon loading the next in the series.

If a player goes to replay the first module, the entire database is cleaned, starting with a clean slate. If a player goes to replay the second module, only those variables are cleaned, and so forth. It's important to store a variable too at the very end of the module when the player is about to move forward, so you know they actually completed the module. That's how I notified a player when they went to replay the module from the beginning. A conversation checks the database for the module completed variable, then fires a warning letting them know any choices they made during the adventure will be lost if they replay.

FP!

Hey Fester, the way you did that in Almraiven seemed to work pretty much perfectly for me. Could you guide use through the steps you used to store a variable on the PC and to write it to the database? I'd like to use a similar system for questing and henchmen relationships.
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Changes from first SP module reflected in second SP module
« Reply #3 on: June 25, 2012, 04:57:42 am »


               Basically, I would set a variable for completed quests using GetModule() first, or any other choices the player made I found worth keeping along from one module to the next.

At the end of the module, I wrote a script to check the values of those variables stored using GetModule() and if they were a number I expected, such as a quest being completed, or what companion the player decided to bring along with them, I then stored that variable into the Campaign Database.

At the start of the next module, I use a script to read the Campaign Database and pull in all related information and restore it using GetModule(), so the values are carried over into the continuing module.

Almraiven snip at the very end of the module.

void main()
{
   // Store selection player made on how they leave the city of Almraiven
   SetCampaignInt("Almraiven", "fpfom", 1); // Arrive via Forest of Mir
   SetCampaignInt("Almraiven", "syrttaway", 0); // Arrive via the Blood Runner
   SetCampaignInt("Almraiven", "misttaway", 0); // Arrive via The Mist

   // Player completed Almraiven
   SetCampaignInt("Almraiven", "almraiven", 1);

   // Important actions player did, including killing important NPCs and quest completion

  // Player let Ullip die instead of saving NPC
     if (GetLocalInt(GetModule(), "ulipkilled") == 1)
     {
     SetCampaignInt("Almraiven", "ulipkilled", 1);
     }

  // Player had Falis Goodmane as a companion but he turned on the player and player killed NPC
  if (GetLocalInt(GetModule(), "faliskilled") == 1)
  {
  SetCampaignInt("Almraiven", "faliskilled", 1);
  }

  // Player killed Lilly Lynn
  if (GetLocalInt(GetModule(), "lillykilled") == 1)
  {
  SetCampaignInt("Almraiven", "lillykilled", 1);
  }

  // Player saved three ghosts on Horseshoe Lane and returned them to the Land of the Dead
  if (GetLocalInt(GetModule(), "demonqdone") == 1)
  {
  SetCampaignInt("Almraiven", "demonqdone", 1);
  }

  // Player released a member of The Hidden back to the Land of the Dead
  if (GetLocalInt(GetModule(), "murderquest") == 100)
  {
 SetCampaignInt("Almraiven", "arbasaved", 1);
  }

  // Player killed Chelles on Cutback Kat Alley
  if (GetLocalInt(GetModule(), "chelleskilled") == 1)
  {
  SetCampaignInt("Almraiven", "chelleskilled", 1);
  }

  // Player was ambushed on Horseshoe Lane and killed thief guild members
  if (GetLocalInt(GetModule(), "hlambushkilled") == 1)
  {
  SetCampaignInt("Almraiven", "hlambushkilled", 1);
  }

  // Player murdered Lady Tolas in her sleep
  if (GetLocalInt(GetModule(), "tolaskilled") == 1)
  {
  SetCampaignInt("Almraiven", "tolaskilled", 1);
  }

   // Player returned Magnus Magicus spirit back to the Land of the Dead?
  if (GetLocalInt(GetModule(), "magnuskilled") == 1)
  {
  SetCampaignInt("Almraiven", "magnuskilled", 1);
  }

  // Was the Auren contact Luanu killed by rival mage guilds?
     if (GetLocalInt(GetModule(), "luanukilled") == 1)
  {
  SetCampaignInt("Almraiven", "luanukilled", 1);
  }

  // Did player kill the Werefolk Captain in the sewers?
     if (GetLocalInt(GetModule(), "wereratkilled") == 1)
  {
  SetCampaignInt("Almraiven", "wereratkilled", 1);
  }

  // Who did player pick for their laboratory assistant?
   if (GetLocalInt(GetModule(), "assist1") == 100)
{

   SetCampaignInt("Almraiven", "assist1", 100);
   SetCampaignInt("Almraiven", "assist2", 0);
   SetCampaignInt("Almraiven", "assist3", 0);

   }

   if (GetLocalInt(GetModule(), "assist2") == 100)
{

   SetCampaignInt("Almraiven", "assist2", 100);
   SetCampaignInt("Almraiven", "assist1", 0);
   SetCampaignInt("Almraiven", "assist3", 0);

   }

   if (GetLocalInt(GetModule(), "assist3") == 100)
{

   SetCampaignInt("Almraiven", "assist1", 0);
   SetCampaignInt("Almraiven", "assist2", 0);
   SetCampaignInt("Almraiven", "assist3", 100);

   }

  // What companion did the player decide on bringing along to next module?

  if (GetLocalInt(GetFirstPC(), "annexcomp") == 1)
{

  SetCampaignInt("Almraiven", "annexcomp", 1);
  SetCampaignInt("Almraiven", "faliscomp", 0);
  SetCampaignInt("Almraiven", "shaylacomp", 0);

  }

  if (GetLocalInt(GetFirstPC(), "faliscomp") == 1)
{

  SetCampaignInt("Almraiven", "faliscomp", 1);
  SetCampaignInt("Almraiven", "annexcomp", 0);
  SetCampaignInt("Almraiven", "shaylacomp", 0);

  }

  if (GetLocalInt(GetFirstPC(), "shaylacomp") == 1)
{

  SetCampaignInt("Almraiven", "shaylacomp", 1);
  SetCampaignInt("Almraiven", "faliscomp", 0);
  SetCampaignInt("Almraiven", "annexcomp", 0);

    }
}



At the start of Shadewood, I read the database values and if they matched, were pulled in and the module events setup for the player, as well as fixed anything noteable.


#include "nw_i0_plot"
void main()
{
// SETTING UP PLAYER FOR FOREST OF MIR

object oTarget = GetWaypointByTag("START_CITYGATE");
location lTarget = GetLocation(oTarget);

object oTarget1 = GetWaypointByTag("START_CITYHARBOR");
location lTarget1 = GetLocation(oTarget1);

object oTarget2 = GetWaypointByTag("START_CITYMIST");
location lTarget2 = GetLocation(oTarget2);


object oTarget3 = GetWaypointByTag("NO_DATABASE");
location lTarget3 = GetLocation(oTarget3);

// CLEANING UP SHADEWOOD DATABASE FILE VARIABLES
SetCampaignInt("Almraiven", "annexgekilled", 0); // ANNEX KILLED AS SPIRIT IN ATTIC
SetCampaignInt("Almraiven", "annexgkilled", 0);  // ANNEX KILLED AS SPIRIT
SetCampaignInt("Almraiven", "falisgekilled", 0); // FALIS KILLED AS SPIRIT IN ATTIC
SetCampaignInt("Almraiven", "falisgkilled", 0);  // FALIS KILLED AS SPIRIT
SetCampaignInt("Almraiven", "shaygekilled", 0);  // SHAY KILLED AS SPIRIT IN ATTIC
SetCampaignInt("Almraiven", "shaykilled", 0);    // SHAY KILLED AS SPIRIT
SetCampaignInt("Almraiven", "veslhdone", 0);     // VELSHAROON QUEST COMPLETED
SetCampaignInt("Almraiven", "faltainkilled", 0); // FALTAIN KILLED IN SWAMP
SetCampaignInt("Almraiven", "mythalkilled", 0);  // MET SPIRIT IN MYTH UNNOHYR
SetCampaignInt("Almraiven", "shadewood", 0);     // COMPLETED MODULE
SetCampaignInt("Almraiven", "katkilled", 0);     // KAT KILLED (TYNER'S SISTER)
SetCampaignInt("Almraiven", "atalikilled", 0);   // KAT & TYNER'S FATHER
SetCampaignInt("Almraiven", "colirkilled", 0);   // COLIR LOOMSTALK KILLED
SetCampaignInt("Almraiven", "slingkilled", 0);   // MARABA SLINGTOSS KILLED
SetCampaignInt("Almraiven", "zoekilled", 0);     // ZOETIA KILLED
SetCampaignInt("Almraiven", "razormkilled", 0);  // RAZORMAUL KILLED
SetCampaignInt("Almraiven", "tynerkilled", 0);   // TYNER KILLED (KAT'S BROTHER)
// CLEANING UP SHADEWOOD DATABASE FILE VARIABLES

// CHECK TO SEE IF PLAYER COMPLETED ALMRAIVEN

if (GetCampaignInt("Almraiven", "almraiven") == 0)
{
if (GetAreaFromLocation(lTarget3)==OBJECT_INVALID) return;

oTarget3=GetFirstFactionMember(GetFirstPC(), FALSE);

while (GetIsObjectValid(oTarget3))
   {
   AssignCommand(oTarget3, ClearAllActions());

   AssignCommand(oTarget3, ActionJumpToLocation(lTarget3));
   oTarget3=GetNextFactionMember(GetFirstPC(), FALSE);
   }

return;
}

// END GAME


//START_VARIABLE FOR MODULE...

SetLocalInt(GetFirstPC(), "gamestart", 1);



// CHECK TO SEE IF PLAYER HAS POTION BOOK WILL NEED IT!

if ( !HasItem( GetFirstPC(), "brewpotions"))

{
// SPAWN AUREN POTION BOOK ON PLAYER INCASE PLAYER SOLD IT
// OR LEFT IT BEHIND IN ALMRAIVEN

CreateItemOnObject("brewpotions", GetFirstPC());
}

// CHECK TO SEE IF PLAYER BROUGHT ARIES JOURNAL
if ( !HasItem( GetFirstPC(), "LeatherBoundBook"))

{

CreateItemOnObject("leatherboundbook", GetFirstPC());
}

// CHECK TO SEE IF PLAYER BROUGHT ARIES LETTER
if ( !HasItem( GetFirstPC(), "ariesnote"))

{

CreateItemOnObject("ariesnote", GetFirstPC());
}

// CHECK TO SEE IF PLAYER HAS SPELL BOOK, IF SO REPLACE IT WITH MODIFIED ONE
// IF THEY DID NOT BRING IT, WE CREATE IT.
if ( HasItem( GetFirstPC(), "Spellbook"))

{
object oItemToTake = GetItemPossessedBy(GetFirstPC(), "Spellbook");
if(GetIsObjectValid(oItemToTake) != 0)
DestroyObject(oItemToTake);
CreateItemOnObject("spellbook002", GetFirstPC());

}
else
{
CreateItemOnObject("spellbook002", GetFirstPC());
}

// CHECK TO SEE IF PLAYER HAS NAMING QUILL BECAUSE THEY WON'T NEED IT

if ( HasItem( GetFirstPC(), "NamingQuill"))

{

object oItemToTake = GetItemPossessedBy(GetFirstPC(), "NamingQuill");
    if(GetIsObjectValid(oItemToTake) != 0)
        DestroyObject(oItemToTake);
}

// CHECK TO SEE IF PLAYER HAS BAD SORCERERS FRIEND AMULET FROM ALMRAIVEN
// QUICK BUG FIX...
if ( HasItem( GetFirstPC(), "SorcerersFriend"))

{

object oItemToTake = GetItemPossessedBy(GetFirstPC(), "SorcerersFriend");
    if(GetIsObjectValid(oItemToTake) != 0)
        DestroyObject(oItemToTake);
// NOW LET'S SPAWN THE RIGHT ONE
CreateItemOnObject("sorcerersfrien", GetFirstPC());
}

// CHECK TO SEE IF PLAYER BROUGHT LABORATORY ASSISTANT BONES OR NOT

if ( HasItem( GetFirstPC(), "bonesofawoman"))

{
object oBadBones = GetItemPossessedBy(GetFirstPC(), "bonesofawoman");
DestroyObject(oBadBones);
// GIVE PROPER BONES DUE TO BUG IN ALMRAIVEN THAT WAS NOT RESOLVED!
CreateItemOnObject("bonesofoldman", GetFirstPC());
//FloatingTextStringOnCreature("DEBUG: bonesofoldman", GetFirstPC());
SetLocalInt(GetFirstPC(), "labbones", 1);
}

if ( HasItem( GetFirstPC(), "bonesofoldman"))

{
//FloatingTextStringOnCreature("DEBUG: bonesofoldman", GetFirstPC());
SetLocalInt(GetFirstPC(), "labbones", 1);
}

if ( HasItem( GetFirstPC(), "bonesoflady"))

{
//FloatingTextStringOnCreature("DEBUG: bonesoflady", GetFirstPC());
SetLocalInt(GetFirstPC(), "labbones", 1);
}


// SET UP LABORATORY ASSISTANT

if (GetCampaignInt("Almraiven", "assist1") == 100)
{

SetLocalInt(GetModule(), "assist1", 100);
//FloatingTextStringOnCreature("DEBUG: assist1 = 100", GetFirstPC());
}

if (GetCampaignInt("Almraiven", "assist2") == 100)
{
//FloatingTextStringOnCreature("DEBUG: assist2 = 100", GetFirstPC());
SetLocalInt(GetModule(), "assist2", 100);

}

if (GetCampaignInt("Almraiven", "assist3") == 100)
{
//FloatingTextStringOnCreature("DEBUG: assist3 = 100", GetFirstPC());
SetLocalInt(GetModule(), "assist3", 100);

}

// SO HOW DID THE PLAYER ARRIVE TO THIS MODULE?

// THE MIST...
if (GetCampaignInt("Almraiven", "misttaway") == 1)
{

SetLocalInt(GetModule(), "misttaway", 1);

if (GetAreaFromLocation(lTarget2)==OBJECT_INVALID) return;

oTarget2=GetFirstFactionMember(GetFirstPC(), FALSE);

while (GetIsObjectValid(oTarget2))
   {
   AssignCommand(oTarget2, ClearAllActions());

   AssignCommand(oTarget2, ActionJumpToLocation(lTarget2));
   oTarget2=GetNextFactionMember(GetFirstPC(), FALSE);
   }

}

// THE BLOOD RUNNER...
if (GetCampaignInt("Almraiven", "syrttaway") == 1)
{


SetLocalInt(GetModule(), "syrttaway", 1);

if (GetAreaFromLocation(lTarget1)==OBJECT_INVALID) return;

oTarget1=GetFirstFactionMember(GetFirstPC(), FALSE);

while (GetIsObjectValid(oTarget1))
   {
   AssignCommand(oTarget1, ClearAllActions());

   AssignCommand(oTarget1, ActionJumpToLocation(lTarget1));
   oTarget1=GetNextFactionMember(GetFirstPC(), FALSE);
   }

}

// THE WILDERNESS...
if (GetCampaignInt("Almraiven", "fpfom") == 1)
{

SetLocalInt(GetModule(), "fpfom", 1);

if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;

oTarget=GetFirstFactionMember(GetFirstPC(), FALSE);

while (GetIsObjectValid(oTarget))
   {
   AssignCommand(oTarget, ClearAllActions());

   AssignCommand(oTarget, ActionJumpToLocation(lTarget));
   oTarget=GetNextFactionMember(GetFirstPC(), FALSE);
   }


}

// END

}



All deaths of companions and NPCs through Almraiven and Shadewood are tracked, since the third module in the series takes place in the Land of the Dead and spirits don't easily forget how they were killed and who it was that killed them.


FP!
               
               

               


                     Modifié par Fester Pot, 25 juin 2012 - 04:05 .
                     
                  


            

Legacy_Mr. Versipellis

  • Full Member
  • ***
  • Posts: 236
  • Karma: +0/-0
Changes from first SP module reflected in second SP module
« Reply #4 on: June 26, 2012, 12:01:24 pm »


               

Fester Pot wrote...

Basically, I would set a variable for completed quests using GetModule() first, or any other choices the player made I found worth keeping along from one module to the next.

At the end of the module, I wrote a script to check the values of those variables stored using GetModule() and if they were a number I expected, such as a quest being completed, or what companion the player decided to bring along with them, I then stored that variable into the Campaign Database.

At the start of the next module, I use a script to read the Campaign Database and pull in all related information and restore it using GetModule(), so the values are carried over into the continuing module.

Almraiven snip at the very end of the module.

void main()
{
   // Store selection player made on how they leave the city of Almraiven
   SetCampaignInt("Almraiven", "fpfom", 1); // Arrive via Forest of Mir
   SetCampaignInt("Almraiven", "syrttaway", 0); // Arrive via the Blood Runner
   SetCampaignInt("Almraiven", "misttaway", 0); // Arrive via The Mist

   // Player completed Almraiven
   SetCampaignInt("Almraiven", "almraiven", 1);

   // Important actions player did, including killing important NPCs and quest completion

  // Player let Ullip die instead of saving NPC
     if (GetLocalInt(GetModule(), "ulipkilled") == 1)
     {
     SetCampaignInt("Almraiven", "ulipkilled", 1);
     }

  // Player had Falis Goodmane as a companion but he turned on the player and player killed NPC
  if (GetLocalInt(GetModule(), "faliskilled") == 1)
  {
  SetCampaignInt("Almraiven", "faliskilled", 1);
  }

  // Player killed Lilly Lynn
  if (GetLocalInt(GetModule(), "lillykilled") == 1)
  {
  SetCampaignInt("Almraiven", "lillykilled", 1);
  }

  // Player saved three ghosts on Horseshoe Lane and returned them to the Land of the Dead
  if (GetLocalInt(GetModule(), "demonqdone") == 1)
  {
  SetCampaignInt("Almraiven", "demonqdone", 1);
  }

  // Player released a member of The Hidden back to the Land of the Dead
  if (GetLocalInt(GetModule(), "murderquest") == 100)
  {
 SetCampaignInt("Almraiven", "arbasaved", 1);
  }

  // Player killed Chelles on Cutback Kat Alley
  if (GetLocalInt(GetModule(), "chelleskilled") == 1)
  {
  SetCampaignInt("Almraiven", "chelleskilled", 1);
  }

  // Player was ambushed on Horseshoe Lane and killed thief guild members
  if (GetLocalInt(GetModule(), "hlambushkilled") == 1)
  {
  SetCampaignInt("Almraiven", "hlambushkilled", 1);
  }

  // Player murdered Lady Tolas in her sleep
  if (GetLocalInt(GetModule(), "tolaskilled") == 1)
  {
  SetCampaignInt("Almraiven", "tolaskilled", 1);
  }

   // Player returned Magnus Magicus spirit back to the Land of the Dead?
  if (GetLocalInt(GetModule(), "magnuskilled") == 1)
  {
  SetCampaignInt("Almraiven", "magnuskilled", 1);
  }

  // Was the Auren contact Luanu killed by rival mage guilds?
     if (GetLocalInt(GetModule(), "luanukilled") == 1)
  {
  SetCampaignInt("Almraiven", "luanukilled", 1);
  }

  // Did player kill the Werefolk Captain in the sewers?
     if (GetLocalInt(GetModule(), "wereratkilled") == 1)
  {
  SetCampaignInt("Almraiven", "wereratkilled", 1);
  }

  // Who did player pick for their laboratory assistant?
   if (GetLocalInt(GetModule(), "assist1") == 100)
{

   SetCampaignInt("Almraiven", "assist1", 100);
   SetCampaignInt("Almraiven", "assist2", 0);
   SetCampaignInt("Almraiven", "assist3", 0);

   }

   if (GetLocalInt(GetModule(), "assist2") == 100)
{

   SetCampaignInt("Almraiven", "assist2", 100);
   SetCampaignInt("Almraiven", "assist1", 0);
   SetCampaignInt("Almraiven", "assist3", 0);

   }

   if (GetLocalInt(GetModule(), "assist3") == 100)
{

   SetCampaignInt("Almraiven", "assist1", 0);
   SetCampaignInt("Almraiven", "assist2", 0);
   SetCampaignInt("Almraiven", "assist3", 100);

   }

  // What companion did the player decide on bringing along to next module?

  if (GetLocalInt(GetFirstPC(), "annexcomp") == 1)
{

  SetCampaignInt("Almraiven", "annexcomp", 1);
  SetCampaignInt("Almraiven", "faliscomp", 0);
  SetCampaignInt("Almraiven", "shaylacomp", 0);

  }

  if (GetLocalInt(GetFirstPC(), "faliscomp") == 1)
{

  SetCampaignInt("Almraiven", "faliscomp", 1);
  SetCampaignInt("Almraiven", "annexcomp", 0);
  SetCampaignInt("Almraiven", "shaylacomp", 0);

  }

  if (GetLocalInt(GetFirstPC(), "shaylacomp") == 1)
{

  SetCampaignInt("Almraiven", "shaylacomp", 1);
  SetCampaignInt("Almraiven", "faliscomp", 0);
  SetCampaignInt("Almraiven", "annexcomp", 0);

    }
}



At the start of Shadewood, I read the database values and if they matched, were pulled in and the module events setup for the player, as well as fixed anything noteable.


#include "nw_i0_plot"
void main()
{
// SETTING UP PLAYER FOR FOREST OF MIR

object oTarget = GetWaypointByTag("START_CITYGATE");
location lTarget = GetLocation(oTarget);

object oTarget1 = GetWaypointByTag("START_CITYHARBOR");
location lTarget1 = GetLocation(oTarget1);

object oTarget2 = GetWaypointByTag("START_CITYMIST");
location lTarget2 = GetLocation(oTarget2);


object oTarget3 = GetWaypointByTag("NO_DATABASE");
location lTarget3 = GetLocation(oTarget3);

// CLEANING UP SHADEWOOD DATABASE FILE VARIABLES
SetCampaignInt("Almraiven", "annexgekilled", 0); // ANNEX KILLED AS SPIRIT IN ATTIC
SetCampaignInt("Almraiven", "annexgkilled", 0);  // ANNEX KILLED AS SPIRIT
SetCampaignInt("Almraiven", "falisgekilled", 0); // FALIS KILLED AS SPIRIT IN ATTIC
SetCampaignInt("Almraiven", "falisgkilled", 0);  // FALIS KILLED AS SPIRIT
SetCampaignInt("Almraiven", "shaygekilled", 0);  // SHAY KILLED AS SPIRIT IN ATTIC
SetCampaignInt("Almraiven", "shaykilled", 0);    // SHAY KILLED AS SPIRIT
SetCampaignInt("Almraiven", "veslhdone", 0);     // VELSHAROON QUEST COMPLETED
SetCampaignInt("Almraiven", "faltainkilled", 0); // FALTAIN KILLED IN SWAMP
SetCampaignInt("Almraiven", "mythalkilled", 0);  // MET SPIRIT IN MYTH UNNOHYR
SetCampaignInt("Almraiven", "shadewood", 0);     // COMPLETED MODULE
SetCampaignInt("Almraiven", "katkilled", 0);     // KAT KILLED (TYNER'S SISTER)
SetCampaignInt("Almraiven", "atalikilled", 0);   // KAT & TYNER'S FATHER
SetCampaignInt("Almraiven", "colirkilled", 0);   // COLIR LOOMSTALK KILLED
SetCampaignInt("Almraiven", "slingkilled", 0);   // MARABA SLINGTOSS KILLED
SetCampaignInt("Almraiven", "zoekilled", 0);     // ZOETIA KILLED
SetCampaignInt("Almraiven", "razormkilled", 0);  // RAZORMAUL KILLED
SetCampaignInt("Almraiven", "tynerkilled", 0);   // TYNER KILLED (KAT'S BROTHER)
// CLEANING UP SHADEWOOD DATABASE FILE VARIABLES

// CHECK TO SEE IF PLAYER COMPLETED ALMRAIVEN

if (GetCampaignInt("Almraiven", "almraiven") == 0)
{
if (GetAreaFromLocation(lTarget3)==OBJECT_INVALID) return;

oTarget3=GetFirstFactionMember(GetFirstPC(), FALSE);

while (GetIsObjectValid(oTarget3))
   {
   AssignCommand(oTarget3, ClearAllActions());

   AssignCommand(oTarget3, ActionJumpToLocation(lTarget3));
   oTarget3=GetNextFactionMember(GetFirstPC(), FALSE);
   }

return;
}

// END GAME


//START_VARIABLE FOR MODULE...

SetLocalInt(GetFirstPC(), "gamestart", 1);



// CHECK TO SEE IF PLAYER HAS POTION BOOK WILL NEED IT!

if ( !HasItem( GetFirstPC(), "brewpotions"))

{
// SPAWN AUREN POTION BOOK ON PLAYER INCASE PLAYER SOLD IT
// OR LEFT IT BEHIND IN ALMRAIVEN

CreateItemOnObject("brewpotions", GetFirstPC());
}

// CHECK TO SEE IF PLAYER BROUGHT ARIES JOURNAL
if ( !HasItem( GetFirstPC(), "LeatherBoundBook"))

{

CreateItemOnObject("leatherboundbook", GetFirstPC());
}

// CHECK TO SEE IF PLAYER BROUGHT ARIES LETTER
if ( !HasItem( GetFirstPC(), "ariesnote"))

{

CreateItemOnObject("ariesnote", GetFirstPC());
}

// CHECK TO SEE IF PLAYER HAS SPELL BOOK, IF SO REPLACE IT WITH MODIFIED ONE
// IF THEY DID NOT BRING IT, WE CREATE IT.
if ( HasItem( GetFirstPC(), "Spellbook"))

{
object oItemToTake = GetItemPossessedBy(GetFirstPC(), "Spellbook");
if(GetIsObjectValid(oItemToTake) != 0)
DestroyObject(oItemToTake);
CreateItemOnObject("spellbook002", GetFirstPC());

}
else
{
CreateItemOnObject("spellbook002", GetFirstPC());
}

// CHECK TO SEE IF PLAYER HAS NAMING QUILL BECAUSE THEY WON'T NEED IT

if ( HasItem( GetFirstPC(), "NamingQuill"))

{

object oItemToTake = GetItemPossessedBy(GetFirstPC(), "NamingQuill");
    if(GetIsObjectValid(oItemToTake) != 0)
        DestroyObject(oItemToTake);
}

// CHECK TO SEE IF PLAYER HAS BAD SORCERERS FRIEND AMULET FROM ALMRAIVEN
// QUICK BUG FIX...
if ( HasItem( GetFirstPC(), "SorcerersFriend"))

{

object oItemToTake = GetItemPossessedBy(GetFirstPC(), "SorcerersFriend");
    if(GetIsObjectValid(oItemToTake) != 0)
        DestroyObject(oItemToTake);
// NOW LET'S SPAWN THE RIGHT ONE
CreateItemOnObject("sorcerersfrien", GetFirstPC());
}

// CHECK TO SEE IF PLAYER BROUGHT LABORATORY ASSISTANT BONES OR NOT

if ( HasItem( GetFirstPC(), "bonesofawoman"))

{
object oBadBones = GetItemPossessedBy(GetFirstPC(), "bonesofawoman");
DestroyObject(oBadBones);
// GIVE PROPER BONES DUE TO BUG IN ALMRAIVEN THAT WAS NOT RESOLVED!
CreateItemOnObject("bonesofoldman", GetFirstPC());
//FloatingTextStringOnCreature("DEBUG: bonesofoldman", GetFirstPC());
SetLocalInt(GetFirstPC(), "labbones", 1);
}

if ( HasItem( GetFirstPC(), "bonesofoldman"))

{
//FloatingTextStringOnCreature("DEBUG: bonesofoldman", GetFirstPC());
SetLocalInt(GetFirstPC(), "labbones", 1);
}

if ( HasItem( GetFirstPC(), "bonesoflady"))

{
//FloatingTextStringOnCreature("DEBUG: bonesoflady", GetFirstPC());
SetLocalInt(GetFirstPC(), "labbones", 1);
}


// SET UP LABORATORY ASSISTANT

if (GetCampaignInt("Almraiven", "assist1") == 100)
{

SetLocalInt(GetModule(), "assist1", 100);
//FloatingTextStringOnCreature("DEBUG: assist1 = 100", GetFirstPC());
}

if (GetCampaignInt("Almraiven", "assist2") == 100)
{
//FloatingTextStringOnCreature("DEBUG: assist2 = 100", GetFirstPC());
SetLocalInt(GetModule(), "assist2", 100);

}

if (GetCampaignInt("Almraiven", "assist3") == 100)
{
//FloatingTextStringOnCreature("DEBUG: assist3 = 100", GetFirstPC());
SetLocalInt(GetModule(), "assist3", 100);

}

// SO HOW DID THE PLAYER ARRIVE TO THIS MODULE?

// THE MIST...
if (GetCampaignInt("Almraiven", "misttaway") == 1)
{

SetLocalInt(GetModule(), "misttaway", 1);

if (GetAreaFromLocation(lTarget2)==OBJECT_INVALID) return;

oTarget2=GetFirstFactionMember(GetFirstPC(), FALSE);

while (GetIsObjectValid(oTarget2))
   {
   AssignCommand(oTarget2, ClearAllActions());

   AssignCommand(oTarget2, ActionJumpToLocation(lTarget2));
   oTarget2=GetNextFactionMember(GetFirstPC(), FALSE);
   }

}

// THE BLOOD RUNNER...
if (GetCampaignInt("Almraiven", "syrttaway") == 1)
{


SetLocalInt(GetModule(), "syrttaway", 1);

if (GetAreaFromLocation(lTarget1)==OBJECT_INVALID) return;

oTarget1=GetFirstFactionMember(GetFirstPC(), FALSE);

while (GetIsObjectValid(oTarget1))
   {
   AssignCommand(oTarget1, ClearAllActions());

   AssignCommand(oTarget1, ActionJumpToLocation(lTarget1));
   oTarget1=GetNextFactionMember(GetFirstPC(), FALSE);
   }

}

// THE WILDERNESS...
if (GetCampaignInt("Almraiven", "fpfom") == 1)
{

SetLocalInt(GetModule(), "fpfom", 1);

if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;

oTarget=GetFirstFactionMember(GetFirstPC(), FALSE);

while (GetIsObjectValid(oTarget))
   {
   AssignCommand(oTarget, ClearAllActions());

   AssignCommand(oTarget, ActionJumpToLocation(lTarget));
   oTarget=GetNextFactionMember(GetFirstPC(), FALSE);
   }


}

// END

}



All deaths of companions and NPCs through Almraiven and Shadewood are tracked, since the third module in the series takes place in the Land of the Dead and spirits don't easily forget how they were killed and who it was that killed them.


FP!

Thanks so much, Fester - you're really making me want to go and re-play the series, now! Just one question: what do you think would be the best way of saving the status of your henchmen between modules? There won't be many recurring NPCs to track, but I would like to keep the levels and equipment of henchmen consistent throughout. Is this possible, or should I just urge the player to strip their followers before changing module?
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Changes from first SP module reflected in second SP module
« Reply #5 on: August 18, 2012, 04:57:20 pm »


               Hey Mr. Versipellis!

I suggest you simply dump the inventory into the database, then read the database and pull it back. For Shadewood, I did not need to do this because the player did not have access to their inventory in Almraiven. So all I had to do was track which companion they were bringing along and simply create them at the desired level when the new module began.

There was tons of information on how to store and save companions to bring them from one module to another on the old legacy forum, but with that gone, there's little to reference. I'm sure there is a henchmen tutorial on the Vault that does cover how to save and load henchmen from one module to the next.

And ... I can't find it. I know it's made by Huntsman but searching for his name on the Vault comes up empty.

EDIT: Found it!

Instructions are in Huntsman2.htm within the .zip file.

FP!
               
               

               


                     Modifié par Fester Pot, 18 août 2012 - 04:05 .
                     
                  


            

Legacy_Mr. Versipellis

  • Full Member
  • ***
  • Posts: 236
  • Karma: +0/-0
Changes from first SP module reflected in second SP module
« Reply #6 on: August 21, 2012, 04:36:25 pm »


               Is there anything you DON'T know, Fester? Thanks for the link, although the scripts don't seem to be working as stated.
               
               

               


                     Modifié par Mr. Versipellis, 21 août 2012 - 04:12 .
                     
                  


            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Changes from first SP module reflected in second SP module
« Reply #7 on: August 21, 2012, 05:14:22 pm »


               Yes it will, so your players will not lose anything from one module to another if they've placed items in your companions inventory.

FP!
               
               

               
            

Legacy_Mr. Versipellis

  • Full Member
  • ***
  • Posts: 236
  • Karma: +0/-0
Changes from first SP module reflected in second SP module
« Reply #8 on: August 21, 2012, 11:28:08 pm »


               Hm, that much is working, but it will only ever bring the first companion over, even when I copy over the scripts ad-verbatim. Do you know what's wrong with them?
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Changes from first SP module reflected in second SP module
« Reply #9 on: August 22, 2012, 01:17:14 am »


               There's more work to be done if you're carrying over multiple companions.

If you look at around line 1096 of the x0_i0_henchman include file you will see a section of code that looks like this.

void StoreCampaignHenchman(object oPC)
{
object oHench = GetHenchman(oPC, 1);
if (!GetIsObjectValid(oHench)) {
DBG_msg("No valid henchman to store");
return;
}
DBG_msg("Storing henchman: " + GetTag(oHench));
int ret = StoreCampaignDBObject(oPC, sStoredHenchmanVarname, oHench);
if (!ret) {
DBG_msg("Error attempting to store henchman");
} else {
DBG_msg("Henchman stored successfully");
}
}
// Call this function when a PC enters a sequel module to restore
// the henchman (complete with inventory). The function
// StoreCampaignHenchman must have been called first, and both
// modules must use the same campaign db. (See notes in x0_i0_campaign.)
//
// The restored henchman will automatically be re-hired and will be
// created next to the PC.
//
// Any object in the module with the same tag as the henchman will be
// destroyed (to remove duplicates).
void RetrieveCampaignHenchman(object oPC)
{
location lLoc = GetLocation(oPC);
object oHench = RetrieveCampaignDBObject(oPC, sStoredHenchmanVarname, lLoc);
// Delete the henchman object from the db
DelayCommand(0.5, DeleteCampaignDBVariable(oPC, sStoredHenchmanVarname));
if (GetIsObjectValid(oHench)) {
DelayCommand(0.5, HireHenchman(oPC, oHench));
object oHenchDupe = GetNearestObjectByTag(GetTag(oHench),
oHench);
if (GetIsObjectValid(oHenchDupe) && oHenchDupe != oHench) {
DestroyObject(oHenchDupe);
}
} else
{ DBG_msg("No valid henchman retrieved");
}


The max henchman allowed in a module is at line 75 of the x0_i0_henchman file, which is "int X2_NUMBER_HENCHMEN = 2;" just change the number 2 to whatever amount of henchmen you want to allow. So if your module will be letting PC use 5 henchmen the line should be int X2_NUMBER_HENCHMEN = 5;

const int X2_NUMBER_HENCHMEN = 2; // This won't be the same as the GetMaxHenchmen() function due to followers


You need to replace that section of code posted above, with the below code. This will then make it work for whatever your maxhenchman setting is.

void StoreCampaignHenchman(object oPC)
{
object oHench;
int iSlot, iMax = GetMaxHenchmen();
for (iSlot = 1; iSlot <= iMax; iSlot++)
{
oHench = GetHenchman(oPC, iSlot);
if (!GetIsObjectValid(oHench))
DBG_msg("No valid henchman to store");
else if (StoreCampaignDBObject(oPC, "Henchman" + IntToString(iSlot), oHench))
DBG_msg("Henchman " + GetName(oHench) + " stored successfully");
else
DBG_msg("Error attempting to store henchman " + GetName(oHench));
}
}
// Call this function when a PC enters a sequel module to restore
// the henchman (complete with inventory). The function
// StoreCampaignHenchman must have been called first, and both
// modules must use the same campaign db. (See notes in x0_i0_campaign.)
//
// The restored henchman will automatically be re-hired and will be
// created next to the PC.
//
// Any object in the module with the same tag as the henchman will be
// destroyed (to remove duplicates).
void RetrieveCampaignHenchman(object oPC)
{
location lLoc = GetLocation(oPC);
object oHench, oDupe;
int iSlot, iMax = GetMaxHenchmen();
string sHench;
for (iSlot = 1; iSlot <= iMax; iSlot++)
{
sHench = "Henchman" + IntToString(iSlot);
oHench = RetrieveCampaignDBObject(oPC, sHench, lLoc);
DelayCommand(0.5, DeleteCampaignDBVariable(oPC, sHench));
if (GetIsObjectValid(oHench))
{
DelayCommand(0.5, HireHenchman(oPC, oHench));
oDupe = GetNearestObjectByTag(GetTag(oHench), oHench);
if (oDupe != OBJECT_INVALID) DestroyObject(oDupe);
}
else
DBG_msg("No valid henchman retrieved");
}
}


FP!
               
               

               
            

Legacy_Mr. Versipellis

  • Full Member
  • ***
  • Posts: 236
  • Karma: +0/-0
Changes from first SP module reflected in second SP module
« Reply #10 on: August 23, 2012, 11:36:42 pm »


               I already did that - those scripts are copied straight from his guide. I can't see why this wouldn't work, but it just doesn't. Any clue why?
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Changes from first SP module reflected in second SP module
« Reply #11 on: August 26, 2012, 02:07:45 am »


               

Mr. Versipellis wrote...

I already did that - those scripts are copied straight from his guide. I can't see why this wouldn't work, but it just doesn't. Any clue why?


I'm afraid I don't know.

FP!
               
               

               
            

Legacy_Mr. Versipellis

  • Full Member
  • ***
  • Posts: 236
  • Karma: +0/-0
Changes from first SP module reflected in second SP module
« Reply #12 on: August 26, 2012, 08:52:14 pm »


               Ah, well. Thanks anyway!