Author Topic: How to export extra object with a PC character  (Read 805 times)

Legacy_wolfzhu

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
How to export extra object with a PC character
« on: October 17, 2013, 04:17:01 am »


                Hi,

I'm wondering if it's possible to export some objects (such as a big quantity of items beyond the character can take in his / her backpack). Anyone have some ideas?
               
               

               
            

Legacy_CalSailX

  • Jr. Member
  • **
  • Posts: 93
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #1 on: October 21, 2013, 05:45:30 pm »


               If it's your own module going to another of your own modules you could hook into the henchmen export/import functions. They have their limitations, but that's how I've planned on getting  hench/love interest from the first of my modules into the next and preserve the level up choices among other things that make the investment in having them for company worth while.

Going that route not for pack rats, but because the relationships in the party should be reflect those that the last module ended with.

Anyway.. not sure how helpful you'll find my reply, but yea depending on circumstances it's possible to do what you ask if both modules hook into the functions.
               
               

               
            

Legacy_wolfzhu

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #2 on: October 23, 2013, 02:52:45 am »


               Thanks CalSailX. However what I want is to export more items with my PC character. Don't know if SetLocalObject to the skin works, anyway I'll try it.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #3 on: October 23, 2013, 08:47:48 pm »


               Please be more specific about what you are trying to achieve.

It is possible to export game objects to a database. But this is a very different thing than setting a local object.
               
               

               


                     Modifié par henesua, 23 octobre 2013 - 07:48 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #4 on: October 23, 2013, 10:55:37 pm »


               I think he basically wants to take more inventory pages with him. Long story short, you can't, unless you're taking it to another module that shares the same campaign database/database. Like henesua says, we need to know more specifically what you're attempting to do - going between different OC modules?

Funky
               
               

               
            

Legacy_wolfzhu

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #5 on: October 24, 2013, 12:53:00 am »


               OK, in short, I want to create a tower for a single player wizard, and make all items in this tower going with him when the player exports the character, that he'll see those items in the tower when he establishes a new game.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #6 on: October 24, 2013, 02:09:26 am »


               To answer the original question,   No you can not export extra items with a player.  

So without being able to do it that way,  It sounds like you are asking for something like persistent housing.
               
               

               
            

Legacy_wolfzhu

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #7 on: October 24, 2013, 02:46:22 am »


               Yes, I was asking for a kind of persistent housing. You are right. But I don't understand why it's impossible to export extra items with a player, in a dumb way, an item can be encoded with its all properties into a string and set as local string to the skin of the character. I just wonder if there is more efficient way to do it.
               
               

               


                     Modifié par wolfzhu, 24 octobre 2013 - 01:47 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #8 on: October 24, 2013, 02:52:50 am »


               Perhaps one way to do this is simply to create a module for yourself that uses a database linked with persistent storage.

When you finish a module, save your character. Then start a new game with that character in your tower module. Put your character's things in the persistent storage. Ensure that the persistent storage is saved to the database - this will depend on how you script this. Save your character. Then quit the module. You will not need to save the module.

Each time you complete a module you can do an inventory dump in your tower module. And when you want to start a new module, you can enter the tower, optimize your character's equipment, and save the character again.
               
               

               
            

Legacy_wolfzhu

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #9 on: October 24, 2013, 03:09:38 am »


               The tower is not only in a single module -- I saved it as a persistent object in the override folder, and created a corresponding spell to teleport in/out of it. So this tower is a persistent housing for the very character.

-- But not including the items in it -- each time I start a new module the items in the tower cannot be held. So something should be done to backup the items when I save the character, and restore them after a new module is open.
               
               

               


                     Modifié par wolfzhu, 24 octobre 2013 - 02:15 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #10 on: October 24, 2013, 12:49:58 pm »


               The key to what you want is the persistent stoage. You'll need to write scripts for that.
               
               

               
            

Legacy_HipMaestro

  • Hero Member
  • *****
  • Posts: 2849
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #11 on: October 24, 2013, 07:04:00 pm »


               Been following this topic for a few days as a novice scripter at best.

Question:  Can a familiar or companion be assigned an inventory?
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #12 on: October 24, 2013, 07:58:23 pm »


               Familiars and Companion's do have an inventory, but when they are unsummoned everything in it is destroyed.

So again the solution is to store the inventory in a database.
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #13 on: October 26, 2013, 01:40:33 am »


               This might be too techi for the topic: but a while ago- I did experiments with storing items to MySQL database via nwnx, then exporting them to the physical hdd of the server as individual items.
(MySQL provides methods for saving blob info to files)
Then I was able to call a MySQL command to load the file back into the database and then rematerialize it in game.
What this proves is that the items can be serialized to binary / byte array form.
Byte information can also be represented as text.
Depending on what encoding is used: some info might not make it through the translation from byte array to string.
However....
It might be possible to have the byte array values turned into their actual byte values as strings.

Eg: 0xfe 0xfd 0x1a. Etc could be
Fe|fd|1a

If the SetLocalString character length allows for it, you could in theory determine what an items byte information is represented as in textual form, then store it on the player in one or more local strings.
The player could in theory have a script read that information, store it to MySQL database, and then call RetrievePersistentObject from nwnx odbc to materialize the item information as an ingame item.
This would all depend on whether local strings can contain enough info.
If they can- or there is no limit: then yes: you could in theory store the information about each item as a local string : then deserialize that raw info into a usable object.


Not knowing how much data could be held in a local string: I can however say that each stored item would be at least 10kb in size or more.
10 kb is roughly 10,000 bytes. ( a single byte being something like FE or 1A etc)
So since each byte is a double character space length- you would need to hold roughly 20000 characters of info in a local string.
Of course--- the limit - if it exists could be avoided by spanning the info over multiple local strings.

Geek rant finished
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
How to export extra object with a PC character
« Reply #14 on: October 26, 2013, 01:41:32 am »


               Duplicate
               
               

               


                     Modifié par Baaleos, 26 octobre 2013 - 09:07 .