cumbrianlad Posted November 13, 2017 Share Posted November 13, 2017 Hi. So I decided to add containers to my mod that would only accept particular item types from the player's inventory. Easy enough, I thought... ...no, it isn't. I came unstuck at the ingredients urn. I thought that all I had to do was ensure that the item added had the keyword 'VendorItemIngredient'. It turns out that a whole raft of items that are ingredients don't have this keyword. Snowberries, juniper berries, wheat, bear claws... the list goes on. I either have to write a script that specifies each of these ingredients as ingredient properties of the script and incorporate a long list of allowed items in the script after 'If (akBaseItem.haskeyword(vendoritemingredient))' or I could run through the list of ingredients and add the keyword 'vendoritemingredient' to each of the 'ingredients' that doesn't have it (when they should). Is the latter going to screw anything up? It's certainly easier than typing out a line of script that looks like Tolstoy's 'War and peace'. I could go another route and add every known ingredient to a unique formlist and then check if the item that the player was trying to store was on that list... a ball-ache but reliable. Why the flip (add a more vehement epithet here) did Bethesda come up with such a cool keyword system and then ignore it half of the time? (Sorry... I'm calming down now, honestly!) Link to comment Share on other sites More sharing options...
ReDragon2013 Posted November 13, 2017 Share Posted November 13, 2017 What do you thing about that? EVENT OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) IF (akBaseItem as Ingredient) ELSE self.RemoveItem(akBaseItem, aiItemCount, TRUE, akSourceContainer) ; we assume: akSourceContainer == Game.GetPlayer() as ObjectReference RETURN ; - STOP - no ingredient give back to the player ENDIF ;---------------------------- ; some more conditions here, mabye NirnRoot excluding ENDEVENT Link to comment Share on other sites More sharing options...
cdcooley Posted November 14, 2017 Share Posted November 14, 2017 That's an excellent solution because not only will checking (akBaseItem as Ingredient) match every ingredient correctly it is also significantly faster than checking for a keyword. Link to comment Share on other sites More sharing options...
cumbrianlad Posted November 14, 2017 Author Share Posted November 14, 2017 RedDragon2013, I'm loading CK as I type, so that's going to get tried out right away! Thanks a bundle. I've used formlists for my empty and full soul gem containers, since they already existed and it was easy enough to check if the item being stored was one of six items on a list but that looks great. I could always add a check to make sure that it was the player activating the container. Thanks a lot. I'll let you know how it works. Edit: works a treat! I'll try throwing every ingredient possible at it but so far so good. Snowberries, emperor parasol moss, netch jelly... all accepted. Thanks again. I'd got so hung up on the idea that it should be possible to do it with keywords or formlists that your idea never occurred to me! I'm not that good with papyrus, though, it has to be said. Link to comment Share on other sites More sharing options...
Recommended Posts