Scripting a container that only accepts certain items

Post » Sat Aug 16, 2014 11:23 am

Hello, I'm having trouble getting a script to work. I used the example for this type of script on the creation kit website, but when I test it in game, even the items that are on the form list I created get rejected by the container :/ So I can't actually put anything in it :S Here's what my script looks like:
Scriptname BrewerLidScript extends ObjectReference   Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)If akSourceContainer == PlayerREFIf !AcceptedItemFLST.HasForm(akBaseItem)RemoveItem(akBaseItem, aiItemCount, True, akSourceContainer)Debug.Trace("Invalid Item")EndIfEndifEndEventFormList Property AcceptedItemFLST  Auto   Actor Property PlayerRef  Auto  
If anyone can help me I'd really appreicate it, thanks!
User avatar
Amber Hubbard
 
Posts: 3537
Joined: Tue Dec 05, 2006 6:59 pm

Post » Sat Aug 16, 2014 11:22 am

Did you assign your property to the formlist correctly in the creation kit? I know the script defo works I use it a few times in HIS.

Edit

sp
User avatar
Jah Allen
 
Posts: 3444
Joined: Wed Jan 24, 2007 2:09 am

Post » Sat Aug 16, 2014 2:12 am

Um, I'm not sure :s I'm actually very new to scripting - this is only the second script I've ever done. How exactly do you do that? All I did was create a form list by dragging and dropping the items into it, and then I left it at that. I did't know there was more I had to do oops :S If you could help me out I'd be very grateful, thanks :)

User avatar
Nick Tyler
 
Posts: 3437
Joined: Thu Aug 30, 2007 8:57 am

Post » Sat Aug 16, 2014 2:28 am

I think you have also to re-add the items to the player too when you remove items from the container.

User avatar
Alba Casas
 
Posts: 3478
Joined: Tue Dec 12, 2006 2:31 pm

Post » Sat Aug 16, 2014 8:16 am

Did you fill the property with the Formlist?

and..

Scriptname BrewerLidScript extends ObjectReference   Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)If akSourceContainer == PlayerREF    If !AcceptedItemFLST.HasForm(akBaseItem)        RemoveItem(akBaseItem, aiItemCount, True, PlayerRef)        Debug.Trace("Invalid Item")    EndIfEndifEndEventFormList Property AcceptedItemFLST  Auto   Actor Property PlayerRef  Auto
User avatar
Mark Churchman
 
Posts: 3363
Joined: Sun Aug 05, 2007 5:58 am


Return to V - Skyrim