xxgotholicxx Posted June 10, 2018 Share Posted June 10, 2018 I'm currently attempting to make a vendor who will sell certain items if you succeed in a speech check, just like Mick does with his Special Inventory.But I've been unable to to reverse engineer Mick's way of doing it as of yet and have been unable to find a tutorial that covers this topic. Does anybody know how to accomplish this? Thanks in advance. Link to comment Share on other sites More sharing options...
EPDGaffney Posted June 11, 2018 Share Posted June 11, 2018 My guess is that the speech check uses a result script that adds the items to the merchant container. That or it changes the container to a different container, but I don't think that the latter was an available function in the vanilla game. Link to comment Share on other sites More sharing options...
xxgotholicxx Posted June 12, 2018 Author Share Posted June 12, 2018 My guess is that the speech check uses a result script that adds the items to the merchant container. That or it changes the container to a different container, but I don't think that the latter was an available function in the vanilla game.Yes, from what I saw of Mick's scripts and dialogue it appears that when the speech check is successful a script is used to add a multi-item reference to his inventory. However in order to do that with my own character I would need to write a new script, and unfortunately I just don't have the energy to learn scripting. So a work around will be in order. Thanks for replying. Link to comment Share on other sites More sharing options...
EPDGaffney Posted June 12, 2018 Share Posted June 12, 2018 (edited) Edit: My solution below is acceptable but it has respawning problems I hadn't thought of. Making a mod for someone else, I happened upon some very important information, which is that merchants will sell any items that are in containers marked as owned by them as long as the container is in the same cell when ShowBarterMenu is called. This may or may not include items lying about the shop outside a container, but I suspect it does, as buying Chet's silenced pistol from him removes the one in his display case and I didn't see that specifically scripted anywhere. Of course, the merchant in question must be able to sell that type of item (for example, the merchant must have the AID service ticked in their NPC form or the wine in their owned fridge won't be available to buy in the barter menu). So, what you would really do is you'd set up your secret items container in advance and leave it out of reach in that cell. Then when the secret stash should become available to the player for purchase, run SetOwnership on the container (container needs a Reference ID and to be marked as a persistent reference). This means the vendor must be in that cell, so it may be a good idea to give them dialogue about how you need to wait for them to be there, should the player ever speak to them when they aren't. --------------------------------------------------------------------------------------------------------------------------------------------------Old solution:It's as simple as adding the secret items to a form list, and then in the result script of the speech check writing MerchantContainerRef.AddItem SecretInventoryFormList ShowBarterMenu ;this function has a discount parameter, so you can specify the barter rate here as well if you like. https://geckwiki.com/index.php/ShowBarterMenu Don't forget to hit Compile in your result script. Edited July 16, 2018 by EPDGaffney Link to comment Share on other sites More sharing options...
dubiousintent Posted June 12, 2018 Share Posted June 12, 2018 BUT ... be sure not to hit "compile all". That doesn't do what you think and will mess up your script. -Dubious- Link to comment Share on other sites More sharing options...
EPDGaffney Posted June 12, 2018 Share Posted June 12, 2018 Haha, yes, don't do that. Fortunately, that button is not by the dialogue result script compiler button. But wherever you do see it, never push it. Link to comment Share on other sites More sharing options...
EPDGaffney Posted July 16, 2018 Share Posted July 16, 2018 I've updated my solution here. Dubious, you may want to add that information to your guide. OP, I hope you worked this out between the last month and now, so this is mostly for future readers, but if you didn't, here you are. Link to comment Share on other sites More sharing options...
dubiousintent Posted July 17, 2018 Share Posted July 17, 2018 Spotted and a "TIP" drafted, but could you elaborate a bit on the "respawning problems" you mentioned? Seems like something that should be included. -Dubious- Link to comment Share on other sites More sharing options...
EPDGaffney Posted July 17, 2018 Share Posted July 17, 2018 Sure. I was more referring to the bit where items within the cell that are owned by the merchant will turn up in their barter menu, which is relatively unadvertised on-line. I inferred it may be causing some trouble with a mod I was fixing, based on a thread I think Grib was involved in years ago, with no real explanation that this was a feature, just the assumption that everyone there knew about it. So I tested that theory and it checked out. But anyway, the respawning problems are that when the merchant inventory restocks, I wouldn't expect it to restock items that are only added to the merchant container the one time the player triggers the dialogue result script that unlocks the secret goods. Meaning, you buy them once and they're gone. Adding them to the base ID of the container won't work too cleanly as the game doesn't save changes to base objects, meaning you'd need to redo it every time the game is launched/loaded and that would probably restock the items on every load, not to mention you'd need to check against a script variable. The whole concept (adding to the base object) is overly complicated (though possible if you wanted to do it that way), and clearly not how it was done in the vanilla game, as there were no functions to modify base IDs at run-time that I can think of (and certainly not one to add an item to a conatiner's base inventory). I didn't recheck Mick but I would imagine this is how his secret stash was handled. Simply changing the ownership of the items behind that wall in his shop. Or maybe enabling them? I didn't test that but I doubt this feature is available for disabled items, so that's probably another way to do it. Link to comment Share on other sites More sharing options...
dubiousintent Posted July 17, 2018 Share Posted July 17, 2018 Just "spit-balling" but this (tracking that a "stat check" for a specific NPC had been passed) would seem to be the sort of situation JIP NVSE "AuxVars" were created for. That could then be a conditional check in an "OnReload" block. Added "TIP: Merchant Inventory" to the "Custom NPCs" section (but without this "respawning" info as yet). -Dubious-. Link to comment Share on other sites More sharing options...
Recommended Posts