Avoiding conflicts when adding to merchantsLevLists

Post » Sun Jun 24, 2012 1:06 am

I made a few new spells, and I want to put them into the basic levelled lists and merchant inventories, just like any other spell tome. But as I understand it, if I just do that, then my mod will conflict with any other mod that also tries to change these lists. Is there a way to for example do this in a script (in my own onInit quest), to avoid this issue?
User avatar
Andrew
 
Posts: 3521
Joined: Tue May 08, 2007 1:44 am

Post » Sun Jun 24, 2012 8:07 am

I'm guessing either make a new leveled list separate from the vanilla LLs and assign your lists to the same merchants, or use Wrye Bash Skyrim edition to create a "merged" leveled list plugin (the latter would probably be easier to do, but more difficult to distribute to the public if you're putting the mod out for other players).

Tim (aka the Slipperman)
User avatar
Kara Payne
 
Posts: 3415
Joined: Thu Oct 26, 2006 12:47 am

Post » Sun Jun 24, 2012 11:58 am

you can create an alias of your new spell in the quest.

and under fill type select create reference to object, select your object in the pulldown, then select "create in" and select the merchant's chest in the drop down


this will not overwrite anything nor will it create any kind of edit on vanilla skyrim records. it simply creates your item on the fly when the quest starts.


multiple people can do the same exact thing with different mods all putting their stuff into the same container and all of them will be visible without overwriting


the downside to this is, if you create an ingredient this way - for crafting - the ingredient will not be recognized by the crafting recipe
User avatar
cheryl wright
 
Posts: 3382
Joined: Sat Nov 25, 2006 4:43 am

Post » Sun Jun 24, 2012 1:36 pm

Will this be executed every time the game loads (like a quest's onInit) or only once per game? And can you even add the same thing twice to a merchant?
User avatar
Isabell Hoffmann
 
Posts: 3463
Joined: Wed Apr 18, 2007 11:34 pm

Post » Sun Jun 24, 2012 7:53 am

it's executed every time the quest runs, so you can have the quest run as many times as you want, just set it up accordingly.

if you want it to respawn after 3 days, set it up so the quest runs every 3 days. it will add the items to the chest each time. but remember, the chest itself has a respawn timer of its own
User avatar
Angela Woods
 
Posts: 3336
Joined: Fri Feb 09, 2007 2:15 pm

Post » Sun Jun 24, 2012 2:38 am

There's another sort of promising possibility but I can't quite get it to work. If you create a reference alias and set it to the merchant container, you can add items to the inventory of the merchant container directly by adding them to the alias's inventory. Unfortunately, those items aren't cleared when the container respawns, and they aren't cleared when the quest stops or is reset, or when the reference alias is cleared. So the merchant will continue to stock your items until every one you put in there has been purchased, even if the container respawns. You can then restart the quest to restock the items. But if you restart the quest before they're all gone, it'll stack so the merchant's inventory of that item will keep growing and growing.

Another thing I've tried is just creating a second merchant container for the merchant, creating a merchant faction for that container, and adding the faction to the merchant, but so far that hasn't worked. I know Enthir has two containers so I don't get why.
User avatar
Melis Hristina
 
Posts: 3509
Joined: Sat Jun 17, 2006 10:36 pm

Post » Sun Jun 24, 2012 10:21 am

I managed to get the merchant container alias system to work. I have two quests, one that has the merchant container aliases, and another that stops and starts that first quest to restock all of the merchant containers. I also made a formlist with all of the items that my mod is adding to vendors. Once a day (based on GameDaysPassed) the monitoring quest uses RemoveItem to remove all of the items in the formlist from each of the merchant containers I made aliases for, then stops and restarts the other quest. The script looks like this:

Scriptname iiiMerchantTestQuest02Script extends Quest  GlobalVariable Property GameDaysPassed autoGlobalVariable Property GameHour autoQuest Property testMerchantQuest autoReferenceAlias [] Property mouthful autoFormList Property goods autoint timeLastRestock = -1function StartMeUp()	  RegisterForSingleUpdate(1.0)endFunctionfunction OnUpdate()	  int gameDay = GameDaysPassed.GetValue() as int	  if !testMerchantQuest.IsRunning()			timeLastRestock = gameDay			testMerchantQuest.Start()	  elseIf gameDay > timeLastRestock			restock()	  endIf	  RegisterForSingleUpdate(10.0)endFunctionfunction restock()	  int i = 0	  while i < mouthful.Length			ObjectReference or = mouthful[i].GetRef()			if or != none				  or.RemoveItem(goods, 100)			endIf			i += 1	  endWhile	  testMerchantQuest.Stop()endFunction

*Edit - Only issue I see is that apparently any object assigned to a quest alias persists in memory rather than unloading when you leave its cell. Is having a bunch of containers loaded into memory going to mean a big performance hit?

*Another edit - You can set up an empty alias that has your items added to the inventory, then use ForceRefTo to set the alias to a container object reference. Each time you do that, the items are added to the specified container, so you can just have a formlist of container references and step through it, removing the old inventory and adding the new. Oddly enough, if the alias starts out initialized to a container, the items won't be added until the quest is started. If you're adding via ForceRefTo though the items are added as soon as you set the alias, whether the quest is running or not.
User avatar
Maeva
 
Posts: 3349
Joined: Mon Mar 26, 2007 11:27 pm


Return to V - Skyrim