View previous topic :: View next topic |
Author |
Message |
Tsais
Joined: 18 Sep 2017 Posts: 6
|
Posted: Thu Oct 12, 2017 21:47 Post subject: |
|
|
Terra_777 wrote: | Can only store creatures and or items. 'x2_medium_Chest3' looks like a peaceable. |
I'm confused. I thought the whole point of these functions was that they could save a placeable and its inventory?
virusman wrote: | with them you can store the entire placeable with its inventory and properties, without using OnDisturbed and handling every item individually. |
|
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Fri Oct 13, 2017 20:06 Post subject: |
|
|
StoreCampaignObject (SCO) and RetriveCampaignObject (RCO) which are hooked into and re-directed to the database only works with item objects and creature objects.
You can store the inventory of a placeable but if you want to store the complete placeable you need to store the resref of the placeable, create the placeable and then restore the inventory.
You can store an inventory of a creature, but be careful with that since those can get big and if they get too big it'll truncate data. _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
Tsais
Joined: 18 Sep 2017 Posts: 6
|
Posted: Sat Oct 14, 2017 0:35 Post subject: |
|
|
UPDATE: I was able to get virusman's functions working. My previous (failing) tests were with an older Win version of NWNX. Once I tried the same tests on a new Linux installation, it worked.
Terra_777 wrote: | if you want to store the complete placeable you need to store the resref of the placeable, create the placeable and then restore the inventory. |
Actually, you can store the complete placeable with virusman's additions to NWNX with only one line. I just did it.
Something like:
Code: | SQLSCOExec("UPDATE ax_psobjects SET area='"+GetTag(GetArea(oObject))+"', location='"+LocationToString(GetLocation(oObject))+"', object=%s WHERE id="+IntToString(nID), oObject); |
... will store an entire placeable and its contents in a single database row, using a single BLOB, and something like:
Code: | SQLRCOExec("SELECT object FROM ax_psobjects WHERE id="+IntToString(nID), lLoc, nType); |
... will retrieve the placeable and its contents.
These are great additions, virusman! Are they documented somewhere (else)? |
|
Back to top |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Tue Oct 24, 2017 1:17 Post subject: |
|
|
Yes, documentation could be better. These extensions are only available on Linux. _________________ In Soviet Russia, NWN plays you! |
|
Back to top |
|
|
|