gigantibyte Posted August 18, 2009 Share Posted August 18, 2009 So I created a new chem that I can place in a cell and pick up during gameplay. The chem works as I want, but I can't get it into the inventory of the vendor I want to sell it. I followed the instructions of option #1 on the following page: http://geck.bethsoft.com/index.php/Adding_items_to_vendors but I can not get it to work. Specifically, I want Cindy Cantelli in Rivit City to sell my new chem. Besides what's already written on the geck wiki page I posted, does anyone have any ideas what I should check? Or perhaps another easier way get a vendor to sell my chems that avoids conflicts with other mods? Link to comment Share on other sites More sharing options...
gsmanners Posted August 18, 2009 Share Posted August 18, 2009 I kind of prefer option #2 (Creating a quest/script to add the items to the NPC's existing vendor container). I've used that before with no problems. So, if you want that new chem in Cindy's inventory added once per day, you could do it like this: scn yourQuestAddItemsScr short gd begin GameMode if gd != GameDay set gd to GameDay VendorContainerCantelli.additem yourChemEditorId 1 endif end Link to comment Share on other sites More sharing options...
gigantibyte Posted August 18, 2009 Author Share Posted August 18, 2009 I kind of prefer option #2 (Creating a quest/script to add the items to the NPC's existing vendor container). I've used that before with no problems. So, if you want that new chem in Cindy's inventory added once per day, you could do it like this: scn yourQuestAddItemsScr short gd begin GameMode if gd != GameDay set gd to GameDay VendorContainerCantelli.additem yourChemEditorId 1 endif end If I wanted Cindy to have 50 of these new chems, I can change the count in your example above. But will she accumulate hundreds of these chems if I don't buy them from her for a few days? If yes, how can I script it so Cindy never has more than the amount I want her to have? EDIT: I think I can do the following: VendorContainerCantelli.removeitem yourChemEditorId 50 VendorContainerCantelli.additem yourChemEditorId 50 Whereas even if Cindy has less than 50 of my chems, she won't end up with a negative amount. Link to comment Share on other sites More sharing options...
gsmanners Posted August 19, 2009 Share Posted August 19, 2009 You could use removeitem yourChemEditorId 9999, and you wouldn't end up with a negative value (which is kind of a weird concept). Link to comment Share on other sites More sharing options...
nosisab Posted August 19, 2009 Share Posted August 19, 2009 I kind of prefer option #2 (Creating a quest/script to add the items to the NPC's existing vendor container). I've used that before with no problems. So, if you want that new chem in Cindy's inventory added once per day, you could do it like this: scn yourQuestAddItemsScr short gd begin GameMode if gd != GameDay set gd to GameDay VendorContainerCantelli.additem yourChemEditorId 1 endif end If I wanted Cindy to have 50 of these new chems, I can change the count in your example above. But will she accumulate hundreds of these chems if I don't buy them from her for a few days? If yes, how can I script it so Cindy never has more than the amount I want her to have? EDIT: I think I can do the following: VendorContainerCantelli.removeitem yourChemEditorId 50 VendorContainerCantelli.additem yourChemEditorId 50 Whereas even if Cindy has less than 50 of my chems, she won't end up with a negative amount.That is bad code, you could simply have a max amount (stipulate it and check) and add nothing if it is achieved/surpassed. Hint: [ContainerID.]GetItemCount ObjectID PS: I hope you created your own container and gave ownership to her, so to minimize/avoid possible mods conflicts. You can place that container anywhere, even under the cell floor. Link to comment Share on other sites More sharing options...
gigantibyte Posted August 19, 2009 Author Share Posted August 19, 2009 PS: I hope you created your own container and gave ownership to her, so to minimize/avoid possible mods conflicts. You can place that container anywhere, even under the cell floor. Um, no I didn't. But thanks for the tip which I will use on my next edit. If someone else creates a mod and puts his container in the same spot under the floor, will they conflict? And will the container just float mid-air or do I need to make a ledge for it? That is bad code, you could simply have a max amount (stipulate it and check) and add nothing if it is achieved/surpassed. Hint: [ContainerID.]GetItemCount ObjectID Would this be better?: short gd short RestockAmount short InStock begin GameMode if gd != GameDay set gd to GameDay set InStock to [ContainerID].GetItemCount [ObjectID] If InStock < 50 set RestockAmount to 50-InStock [ContainerID].additem [ObjectID] RestockAmount endif endif end Not sure if I got the syntax right. What I was attempting is, only add chems (up to 50) if inventory is below 50. This way, any chems sold to the vendor over 50 are not lost. Btw, if a vendor has 2 containers, which container will get the items they buy from the player? Link to comment Share on other sites More sharing options...
nosisab Posted August 19, 2009 Share Posted August 19, 2009 PS: I hope you created your own container and gave ownership to her, so to minimize/avoid possible mods conflicts. You can place that container anywhere, even under the cell floor. Um, no I didn't. But thanks for the tip which I will use on my next edit. If someone else creates a mod and puts his container in the same spot under the floor, will they conflict? And will the container just float mid-air or do I need to make a ledge for it? That is bad code, you could simply have a max amount (stipulate it and check) and add nothing if it is achieved/surpassed. Hint: [ContainerID.]GetItemCount ObjectID Would this be better?: short RestockAmount short InStock set InStock to [ContainerID].GetItemCount [ObjectID] If InStock < 50 set RestockAmount to 50-InStock [ContainerID].additem [ObjectID] RestockAmount endif Not sure if I got the syntax right. What I was attempting is, only add chems (up to 50) if inventory is below 50. This way, any chems sold to the vendor over 50 are not lost. Btw, if a vendor has 2 containers, which container will get the items they buy from the player?The vendor will sell every item she owns, be it in a container or lying around. If the container is accessible, to take the item from it is stealing. About your question, good one, I think the items will go to the first container she 'sees', if it's not full. Other than stealing purposes don't matter where the item is, it will show up in the trade menu.ps edit: be careful if you plan to recover sold items, most containers are respawnners and the items lost after some time. The reason to create your own container is to grant no other mod changing this same merchant will conflict with yours. Since the items from different mods do not stack, the firsts in the load order are lost. Although it's minimized with scripted additem command, better sure than sorry. Finally, yes, you caught the spirit. PS: You could verify if no menu is open to inhibit the script from attempt to additem while in barter mode, just a security measure, not absolutely necessary. In time, I hope: Remember to include the gsmanners suggestion of verifying the gameday change to avoid adding items all the time... think as the merchant replenish her stock every day, and the code must be inside a Begin GameMode block. All and every code must be inside a Begin block of some type. Link to comment Share on other sites More sharing options...
gigantibyte Posted August 20, 2009 Author Share Posted August 20, 2009 PS: You could verify if no menu is open to inhibit the script from attempt to additem while in barter mode, just a security measure, not absolutely necessary. At the risk of sounding like a complete n00b, how do I do that? I'm assuming there's a function I can call, but a search for "menu" at the GECK wiki returns 88 results, none of which seem correct. Link to comment Share on other sites More sharing options...
gsmanners Posted August 20, 2009 Share Posted August 20, 2009 /me grabs some popcorn Link to comment Share on other sites More sharing options...
gigantibyte Posted August 20, 2009 Author Share Posted August 20, 2009 When a menu is open, isn't the game paused, thereby stopping any quest scripts from running (or continuing)? Link to comment Share on other sites More sharing options...
Recommended Posts