Jump to content

Adding custom items to NPC merchants


KingsGambit

Recommended Posts

Hi all, I've finished a rather nifty mod I was hoping to upload earlier but haven't been able to get it in game as yet. When you see it, you'll laugh that it took me as long, or longer just to do this.

 

I have chosen not to give it to the player automatically, which I am able to do. I have also chosen not to make it craftable, which I am also able to do. I'd like to add it to a merchant, but realise that simply adding it to their inventory chest is probably bad form, as it'll likely overwrite any other mods that do that same thing. In FNV I created a mod that ran a quest on loading it up, the quest ran a script that gave the item. I'm trying to do it that way, my script however isn't working. It is as follows:

 

Scriptname AddItemToMerchant extends form
{Add my item to merchant}

Weapon Property ItemName auto
Container Property MerchantChest auto
Quest Property MyQuest auto

Event OnInit()
Utility.Wait(3)
MerchantChest.AddItem(ItemName, 1, TRUE)
MyQuest.SetStage(99)
EndEvent

It fails on the line: MerchantChest.AddItem(ItemName, 1, TRUE). If I swap the chest variable for Game.GetPlayer() it works just fine, but as I mentioned I'd prefer to avoid giving the item directly if there's a solution to this. With many thanks in advance.

Link to comment
Share on other sites

Use this instead:

 

ObjectReference Property MerchantChest Auto

Thank you for that tip. I thought it was something like that. In spite of this, I still couldn't get it working with merchant chests, though it worked with normal ones. Possibly because of the respawn timer or some such. Still, it works now, many thanks!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...