Author Topic: Any advice for building multi-module campaigns?  (Read 703 times)

Legacy_Mr. Versipellis

  • Full Member
  • ***
  • Posts: 236
  • Karma: +0/-0
Any advice for building multi-module campaigns?
« on: May 19, 2012, 08:07:48 pm »


                Hey there. I'm trying to build a campaign at the moment, and I'm splitting it up into about five modules to keep things manageable. However, there are some things that I want to keep consistant between modules, such as henchmen, inventory and certain variables. Could anyone with past experience explain how to do this? Is there a way to create a database through NWScript? Any advice is appreciated; thanks in advance.
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Any advice for building multi-module campaigns?
« Reply #1 on: May 22, 2012, 12:11:25 am »


               Sure, just give the Database a Unique Name, which is used by code in all modules...

I tend to build my databases by name, that way I can access info across multiple modules.

For instance, for the Persistent Storage I Just named the database...
"GEN_STORAGE"
For the Gold Bank I simply name it "GEN_GP_BANK"

Etc etc...

If you use the Player's CD Key (make sure you check for online/offline mode) for the variable name, then it's stored for all characters with that CD Key (just use OBJECT_INVALID for the object in the last part of the function to store info to the database)

If you use oPC as the object, then only that PC can access the information stored in the database.

Example...

SetCampaignInt("GEN_XP_BANK", sCDKEY, nXP, OBJECT_INVALID);

For Module Specific Database Storage..

SetCampaignInt(GetName(GetModule()), sVarName, nInt, oPC); // oPC is used because only info on THIS character is used, instead of any character the PC uses...

Very simple really...
               
               

               


                     Modifié par _Guile, 21 mai 2012 - 11:13 .
                     
                  


            

Legacy_Mr. Versipellis

  • Full Member
  • ***
  • Posts: 236
  • Karma: +0/-0
Any advice for building multi-module campaigns?
« Reply #2 on: May 24, 2012, 11:54:07 am »


               Ah, thanks for this. I've never done this before, so could you run me through the basic idea of creating and storing a database?
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Any advice for building multi-module campaigns?
« Reply #3 on: May 24, 2012, 05:25:45 pm »


               There are many ways to store data in NWN.

One thing that I like to do is to store PC focused data directly on the PC's skin. To learn more about this look at the script include "x3_inc_skin" and its associated functions.
http://palmergames.c...3_inc_skin.html
               
               

               
            

Legacy_AndarianTD

  • Hero Member
  • *****
  • Posts: 725
  • Karma: +0/-0
Any advice for building multi-module campaigns?
« Reply #4 on: May 25, 2012, 12:17:53 am »


               I do this using the campaign database. If you want to see a working example, check out my first module, and look over the script "sa_start_chap2" to see how data is saved for transfer to the next chapter. Then look in my second module at the script "sa2_start_ch2" to see how that data is retrieved from the database.

One thing I did find and was never able to get around, though, was that henchmen transferred through the database seemed to have their faction permanently contaminated in some way. They were fine when they were hired into the party right away at the beginning, but if they were ever removed from it they immediately became hostile. Perhaps there's a simple solution to this that I just didn't know about, but I ended up re-creating them from fresh blueprints in each new module (after script-transferring items to their new selves).

henesua wrote...

There are many ways to store data in NWN.

One thing that I like to do is to store PC focused data directly on the PC's skin. To learn more about this look at the script include "x3_inc_skin" and its associated functions.
http://palmergames.c...3_inc_skin.html


That sounds intriguing. I'll have to check that out. '<img'>
               
               

               
            

Legacy_Mr. Versipellis

  • Full Member
  • ***
  • Posts: 236
  • Karma: +0/-0
Any advice for building multi-module campaigns?
« Reply #5 on: June 11, 2012, 04:02:28 pm »


               

AndarianTD wrote...

I do this using the campaign database. If you want to see a working example, check out my first module, and look over the script "sa_start_chap2" to see how data is saved for transfer to the next chapter. Then look in my second module at the script "sa2_start_ch2" to see how that data is retrieved from the database.

One thing I did find and was never able to get around, though, was that henchmen transferred through the database seemed to have their faction permanently contaminated in some way. They were fine when they were hired into the party right away at the beginning, but if they were ever removed from it they immediately became hostile. Perhaps there's a simple solution to this that I just didn't know about, but I ended up re-creating them from fresh blueprints in each new module (after script-transferring items to their new selves).

henesua wrote...

There are many ways to store data in NWN.

One thing that I like to do is to store PC focused data directly on the PC's skin. To learn more about this look at the script include "x3_inc_skin" and its associated functions.
http://palmergames.c...3_inc_skin.html


That sounds intriguing. I'll have to check that out. '<img'>

Is there definitely no workaround? That's kind of a problem if the player gets to choose how the henchman levels up.
               
               

               
            

Legacy_UnrealJedi

  • Full Member
  • ***
  • Posts: 226
  • Karma: +0/-0
Any advice for building multi-module campaigns?
« Reply #6 on: December 29, 2012, 02:54:14 am »


               I am intrigued with the idea of storing variables on the PC's skin. I just read the NWN Lexicon link henesua provided. I want to make sure I correctly understand how to do this. First, I have to include x3_inc_skin in all of my scripts that store the variables, correct? Second, I use the SetSkinInt function to store the variable and then GetSkinInt to retrieve the variable, correct? Thirdly, if the PC does not have a skin item on their creature skin slot one will be created and the PC will be forced to equip it, correct? Side note: I don't recall seeing a skin slot in PC inventory but I could be wrong. Finally, will variables stored this way carry from module to module? In other words, if I use a script that automatically saves the PC character before ending the module or moving the PC to the next module will the variables go with the saved/transferred PC?

Thanks all!
               
               

               
            

Legacy_Melkior_King

  • Full Member
  • ***
  • Posts: 234
  • Karma: +0/-0
Any advice for building multi-module campaigns?
« Reply #7 on: January 06, 2013, 08:21:43 am »


               As I understand it, the player skin is just a new item added in 1.69 which is saved in a new inventory slot on the player.  In this way, the skin item and any variables on it are saved with the player, just like any other item possessed by the PC.

You can create your own player skin and manage it yourself.  The x3_inc_skin routines simply make it easier by providing you with pre-made scripts for handling skins.

I've never tried to transfer henchmen via a database.  I can only guess that the problem with henchies turning hostile is because they're based on a blueprint which is hostile by default and saving to a database automatically reverts a blueprint to its base faction.

I'd guess that the solution would be to create your own henchmen blueprints, not based on any existing blueprints (since that would cause the same problem), and make sure their faction is "defender" or something else non-hostile by default.

I hope that this info is useful.