Page 1 of 1

[RESOLVED] How Would You Make Guild Service Shop Stock Persistent?

Posted: Thu May 06, 2021 12:14 am
by Magicono43
I'm having quite a difficult time trying to implement this in my project, that being making the inventories of the various guild services such as potion sellers and magic item vendors persistent just like the shelves of normal shops. I have been attempting through multiple methods but I keep getting stuck at some point and realizing that the way I am trying to do won't work, or I can't seem to make it work like I would expect.

I am feeling lost right now on this one, my main idea was trying to do it like Oblivion does where a loot-pile of sorts would be placed somewhere out in the void of the cell and would be the holder of the items, which would then later be used to supply the service window items, just like it works with the shop shelves, but in this case it would not be directly activating the loot-pile in question but "remotely" where the static NPC would be somehow tied to the loot-pile in this way.

But I am having a lot of difficulty in trying to implement this it seems. How might you consider doing this? Or even some advice on what I should look would be helpful, I have been looking at so many different related scripts but have become confused on how I would exactly do this, thanks for any insight.

Re: [RESOLVED] How Would You Make Guild Service Shop Stock Persistent?

Posted: Sun May 09, 2021 1:46 pm
by Magicono43
Alright so I figured it out, I don't believe my solution is the best way to possibly do this, but it seems to be simple enough and "just works" so far for this application. The most difficult part was figuring out basically how to interact directly with Unity Gameobjects and how to read them in a scene and such, and thankfully with some examples from the "DefaultCommands.cs" I was able to find how to loop through and read the various properties of Gameobjects such as loot-piles.

The other difficulty was figuring out how to get the generated "custom" loot-pile to actually save between the player transitioning between scenes (I.E. leaving and re-entering the guildhall). Turns out that loot-piles need to have a component assigned to them called "SerializedLootContainer" to be saved, it's not something they just do on their own in the "DaggerfallLoot" objects. In this case I just did a somewhat lazy way of doing it, that being piggy-backing off of how other loot-pile types are saved in a similar vain such as play dropped loot and shop shelves.

I don't feel like posting the entire solution right now as it is sort of all over the place, but if someone has similar problems in the future and comes to this post, reply to this one and I'll post the specific details then. Besides that I would say play with the scene viewer in Unity while in an interior building scene and stuff will make a lot more sense after a while in this regard, also check some of the "DefaultCommands.cs" commands such as "killall" as that has a great example where it loops through all the MobileEnemy Gameobjects in the current scene and does something with them, perfect way to do it with other Gameobjects as well.