Author Topic: Any scripting method for transferring all inventory items to a remote container?  (Read 496 times)

Legacy_Furnaceden

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0


               Hello all,

Thanks for the very useful (and timely) posts. I am studying all this with great interest. Will be testing some of this out shortly.

For a prison situation, issues of losing some gold due to container limitations, would be less important than the necessity of removing equipped items. The loss of gold could be explained in the realm of logic, whereas a prisoner being jailed with a "Halberd of Acidic Destruction +4" or a "Wizard's Staff of Fireballs" -- not so much.

I assume Bags of Holding pose no special problems for this. They (and their contents) move in and out of containers easily enough.
               
               

               


                     Modifié par Furnaceden, 21 février 2014 - 08:50 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0


               Furnaceden, I'm glad to have been part of the help.

As far as how to solve your problem goes, I recommend that you create a special script for handling the jailing of the PC. The confiscation of belongings portion of this script could call two functions:

Function 1: would unequip everything on the PC
Function 2: would move everything in the PCs inventory to where ever you want it kept. Function 2 is the one we've been working on.

Alternatively instead of using those two functions, you could probably use Proleric1's function. I believe it does everything you have asked for in the confiscation department.
               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0


               My testing is showing that CopyItem() does not copy modified descriptions. It does copy the name and variables correctly.  So you do need to do that SetDescription(oCopy, GetDescription(oItem)) even in the CopyItem path.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0


               nice catch, meaglyn.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0


               Crafting. I think CopyItem handles this already, but it's handy for Creates, in a situation where you have to go that way.

Funky
               
               

               


                     Modifié par FunkySwerve, 22 février 2014 - 03:32 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0


               

meaglyn wrote...

henesua wrote...
I forget why i did not copy objects with inventory.


I think it just doesn't work, at least if there is anything in it.


CopyItem does nothing for an object with inventory.  CopyObject copies the container and all its inventory, however I have heard of problems with identifiers on the container being placed on the inventory items, I don't remember if it was tags, resrefs, or something else; but the outcome was hardly desirable for trying to keep things intact.
               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0


               

WhiZard wrote...

CopyItem does nothing for an object with inventory.  CopyObject copies the container and all its inventory, however I have heard of problems with identifiers on the container being placed on the inventory items, I don't remember if it was tags, resrefs, or something else; but the outcome was hardly desirable for trying to keep things intact.


For one thing CopyObject does not copy variables so if you use variables on your items (which I do) you lose all of that using CopyObject.
               
               

               
            

Legacy_Furnaceden

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0


               Thanks again, everyone.

I will be piecing things together and testing it all out. Also, thanks for the heads-up about copying modified descriptions. That is of course an important factor.

I'm still watching this thread so if any other advice comes to mind, please post. I will update with any useful findings in the not-too-distant future after I take this for a test run.