Jump to content

Adding an item to non-specific vendors and loot lists


PrettyMurky

Recommended Posts

Once again, the parts of my mod that I assumed would be trivial, have left me confused.

 

I would like an item that I've made (a potion with no effects called 'Empty Bottle') to be available for sale from NPC alchemy-themed vendors. I've tried adding it to the base containers that certain NPCs view as one of their merchant containers; I've tried adding them to leveled lists; nothing seems to work.

 

I'd also like them to turn up as loot from appropriate NPCs (conjourers etc.), which I haven't tried to do yet, as it would be even harder to test, and I assume has a similar solution to the vendor list problem.

 

If anyone can help with these problems, it would be greatly appreciated, as my Real-Time Skyrim-style alchemy overhaul is otherwise finished!

Link to comment
Share on other sites

I'd tried to edit the base container, of which the merchant's chests were instances. I could have added the item to multiple individual's chests, but then they and only they would sell the item; NPCs from other mods would not.

 

I've come up with a different method to solve the problem: A menumode 1009 block, which checks if the NPC with whom the PC is currently in dialog sells alchemy equipment, if so adding the items I want sold to their merchant container, and adding the NPC to a faction to keep track of who has already been done. The reference to their merchant container is stored in an array, and another menumode block checks through the array every day, restocking each vendor every three days, if they require it.

 

scn pmaoVendorQuestScript

float fQuestDelayTime

ref trA
ref trB

Begin MenuMode 1009

set trA to GetActiveMenuRef
if trA.OffersServicesC 256
else
	Return
endif
if trA.GetInFaction pmaoAlchVendor
	Return
endif
trA.SetFactionRank pmaoAlchVendor 1

set trB to trA.GetMerchantContainer
if trB
	trB.AddItemNS pmaoemptybottle 10
	ar_Append pmao.AlchVendors trB
endif

End

Begin MenuMode

if GameDaysPassed > pmao.LastRestockDay
	call pmaoVendorRestock
endif

End

-------------------------------------------------------------------------------------------------------------------------------

scn pmaoVendorRestock

short tsA
ref trA
array_var ArrA

Begin Function { }

ForEach ArrA <- pmao.AlchVendors
	let tsA := ArrA ["Key"]
	if tsA % 3 == GameDaysPassed % 3
		let trA := ArrA ["Value"]
		set tsA to trA.GetItemCount pmaoEmptyBottle
		set tsA to 10 - tsA
		if tsA > 0
			trA.Additem pmaoEmptyBottle tsA
		endif
	endif
Loop

set pmao.LastRestockDay to GameDaysPassed

End

Link to comment
Share on other sites

  • Recently Browsing   0 members

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