M3rvin Posted April 9, 2012 Share Posted April 9, 2012 I started working on a little project for Skyrim and at first, it all went well. But then I started to fail at using the simple AddItem(...) function: My script is applied to an activator that is used to open a container placed outside the area the player can reach (somewhat like a merchant's container). Before opening the container, the items from a formlist should be added to it, so that the player can take them or add others to the container. There's some other code involved with the container, but this stuff works flawless. So here's my code:Scriptname SOM_ActivateIgnoreListUpdate extends ObjectReference Import Game Import Utility Import Debug FormList Property AlcoholicDrinksList auto Event OnActivate(ObjectReference rActor) Actor Player = GetPlayer() ObjectReference rContainer = Self.GetLinkedRef() if rActor == Player Notification("Opening the Container") Wait(5) rContainer.AddItem(AlcoholicDrinksList) rContainer.Activate(Player) endif EndEvent The container that should be opened and manipulated is a linked ref of the activator. I'm using AlcoholicDrinksList as a dummy to ensure that I don't try to add the items of an empty formlist (in case by other code didn't work). I added the Notification and Wait commands after reading the official wiki article on additem (Don't call this function immediately when a game is started/loaded as it does not seem to work. You can have the game Wait a second before doing it which should correct this problem.) I did notice a strange thing related to them: Directly after activating the Activator the Notification pops up and after 5 seconds it appears again. Does anyone know what I'm doing wrong? Link to comment Share on other sites More sharing options...
fg109 Posted April 9, 2012 Share Posted April 9, 2012 Did you remember to set up your properties? Also, it's quite strange that the notification appears twice.... Did you make the container the activate parent of the activator too? Link to comment Share on other sites More sharing options...
M3rvin Posted April 10, 2012 Author Share Posted April 10, 2012 I didn't set the properties of the script, next time I should read the tutorials more careful. Thanks for pointing out my mistake. :thumbsup: Link to comment Share on other sites More sharing options...
Recommended Posts