Zorkaz Posted May 8, 2022 Share Posted May 8, 2022 So I've done this dozens of times but it is extremely unreliable. Adding an item to a vendor via script So what I do is:1. Search for the vendor chest. Add a script similar to Key Property FHAApartmentKey Auto Event OnCellLoad() If Self.getitemcount (FHAApartmentKey) == 0 Self.Additem (FHAApartmentKey) Endif EndEvent Event OnLoad() If Self.getitemcount (FHAApartmentKey) == 0 Self.Additem (FHAApartmentKey) Endif EndEvent2. Add this script to the vendor as well 3. If this doesn't work I'm setting up a quest that should add the key to the vendor container But does anyone know a good and reliable way to do this? Link to comment Share on other sites More sharing options...
LarannKiar Posted May 8, 2022 Share Posted May 8, 2022 Is it a mod added vendor chest? If so, add a LeveledItem to the vendor chest in the editor, then AddForm() your form to the LeveledItem. Or you can PlaceAtMe() your form then add it to the vendor chest with AddItem() (might be worth giving a try if AddItem() alone is unreliable). ObjectReference KeyRef = VendorRef.PlaceAtMe(FHAApartmentKey, abDeleteWhenAble = False) VendorRef.AddItem(KeyRef) Link to comment Share on other sites More sharing options...
PJMail Posted May 8, 2022 Share Posted May 8, 2022 Onload and OnCellLoad don't trigger if you restart your game within the loading region (ugrids?) of the object with those events on it.Tediously I have had to resort to ongameload to catch these but I am sure you don't want to do that. Can you not intercept the activate on the vendor and insert at that point (or something similar)? - if you are considering a script on the vendor... Link to comment Share on other sites More sharing options...
Zorkaz Posted May 8, 2022 Author Share Posted May 8, 2022 Also forget using "Key" I just found out. I used MiscObject instead and used a script to convert the miscobject to a key.Vendors won't sell keys, which was the main problem Link to comment Share on other sites More sharing options...
SKKmods Posted May 8, 2022 Share Posted May 8, 2022 Issue attaching scripts direct to vendor chests is that they can be stored in remote hidden cells e.g POI/RE travelling vendors so they never trigger load/attach but use the hidden vendor inventory (24 or 48 game hours ?) update mechanism. I usually attach a script to the vendor actor (direct if owned, alias if not) that responds to the vendor OnLoad for 100% coverage. Also when adding LLs to the vendor chest rather than discrete items, you may have to wait for the hidden vendor inventory (24 or 48 game hours ?) update mechanism to roll the LL content into inventory. Link to comment Share on other sites More sharing options...
Recommended Posts