QQuix Posted May 3, 2008 Share Posted May 3, 2008 Can anybody help me on how to access objects from other mods?? Or it is impossible due to some built in restriction?In my mod, I would like to show the player a list of everything a vendor has to sell (including items added by other mods).But if I ref containers/items created by other mods, the script compiles OK, but crashes when used in the gameIf I put those items in a new container (drag&drop in the CS), the container is empty when I open it in the game. The workaround I found is to duplicate all items, but this would make my mod static: it would show the item even if the original Mod is not installed (and wouldn’t work, as the meshes/textures are not there) and would not show items from mods that I didn’t duplicate items from. :wallbash: I would appreciate any ideas you can give me. Link to comment Share on other sites More sharing options...
QQuix Posted May 5, 2008 Author Share Posted May 5, 2008 Hi. I found the answer and I am posting it here, so others with similar problem may try it: Suppose you need to reference an item created by Mod XUse CS to find in which cell Mod X creates the item and write down the item’s nameAdd a scripted item to that cellWrite a script that scans the cell looking for the item type (using GetFirstRef/GetNextRef) This fits nicely in a onload block.Cycle thru all items found, looking for the one that matches the name (function NameIncludes or CompareName)Save the reference and keep it alive >> that is the reference you need.If the item is inside a container, look first for the container´s name and, then, cycle thru all items insideISSUE: this won’t work if the item you need is inside a cell also created by another mod In my case, I don’t look for a specific item. I look for any container in the vendor’s cell and duplicate everything inside to a container I created somewhere else. This way, any item added to the shop by any mod will be there and I can build a dynamic “Consolidated Catalog” Link to comment Share on other sites More sharing options...
wizardmirth Posted May 5, 2008 Share Posted May 5, 2008 I have a slightly different goal in mind but my method is to create a new personal mod that has all non-vendor given items combined with it. I give these items to my own custom vendor\shop so they can actually be sold since I don't like them freely found or even worse dumped into player inventory. Then I just have to create a new archive using the textures & meshes from the original mod and then remove the original mod. A great way to minimize esps and organize those errant tex\mesh files. Link to comment Share on other sites More sharing options...
Vagrant0 Posted May 5, 2008 Share Posted May 5, 2008 Can anybody help me on how to access objects from other mods?? Or it is impossible due to some built in restriction?In my mod, I would like to show the player a list of everything a vendor has to sell (including items added by other mods).But if I ref containers/items created by other mods, the script compiles OK, but crashes when used in the gameIf I put those items in a new container (drag&drop in the CS), the container is empty when I open it in the game. The workaround I found is to duplicate all items, but this would make my mod static: it would show the item even if the original Mod is not installed (and wouldn’t work, as the meshes/textures are not there) and would not show items from mods that I didn’t duplicate items from. :wallbash: I would appreciate any ideas you can give me.This is one of the worst usages of OBSE I have seen in awhile. Even if such a list were useful from the perspective of it being more effective than just accessing the vendor, or even if the list is to control some other element, this is just a very bad way of doing it. The reason is because you are duplicating container contents, when it comes to scripted/enchanted items, this can lead to significant save game bloating depending on where it is run, and how often. Even once within a fairly large store (the best defense) would be too much in my opinion. Since this is the only way to do it, and you are relying heavily on certain OBSE functions, it is not suggested that you attempt to do this. But more importantly, a script which uses getnextref within a usually heavily cluttered space is just a bad idea since it will be scanning through everything, repeatedly. The real question here is what exactly are you hoping to accomplish with such a mod, and how do you intend to have the player view this list? I surely hope you don't intend to use a message box with 20 listings per box. Even in vanilla shops that would be rather annoying. Again, this is a bad idea, and those functions were not designed to be used for something like this. GetNextref is really best off for working with smaller spaces, or within more restricted parameters. Using it to locate containers, then duplicating the containers will probably result in too many issues. Don't forget, the player, and any NPCs, creatures, bodies also count as containers. Even if the duplicates are removed right away, they are still being registered by the game, and can cause form issues and save game bloating (since scripted items don't have their scrpts cleared from memory). Link to comment Share on other sites More sharing options...
QQuix Posted May 5, 2008 Author Share Posted May 5, 2008 Wizadrmirth, I didn't quite understand your method, and I would appreciate if you detail it a bit. But, from the little I understood, it does not apply to my scenario. My mod has to do with clothes. Clothes are created by the hundreds by many moders and I can't / shouldn't / wouldn't include their meshes/textures in mine. I am doing a “Fashion Show” or “Showroom” were the player can see the clothes before buying. And I want it to be dynamic, so if a new clothes mod comes out in the future, the player would be able to see those new ‘products’ the shop has to offer. Link to comment Share on other sites More sharing options...
QQuix Posted May 6, 2008 Author Share Posted May 6, 2008 Vagrant0, Thanks for the warning. I will explain what I am doing and I hope you will agree that it is not as bad as you think. I just mentioned in the previous post that I am building a Fashion Show. First of all, it is limited to Divine Elegance. I replace its basement with a showroom where models will wear the 'products' Palonyria has for sale and the player can make his/her choice of what to buy. Second, the DE cell has only the vendors containers and Palonyria herself and, as for performance, the GetNextRef scan runs only once, on load. I have tested with more than 300 items in the vendor containers and I didn't notice any difference on load time at all. "GetNextref is really best off for working with smaller spaces, or within more restricted parameters"Since I am using it inside a small space and I restrict it to scan only for containers and not everything , I suppose I am using it appropriately. I am using 'GetFirstRef 23 0' and I can´t make it more restrictive than that. I duplicate the items to a chest in the basement. The objective of this chest is to act as a "Product Catalog" where the player may pick (in a containers menu) the items the next model will wear in the catwalk. I need to make its contents an exact copy of Palonyria’s buy/sell menu. Fortunately, clothes for sale in DE don´t usually have scripts/enchantments. It may be an issue if, in future versions, I expand my mod to include armor. As for save game bloating, even with the new cell, everything inside and about 300-500 duplicated items, my savegame size increase is less than 1% (2975Kb to 2990Kb). I suppose that if a player activates a mod that add more than 600 items to the game (like, Growlfs Hot Clothes and Armor) he/she can afford a mod that duplicates those items. (actually, Growlf was my inspiration for this mod, as I had a hard time choosing which ones to buy) Anyway, this mod will be a little useful for the players, but it is mostly for fun. And, if a player has a slow PC or some other limitation, he can always samegame >> activate the mod >> look around >> write down the names of whatever clothes he liked >> quit >> deactivate the mod (even erase the esp) >> load the saved game and buy his "shopping list" without the mod. ( I will put this in the readme) Finally, if you could suggest any other way of referencing an item that will be created six months from now, I would use it (I am a newbie in this area: 3 week experience with CS) * [EDIT - minor correctionsand typos - QQuix] * [EDIT - Ooops… I suppose this last sentence might sound ironic. It is NOT! I am really eager to find new and better ways of doing things] Link to comment Share on other sites More sharing options...
Vagrant0 Posted May 6, 2008 Share Posted May 6, 2008 No, it is not as bad as I thought, but my concern is still valid. There are alot more pieces of scripted clothing than you realize. For instance, most of the clothing that is for a single gender usually has scripting on those items to prevent usage by males. Those scripts may be small, but they can add up over time. And that is really the issue here, time. Sure, in your case, it happening a few times through the course of normal play won't amount to much, but a mod like this will probably encourage people to search for more clothing mods to download just to try out. In addition to the increased frequency of visits (which is where the bloat would still play a part), they open themselves to a load of additional problems if they decide that they don't want to use that mod afterall. Normally removing such a mod wouldn't be an major issue as long as the player wasn't wearing the item. But since it is being duplicated and stored in a container outside the mod, it may cause any saves made with that mod active to crash, or atleast break your scripts. Doing the mod for fun is one thing, you can continue doing that without causing problems for others. Releasing such a mod to the public however may result in ruining peoples games. This is why it is an irresponsible mod. Really though, I don't see what the real benefit to a mod like this is. Most people have enough money to buy out a shop if they wished to. And many of the larger clothing mods use their own shops (to avoid cell conflicts with other clothing mods). And for those mods, something like this isn't practical. One alternative you might considder would be to just use a sort of changing booth. The player could go into the booth (having all of their items placed in a non-respawning container when they do). Inside the booth would be an activator which would list the containers within the cell, and then activate the actual container within the cell to let the player take items as they wish to try on. When they exit the booth, take anything from their container of belongings, or try to use the door to the shop, anything they had in their inventory would be moved to a new respawning container for sale. As you may have to have things within the same cell, you could just add another room within the cell, connected by a teleporting door to the rest of the cell. It's a bit more complicated initially, but doesn't result in nearly as many long term problems. Link to comment Share on other sites More sharing options...
nosisab Posted May 6, 2008 Share Posted May 6, 2008 There is a way to get references and directly manipulate then, but is beyond OBSE itself and requires one or even two plugins to it: pluggy and TSFC. So the range of users would be yet more severely limited. those plugins specializes at manipulating strings and arrays. They are very powerful tools, and dangerous too, as they creates the vectors directly on RAM and failing at destroying then can easily lead to problems and memory leaks. Well... maybe is better don't think in such 'solutions'... Link to comment Share on other sites More sharing options...
QQuix Posted May 6, 2008 Author Share Posted May 6, 2008 Vagrant0, First , let me clarify a few points I didn´t mention before:1. The player is not supposed to take anything from the new basement (it is just a showroom, after all). Actually, he will not be able to put his hands on any of the clothes (unless he pickpockets the models). 2. Most of the containers I use are ‘underground’. The few in the room are used as menus for the player to make choices. They are scripted to remove from the player´s inventory any item the player picks (but will remember those items for subsequent use) Now, a few questions:1. What is the technical difference(in terms of memory usage and savegame size) between my duplication of an item and the player buying 2 of the same item? In both cases there will be three instances of the item in the game> one in the vendor chest , one with the player and a third either as a second item with the player or in me basement chest.2. When you say that script may add up over time, you mean that every time I buy a vanilla shirt on a store (therefore, creating a new instance of the item) its script will be duplicated??? I would guess Bethesda developers are better than that. Reusability, OO, etc are not new concepts for developers. And finally to the points you mentioned:Ref. Frequency of visits: I don´t have a single line of code related to a second or third visit. The player can go in and out a thousand times and the contents of the basement won´t change at all. Ref. Encouraging people to search for more clothing mods : Well, I suppose that that is what mods are for. I, myself, installed several (and intend to try all, sooner or later) If I like it, I keep it. If I don´t, I drop it. If my game becomes slow, it is my choice, as a player, to cope whit a slower game or give up some clothes I like. Ref. Removing the mod: I can´t see any problem in deactivating the mod: the new basement will vanish, the old one will be back and there shouldn’t be a single item in whole Cyrodill that is dependent on the mod. Ref: Benefits of this mod: This mod is intended for the (small?) subset of players that enjoy, as I do, the work and creativity of other modders that spent a lot of time and effort creating all kinds of fancy clothes for the game. As a player, before even thinking of creating a mod, I spent a lot of my time doing exactly what you said: buy out the store and try every combination in my character (which is female). That was too much menu surfing and by the time I was on the 6th or 7th outfit I had forgotten the first. So I installed a manequim mod and lined them up, so I could see several at the same time. But they were static. That´s when the showroom idea started to build up. Of course, nothing of this makes any sense for someone that doesn’t care about fancy/sexy clothes in the game. As for your suggested changing both, I liked it very much, as a concept. But the bottom line is that is wouldn’t be any different from buying out the store, drop everything in a container in one of your houses and try the items as I described earlier. After a few minutes you get tired of going in and out the menus. Besides, you mention “an activator which would list the containers within the cell”. As far as I know, it is not technically feasible without the GetRef. The clothes mods I installed don´t add items in the original vendor container. They add new containers and I can´t reference them in the CS (not even if I hardcode their Base ID in the script) Uau!! It became much longer that I expected ... but, unfortunatelly, I don´t have the gift of conciseness (?) Link to comment Share on other sites More sharing options...
Vagrant0 Posted May 6, 2008 Share Posted May 6, 2008 First , let me clarify a few points I didn´t mention before:1. The player is not supposed to take anything from the new basement (it is just a showroom, after all). Actually, he will not be able to put his hands on any of the clothes (unless he pickpockets the models). 2. Most of the containers I use are ‘underground’. The few in the room are used as menus for the player to make choices. They are scripted to remove from the player´s inventory any item the player picks (but will remember those items for subsequent use)Yep, and that's why you're dumping the players inventory before they can enter, and why you're forcing whatever was taken from those containers out of the player's inventory when they try leaving. The use fo the activator is there so that you can remotly access those containers which are below the floor, and to also implement control systems to prevent theft. There would be no reason to do anything otherwise. Now, a few questions:1. What is the technical difference(in terms of memory usage and savegame size) between my duplication of an item and the player buying 2 of the same item? In both cases there will be three instances of the item in the game> one in the vendor chest , one with the player and a third either as a second item with the player or in me basement chest.2. When you say that script may add up over time, you mean that every time I buy a vanilla shirt on a store (therefore, creating a new instance of the item) its script will be duplicated??? I would guess Bethesda developers are better than that. Reusability, OO, etc are not new concepts for developers. The technical difference is this. When you are buying an item from an NPC, you are not creating duplicates, you are simply removing one item from one container and adding it to the player's inventory. Meaning that all the instances available are only generated when they container is first accessed, and will be cleared when the container respawns. The problem with your method is that you are effectively doubling every single item that was in the containers. only so that you can show a few of them off. When it comes to unscripted clothing, this is a minor issue, and will at worst only add alot of extra forms (which is a rather large issue for anyone without the latest 1.2 patch) with scripted items, every time that script runs, it gets registered in memory, even if the item it belonged to no longer exists. As mentioned, many clothing mods use scripts to disable one gender from wearing certain things, so every time that item generated and the scripts run, it is creating a bit of extra data. As I said, on its own, this is a minor issue in this case, but with repeated, frequent usage, this can cause problems. The changing booth idea doesn't really solve this issue, it just makes it less since you aren't duplicating the items, the same item the player can test with is the same item they can buy. And finally to the points you mentioned:Ref. Frequency of visits: I don´t have a single line of code related to a second or third visit. The player can go in and out a thousand times and the contents of the basement won´t change at all.http://cs.elderscrolls.com/constwiki/index.php/OnLoadMeaning that while it may not re-run that part of the script when you exit and re-enter, if you leave for awhile, and return, that part of the script will be run again. With this, your mod will allow people to install other clothing mods after your mod has been in place. If you only make it run once, whatever was in the shop at that first time will be what is in the containers, and any mods added after won't be seen. So yes, you would be re-duplicating everything more than once if you actually want to add reasonable functionality to your mod. Ref. Removing the mod: I can´t see any problem in deactivating the mod: the new basement will vanish, the old one will be back and there shouldn’t be a single item in whole Cyrodill that is dependent on the mod.Was talking about them removing a clothing mod which had items duplicated by your mod. This is an issue since those duplicates would be in containers belonging to your mod. The more missing items there in more containers, the more likely a save with that mod active will be broken. Ref: Benefits of this mod: This mod is intended for the (small?) subset of players that enjoy, as I do, the work and creativity of other modders that spent a lot of time and effort creating all kinds of fancy clothes for the game. As a player, before even thinking of creating a mod, I spent a lot of my time doing exactly what you said: buy out the store and try every combination in my character (which is female). That was too much menu surfing and by the time I was on the 6th or 7th outfit I had forgotten the first. So I installed a manequim mod and lined them up, so I could see several at the same time. But they were static. That´s when the showroom idea started to build up. Of course, nothing of this makes any sense for someone that doesn’t care about fancy/sexy clothes in the game.I understand the purpose, just don't see how complicating things with additional menus is better than just buying the clothes, and remembering what was what. Female or not, interested in fancy/sexy clothing or not, there are somethings which this particular game just does not do well. As for your suggested changing both, I liked it very much, as a concept. But the bottom line is that is wouldn’t be any different from buying out the store, drop everything in a container in one of your houses and try the items as I described earlier. After a few minutes you get tired of going in and out the menus.And trying to go through menus as you are suggesting is a better approach? Atleast within your inventory you usually have an icon to indicate what something is. With menu boxes, you're just getting text, and in cases of poorly named items, can be a problem. Nevermind the even greater headache of going through 300+ items 20 items per menu, trying to figure out what is what. Again, this is something the game just doesn't handle well. But one option would be to have anything the player takes from the chest (controlled through the activator and the previously mentioned systems) immediately removed from the player and added to an NPC for viewing. That way the player doesn't have to do much more than pick stuff out of a container. Besides, you mention “an activator which would list the containers within the cell”. As far as I know, it is not technically feasible without the GetRef. The clothes mods I installed don´t add items in the original vendor container. They add new containers and I can´t reference them in the CS (not even if I hardcode their Base ID in the script)Well duh... None if this is technically feasible without OBSE and GetRef. The only way to make it so would be to get permission from all those mod makers, and combine all those mods into a single .esp, then add all your stuff to that .esp. Since you are obviously trying to reference things which are outside your mod, and are totally unknown, I have to wonder why you even brought this question up. You're still welcome to do whatever you want, but doing this your way will probably cause more problems for others than it solves. There are only so many things that Oblivion can do well. There are many many more things which can be done, but will cause problems down the road. Oddly enough, those things are usually only possible with OBSE. Just because something "can" be done, doesn't mean it is a very good idea to do it. What you are attempting is an irresponsible mod, and seeing as how you seem to be asking for advice, I am offering suggestions to make it less irresponsible. Should you decide to continue with your method, please atleast make notes mentioning possible issues so that there aren't as many people who end up ruining their games because of your mod. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.