Jump to content

Add a Leveled Item to a Vendors Container via Script


PoorlyAged

Recommended Posts

I have mod which adds a LeveledItem to Arturo Rodriguez's container (VendorDCCommonwealthWeaponry) and it works just fine. Unfortunately, it conflicts with any other mods which hit the same container. So I want to change the mod so that the leveledItem is added via Script.

 

I have face-planted enough to realize that I need help, so am reaching out for help from the pros that know all the stuff I don't.

 

Here is my script:

 

ScriptName my_questscript extends Quest
Event OnQuestInit()
LL_Vendor_Components_Diamond_CommonwealthWeaponry.AddForm(my_leveledItetm, 1, 1)
my_quest.Stop()
debug.notification("got here")
EndEvent
LeveledItem Property LL_Vendor_Components_Diamond_CommonwealthWeaponry auto
LeveledItem Property my_leveleditem auto
Quest Property my_quest auto
Edit: 2017/03/01 1842 UTC
Turns out you cannot "AddForm" to a container. So I changed the script to use a LeveledItem (LL_Vendor_Components_Diamond_CommonwealthWeaponry), which is unique to Arturo. I also made the change suggested by @Steve40. All the changes are reflected above in green.
The script now compiles and executes when the game starts (I get the "got here" message). However, the added items do not show up. i am aware of the "it may take a couple days for the vendor to refresh" so I have waited 11 days and 22 hours and checked each time the wait expired. Arturo refreshed after the first 46 hours, but the items I added never show up.
I know it is something obvious, but my ignorance is obviously boundless when it comes to scripting.
Edited by PoorlyAged
Link to comment
Share on other sites

I`m no way a pro but maybe my experince can help you. I was trying to do something similar and it partly worked. Unfortunatelly I have already deleleted that file as I have found a better way for my purpose. I can`t remember all details now.

What I was trying to do is to equip a leveled item by script. It did not work because it does not work with leveled items. But I think that "MyNPC.additem(LeveledItem) as Form" worked while equipItem did not work. Actors work the same as containers so maybe using AddItem(leveledItem) as Form will work for you. As I know AddForm is mostly used for formlists.

 

And for my mod I have replaced the Leveled Item with the Formlist with all the same items to make it possible to equip them directly.

Something like this:

(MyNPC as Actor).EquipItem(MyFormList.GetAt(Utility.RandomInt(0, 10)), true, true)

 

i think it can be also used as alternative way if you change equipitem to additem.

Edited by kitcat81
Link to comment
Share on other sites

Did you remember to fill the script properties? Also, Have you looked in your papyrus log for runtime errors?

 

In Better Cooking Stations, I add items to leveled lists via a startup quest, but I add actual items (such as Potions etc) rather than leveled lists...and it works. I also use GetFormFromFile rather than use a Property, but that shouldn't make any difference.

 

Example:

LL_ingredients.AddForm(Game.GetFormFromFile(0x00013384, "DLCCoast.esm") as Potion,1,1) ; adds potion item Aster to the LL_Ingredients leveled list

Link to comment
Share on other sites

  • Recently Browsing   0 members

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