Container Copy

Post » Thu Jun 21, 2012 1:29 pm

Is it possible to copy the contents of an actors inventory or a containers inventory to another container or actor so that both have the same stuff ?
User avatar
Amy Masters
 
Posts: 3277
Joined: Thu Jun 22, 2006 10:26 am

Post » Thu Jun 21, 2012 2:44 pm

You'll need SKSE for it, but...
...	Copypasta(Game.GetPlayer(), MQ101AlduinREF)...Function Copypasta(ObjectReference akSourceContainer = None, ObjectReference akDestContainer = None, Int aiIndex = 0, Form akForm = None)	aiIndex = akSourceContainer.GetNumItems()	While (aiIndex > 0)		aiIndex -= 1		akForm = akSourceContainer.GetNthForm(aiIndex)		akDestContainer.AddItem(akForm, akSourceContainer.GetItemCount(akForm))	EndWhileEndFunction
...will give copy the player's inventory to Alduin, for instance.
User avatar
Hannah Barnard
 
Posts: 3421
Joined: Fri Feb 09, 2007 9:42 am

Post » Thu Jun 21, 2012 8:50 am

Thanks Man... This does raise another Question? Can you check in the script if SKSE is installed and then based on that decide to run this part of the script ?
User avatar
Life long Observer
 
Posts: 3476
Joined: Fri Sep 08, 2006 7:07 pm

Post » Thu Jun 21, 2012 9:18 pm

Float fSKSEEvent SomeEvent()	fSKSE = SKSE.GetVersion() + SKSE.GetVersionMinor() * 0.01 + SKSE.GetVersionBeta() * 0.0001	If fSKSE >= 1.0504 ; Earliest version with GetNumItems/GetNthForm		Copypasta(Game.GetPlayer(), MQ101AlduinREF)	Else		; Alternate method	EndIfEndEvent
User avatar
Amanda savory
 
Posts: 3332
Joined: Mon Nov 27, 2006 10:37 am

Post » Thu Jun 21, 2012 8:51 pm

That errors on CK

Function Variable akform may not shadow a previously defined variable ?
User avatar
Pixie
 
Posts: 3430
Joined: Sat Oct 07, 2006 4:50 am

Post » Thu Jun 21, 2012 10:25 pm

I don't think I've ever come across that error before... Maybe it means that you already have a variable called "akForm" defined in your script (not in a local function).
User avatar
Elizabeth Davis
 
Posts: 3406
Joined: Sat Aug 18, 2007 10:30 am

Post » Thu Jun 21, 2012 9:17 am

Well Akform is only used in your code? I renamed it to akform1 and get the same error with akform1

Do I need to load skse some how when I load CK ? I know in the Oblivion days I did ...
User avatar
Manuela Ribeiro Pereira
 
Posts: 3423
Joined: Fri Nov 17, 2006 10:24 pm

Post » Thu Jun 21, 2012 6:51 pm

try changing this line
Form akForm = akSourceContainer.GetNthForm(aiIndex)
to this
akForm = akSourceContainer.GetNthForm(aiIndex)
User avatar
Nitol Ahmed
 
Posts: 3321
Joined: Thu May 03, 2007 7:35 am

Post » Thu Jun 21, 2012 8:20 am

Fixed as described above.
Function Copypasta(ObjectReference akSourceContainer = None, ObjectReference akDestContainer = None, Int aiIndex = 0, Form akForm = None)        aiIndex = akSourceContainer.GetNumItems()        While (aiIndex > 0)                aiIndex -= 1                akForm = akSourceContainer.GetNthForm(aiIndex)                akDestContainer.AddItem(akForm, akSourceContainer.GetItemCount(akForm))        EndWhileEndFunction
I'd changed it last minute, but forgot to remove 'Form' when making it an argument again.
User avatar
stephanie eastwood
 
Posts: 3526
Joined: Thu Jun 08, 2006 1:25 pm

Post » Thu Jun 21, 2012 9:36 pm

    fSKSE = SKSE.GetVersion() + SKSE.GetVersionMinor() * 0.01 + SKSE.GetVersionBeta() * 0.0001    If fSKSE >= 1.0504 ; Earliest version with GetNumItems/GetNthForm

That's both inefficient and if you don't have SKSE that will generate 3 errors that will slow down Papyrus when you only need one. Try
   If SKSE.GetVersionRelease() >= 21  ; Earliest version release with GetNumItems/GetNthForm

Which reminds me I need to bug the SKSE team into publishing those release numbers instead of the Major/Minor/Beta forms for Papyrus programmers because it's far more efficient to use.
User avatar
Charlotte X
 
Posts: 3318
Joined: Thu Dec 07, 2006 2:53 am

Post » Thu Jun 21, 2012 12:46 pm

That's both inefficient and if you don't have SKSE that will generate 3 errors that will slow down Papyrus when you only need one.
MoleHill != Mountain. 'fSKSE = SKSE.GetVersion() + SKSE.GetVersionMinor() * 0.01 + SKSE.GetVersionBeta() * 0.0001' takes approximately 0.041704 seconds. GetVersionRelease is a lot more abstract and doesn't allow it to be passed as an argument in a notification. Neither method need to be implemented more than *once per save anyhow given SKSE will not change versions in game, so three innocuous errors vs. one per save load in SKSE's absence is really no big deal. Major/Minor/Beta and GetVersionRelease needn't be mutually exclusive or have any hairs split over their efficiency provided the returned value is cached for subsequent SKSE checks when !bGetGameLoaded., IMO.

*If GetGameLoaded() or OnPlayerLoadGame()
User avatar
Matthew Barrows
 
Posts: 3388
Joined: Thu Jun 28, 2007 11:24 pm

Post » Thu Jun 21, 2012 8:52 pm

Ok maybe it is me but the new code gives me

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ZZSpecialPlayerPortal.psc(50,36): GetNumItems is not a function or does not exist
c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ZZSpecialPlayerPortal.psc(50,8): type mismatch while assigning to a int (cast missing or types unrelated)
c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ZZSpecialPlayerPortal.psc(53,43): GetNthForm is not a function or does not exist
User avatar
The Time Car
 
Posts: 3435
Joined: Sat Oct 27, 2007 7:13 pm

Post » Thu Jun 21, 2012 8:10 am

That probably means you don't have SKSE...
User avatar
Alycia Leann grace
 
Posts: 3539
Joined: Tue Jun 26, 2007 10:07 pm

Post » Thu Jun 21, 2012 2:19 pm

Ok Simple or silly or both Question How do I run SKSE with CK ? I can run it and have it launch the game but how do I get it to run with CK ?
User avatar
Kortniie Dumont
 
Posts: 3428
Joined: Wed Jan 10, 2007 7:50 pm

Post » Thu Jun 21, 2012 6:58 pm

All you have to do is install it. Unlike Oblivion, FO3, and FNV, you don't need to do anything special to access the commands with the CK or other script editor. If you still have problems, post the whole script.
User avatar
Georgine Lee
 
Posts: 3353
Joined: Wed Oct 04, 2006 11:50 am

Post » Thu Jun 21, 2012 6:36 pm

But you do have to install the pex and psc files that are in the SKSE archive. It has a Data folder with those which need to be copied into your Skyrim/Data folder for the CK and Papyrus compiler to know about the new functions.
User avatar
barbara belmonte
 
Posts: 3528
Joined: Fri Apr 06, 2007 6:12 pm

Post » Fri Jun 22, 2012 12:28 am

There are no Pex of Psc files files in the archive I downloaded just the Dll and exe and readme stuff ??
User avatar
Tyrel
 
Posts: 3304
Joined: Tue Oct 30, 2007 4:52 am

Post » Thu Jun 21, 2012 6:00 pm

You need a 1.5.4+ Beta version of SKSE or there won't be any Papyrus stuff included.
User avatar
Laura Elizabeth
 
Posts: 3454
Joined: Wed Oct 11, 2006 7:34 pm


Return to V - Skyrim