figor888 Posted August 25, 2021 Share Posted August 25, 2021 I am looking for some guidance on how I can implement a quest limited container for a mod I am working on. The premise is that the player must be in both the Mages and Thieves Guild and at this point, the player is directed to Enthir to potentially buy some new mage-thief spells I have created. It is my understanding, the end papyrus fragment akspeaker.ShowBarterMenu() access that NPC's specific container. My question is how would I go about setting up a container only available as part of the mod quest? Would the container have a script attached that linked it to a specific quest? Something involving GetOwningQuest perhaps? I would also need an alias for that container as well, correct? Thank you Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 26, 2021 Share Posted August 26, 2021 Enthir is already a merchant and has their own container. They cannot have another one associated with them even for a quest. You will have to add the items that you want to appear directly to their container. This can be done via script. Due to the respawn on merchants, the best method might be to place a trigger volume box around the fast travel markers and entry points into the town / college. One big marker, not multiple little ones. When the player enters, have the trigger check Enthir's container for your items (make a formlist to check). If none are present, assume a reset and add them. If Enthir's store is already limited to a certain area (i.e a single floor of the college), then just put the trigger volume box around that area plus a little bit extra to ensure the code can run before the player interacts with Enthir. An example script that might work with a bit of modification to fit your variables. ScriptName SomeScript Extends ObjectReference ;change names of variables as desired to auto-fill ;change the script name to something more specific GlobalVariable Property myStatus Auto {value assigned to the global variable in quest directing player to Enthir} FormList Property myStuff Auto {list of items you want to add} ObjectReference Property EnthirMerchantChest Auto {the merchant chest belonging to Enthir} Event OnTriggerEnter(ObjectReference akActionRef) If myStatus.GetValue() == 0 ;not activated Return ;do nothing Else If EnthirMerchantChest.GetItemCount(myStuff) > 0 ;some items exist - do nothing Return Else EnthirMerchantChest.AddItem(myStuff, 1) ;will add one of each item in the list ;alternatively individually add items as desired EndIf EndIf EndEvent Link to comment Share on other sites More sharing options...
Dromundas Posted August 26, 2021 Share Posted August 26, 2021 (edited) If I understand correctly then I think this could help: https://forums.nexusmods.com/index.php?/topic/4652030-properly-adding-items-to-vendor-containers/ Edited August 26, 2021 by Dromundas Link to comment Share on other sites More sharing options...
figor888 Posted August 26, 2021 Author Share Posted August 26, 2021 Ishara, I understand most of the script but I am a bit unsure about how the global variable relates to the quest. Is this variable checking that the quest has fired off? GlobalVariable Property myStatus Auto{value assigned to the global variable in quest directing player to Enthir} Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 26, 2021 Share Posted August 26, 2021 You would set the global to a non-zero value in your quest that tracks when the player is ready to have access to the added store items. It would of course need to be added as a property to whatever quest stage fragment on said quest. Then in the earlier provided example, the global is checked. If a zero value it exits and does nothing. If a non-zero value it will add the items that you want to the store. By using a trigger volume box around the store's area you ensure that the items will be present at interaction time rather than possibly lost due to respawn. Unsure if the merchant containers will respawn while standing in the store area for the 3 days it takes, that would need to be tested. Link to comment Share on other sites More sharing options...
Recommended Posts