Jump to content

Script Help - Adding Item to Vendor LLD


Plarux

Recommended Posts

AFAIK the Aspirational containers are used to add unique named items that a vendor will sell, like Overseer's Guardian or Spray 'n Pray for example. I think they are added to the container via a Quest similar to how Legendary items are created, but that’s really irrelevant to what you want to do. The important thing is to look at the vendor ref and note the keyword used to link the container to the vendor ref. That's what allows the items placed into that container to appear in the vendor inventory.

 

I should have been clearer earlier: you still need to attach a script your “fake” item so that when the player purchases item the key is added to their inventory. I’m pretty sure I’ve used a script with a simple OnContainerChanged event attached to the fake item to add the key to the player inventory.

Link to comment
Share on other sites

RedRocketTV,

 

Does this script look similar to the script you mentioned? This is from a YouTube video about this issue for Skyrim. It's the exact script that I've used, but it doesn't function in-game. I used Fo4Edit to add the fake key to the vendor list. The key shows up, but the script doesn't change out the item/keys. Will using an aspiration container make this script work or is there something wrong with the script I'm using? I appreciate the fast response!

 

SampleScript_zps1wbmteh1.png

Link to comment
Share on other sites

This is essentially what I've used in the past. It is attached to my "fake" item. Obviously you'll need to define properties for both your fake key and real key:

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)

  if akNewContainer == Game.GetPlayer()
   	Game.GetPlayer().AddItem(ActualKey, 1, true)
	Game.GetPlayer().RemoveItem(FakeKey, 1, true)
  endIf

endEvent
Link to comment
Share on other sites

RedRocketTV,

 

Okay, so I got the key to be added to the vendor inventory of Trudy using the aspiration method that you suggested. I tried using the script that you mentioned too, but nothing happens. Also, I created a folder with the name of my mod in the /Data/Scripts to see if that is the issue. The only guess that I have is that it's possibly the properties that I'm using? I made the fake item a misc item w/ no components. Is there something I missing? I've had issues before with my game not reading scripts, so I'm not sure if it is that or the script itself.

 

MyScript01_zps82piov2o.png

 

UPDATE: I uploaded to bethesda.net & everything works. For some reason, my game doesn't load my scripts. If I were to upload my mod to the nexus, how would I get the scripts to function properly for others?

Edited by Plarux
Link to comment
Share on other sites

Not sure I understand what you're asking. Where your mod gets downloaded from has no bearing on if it works properly or not. But if it works after packing it into an archive from the CK that you upload to Bnet, perhaps your game isn't properly configured to read loose files? You might want to look in that as a possibility.

Link to comment
Share on other sites

PhanomGames, I looked at my data folder and the .pex file for the script is there.

 

He probably didn't include the. Pex files if the esps work but not the scripts

 

RedRocketTV,

 

You're right about the loose files. I updated my Fallout4.ini file, so it should work properly now.

Thank you for replying to my post/replies & helping me figure this all out.

 

Not sure I understand what you're asking. Where your mod gets downloaded from has no bearing on if it works properly or not. But if it works after packing it into an archive from the CK that you upload to Bnet, perhaps your game isn't properly configured to read loose files? You might want to look in that as a possibility.

Link to comment
Share on other sites

 

RedRocketTV,

 

You're right about the loose files. I updated my Fallout4.ini file, so it should work properly now.

Thank you for replying to my post/replies & helping me figure this all out.

 

Cool...glad you got it sorted! I also wanted to mention there is nothing wrong with looking at scripts written for Skyrim to get an idea of how to do something. I learned a lot by doing that. But do be aware that many Skyrim scripts will work in FO4 out of the box, as some things in Papyrus been have changed for FO4. This page on the CK wiki has helped me in the past with those situations.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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