Script Help: Adding Items to player inventory from Objects

Post » Tue Dec 30, 2014 5:32 am

Script So Far:
Spoiler

Scriptname DovaKeepRemoveAllItems extends ObjectReference

ObjectReference[] Property AllMannequins Auto

ObjectReference[] Property AllShieldRacks Auto

ObjectReference[] Property AllWeaponRacks Auto

ObjectReference[] Property AllChests Auto

Function GetAllMannequinItems()
AllMannequins.RemoveAllItems( Game.GetPlayer(), true, true )
endFunction

Function GetAllWeaponRackItems()
AllShieldRacks.RemoveAllItems( Game.GetPlayer(), true, true )
endFunction

Function GetAllShieldRackItems()
AllWeaponRacks.RemoveAllItems( Game.GetPlayer(), true, true )
endFunction

Function GetAllChestItems()
AllChests.RemoveAllItems( Game.GetPlayer(), true, true )
endFunction

Event OnActivate(ObjectReference akActionRef)
GetAllShieldRackItems()
GetAllWeaponRackItems()
GetAllMannequinItems()
GetAllChestItems()
endEvent

I'm revisiting the idea of having a switch to remove items on Mannequins, Weapon Racks, Shield Racks, and Chests. The above script fails because RemoveAllItems is not part of the property somehow. Although http://www.creationkit.com/RemoveAllItems_-_ObjectReference it implies to me that I can use the property to specify the source from which to remove the items. The properties are http://i.imgur.com/U3BbvLl.jpg stored in a http://i.imgur.com/q588BoG.jpg.

I open to using quest aliases but I didn't start that way because I don't know what I am doing. Since I'm not using robots or immersion type concepts, if I can avoid using quest aliases I would prefer that. Also I rather like the idea of adding a reference to the Property by using the http://i.imgur.com/bJDVdj2.jpg button. I had hoped the ObjectReference array would just get parsed automatically by RemoveAllItems but the way I am doing it is wrong because the CK compiler fails. I want to keep this flexible so I can use it in other locations and mods. For example maybe I have living quarters with only 10 chests or I add it to another mod with only 30 Mannequins and 20 chests.


Starting 1 compile threads for 1 files...
Compiling "DovaKeepRemoveAllItems"...
C:\Games\steamapps\common\skyrim\Data\Scripts\Source\temp\DovaKeepRemoveAllItems.psc(12,16): RemoveAllItems is not a function or does not exist
C:\Games\steamapps\common\skyrim\Data\Scripts\Source\temp\DovaKeepRemoveAllItems.psc(16,17): RemoveAllItems is not a function or does not exist
C:\Games\steamapps\common\skyrim\Data\Scripts\Source\temp\DovaKeepRemoveAllItems.psc(20,17): RemoveAllItems is not a function or does not exist
C:\Games\steamapps\common\skyrim\Data\Scripts\Source\temp\DovaKeepRemoveAllItems.psc(24,12): RemoveAllItems is not a function or does not exist
No output generated for DovaKeepRemoveAllItems, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on DovaKeepRemoveAllItems
User avatar
Kerri Lee
 
Posts: 3404
Joined: Sun Feb 25, 2007 9:37 pm

Return to V - Skyrim