Jump to content

How to access objects from other mods??


QQuix

Recommended Posts

Hi, Nosisab. As much as I need arrays, I think I will pass Pluggy for the time being. I like to go one step at a time. I must, first, be more confident with CS.

 

Vagrant0, the standard inventory menu is what I am using and it does the job. I have scripts that decide what to put in when the player opens the container and similar scripts to check the contents when he closes it. Any missing item is removed from the player. This is working fine.

 

As a matter of fact, except for the final buy/sell phase, everything else I need is coded and working. Some are finished, some are just test scripts that still need a lot of polishing, but everything works. Now, based on all that your warnings, I will recode most of it to drastically reduce the creation of items. (fortunately, this is one of those very rare moments in my life when I don´t have a deadline... and I love programming. So recoding will be enjoyable for me)

 

There are two situations where I can’t avoid creating items: dressing the models and filling the container for the player choices. But these items are temporary and short lived. That is where I am relying on the following paragraph from CS WIKI (in the PlaceAtMe page) to fix my mod and be compliant with this side of your warnings:

 

"Objects spawned with PlaceAtMe can be deleted if they are inventory items. Create a persistent NPC reference somewhere in the gameworld (most likely in a hidden cell). To get rid of a reference after calling PlaceAtMe, have the reference Activate your persistent NPC to transfer itself to his inventory. Calling RemoveAllItems on the NPC will then remove the savegame bloat. So, if you must use PlaceAtMe, consider defining your object as an inventory item to take advantage of this trick."

 

Do you know if the effect is the same for items created with AddItem instead of PlaceAtMe? And RemoveAllItems from containers instead of RemoveAllItems from NPCs? I could easily use PlaceAtMe and NPCs, but that would be an unnecessary overhead if the final results were the same. In other words: items created whit AddItem, placed in a container and removed with RemoveAllItems woul also avoid the savegame bloat?).

Link to comment
Share on other sites

  • Replies 47
  • Created
  • Last Reply

QQuix, I have news about OBSE v0015 beta 1 being released.

It is at not tested enough to production state, but it bring the functions your mod dreams. take a look at the new functions OBSE link to quick access

 

I think it will reach the stable state soon enough.

Link to comment
Share on other sites

Nosisab,

 

I saw the new functions, and it is good to see that OBSE is alive and growing.

 

But they wont help me for, even if I know a given mod is installed, I cant reference its items. Not even if I hardcode the reference (the script crashes before even starting). That is why I have to look for the item ingame to get those references.

 

Maybe they may be helpful to Wizadrmirth. It seems he has a bigger problem than mine. I am restricted to find items within a single cell. He will need to find items spread all over the world.

Link to comment
Share on other sites

I take it back … Yes, there is a very interesting new function:

 

“GetSourceModIndex* - returns the mod index of the plugin from which the specified object originates.”

 

As one of my objectives is to reduce the list of clothes to a manageable size, this function (when it gets stable) will allow me to break down the long list by originating mod. Not certain how to do it yet, but it has potential.

Link to comment
Share on other sites

Nosisab,

 

I saw the new functions, and it is good to see that OBSE is alive and growing.

 

But they wont help me for, even if I know a given mod is installed, I cant reference its items. Not even if I hardcode the reference (the script crashes before even starting). That is why I have to look for the item ingame to get those references.

 

Maybe they may be helpful to Wizadrmirth. It seems he has a bigger problem than mine. I am restricted to find items within a single cell. He will need to find items spread all over the world.

ACK - I'll be there somewhere away from now on.

 

I got fooled by the topic name

 

Edit: was because this I posted, since it is what allows retrieving the load order 'on fly'

Mod Functions*

These functions return information about currently loaded Oblivion plugins.

GetModIndex* - returns the mod index of the specified plugin. This is equivalent to the first two digits of the object's formID.

(index:short) GetModIndex modName:string

GetSourceModIndex* - returns the mod index of the plugin from which the specified object originates.

(index:short) reference.GetSourceModIndex object:ref

Link to comment
Share on other sites

Do you know if the effect is the same for items created with AddItem instead of PlaceAtMe? And RemoveAllItems from containers instead of RemoveAllItems from NPCs? I could easily use PlaceAtMe and NPCs, but that would be an unnecessary overhead if the final results were the same. In other words: items created whit AddItem, placed in a container and removed with RemoveAllItems woul also avoid the savegame bloat?).

As far as I know, the difference is how the item is recorded in the world. With placeatme the item is added at the feet of the player (taking up one of the FF forms) and when picked up is added to the player's inventory as a different form. In both cases, if the item is scripted, that scripting won't get deleted when removeallitems is used since the scripting of the item gets registered when it is picked up, used, or placed in world. As far as I can tell, the scripting won't be registered if the item just sits in a container which doesn't have its contents loaded by the player or another script. Now that I really think about it, the scripting might not even get registered unless the item is taken out, used, dropped, or picked up. In that case, the only sort of bloating that you'd be seeing would be from whatever was being used on the models. It is still an issue, if it is used alot, with alot of scripted items, but may not be as serious as was thought.

 

You should still probably refrain from duplicating items though. Since the interface you are planning to use is container based anyway, you could just move all the items from each of the containers into one container to be used, that the vendor also sells from. You can use getcontainerrespawns in relation to Getnext to check if the container you're taking from respawns, if so, move those items (ref.removeallitems <yourcontainer> 1)into a respawning container, if not, move them to a non-respawnign one. Sure, you have 2 containers now, instead of one, but now there shouldn't be any issues with duplicates or ruining things within the shop.

 

If the showroom is a seperate cell, you would just use 4 containers. 2 respawning ones, 2 non-respawning ones. When you enter the showroom, items from the 2 containers within the shop (1 respawning, 1 non-respawning) to the 2 containers in the showroom. When you leave the showroom, items are taken from the model are moved (actor.removeitem <item> <container>) back to what container they came from (a bit complicated, but can be done by recording references, and assigning a variable within the script based on which container they came from (you're already recording most of this information already)) and then the contents of the containers would be moved back into the shop.

Link to comment
Share on other sites

GREAT !!! I think you got it !

 

And I may not even need those extra containers.

 

What about this:

 

Inside the scan, I save the ref to the original container along with the ref to the item.

 

When the model enters the stage I move the item from the original container in the shop to her. When she returns backstage and get undressed, I move the items back to the original container in the shop.

When the player leaves the cell, I move whatever is on any model back to the original container

(I will need some extra scripting to remember how things were when he left, or he will find everybody naked when he comes back. But can be done.)

 

Same thing for the containers I use as interface: when the player opens it, I fill it moving items from the original. When he closes it, I move everything back.

 

What do you think? Is this what you suggested?

 

The only issue is that sometimes the item that is on the model must be also in the container. Maybe in this case I would have to create a second item to put in the container.

Link to comment
Share on other sites

Maybe they may be helpful to Wizadrmirth. It seems he has a bigger problem than mine. I am restricted to find items within a single cell. He will need to find items spread all over the world.

I'm not trying to do that. I am toying with the idea of coming up with a shared resource container for modders to use as an alternative to simple drop placement. Maybe there is some way that the two ideas can be combined though as I really like your idea. The more practical benefits this container has the more it would be likely to be accepted.

Link to comment
Share on other sites

What do you think? Is this what you suggested?

 

The only issue is that sometimes the item that is on the model must be also in the container. Maybe in this case I would have to create a second item to put in the container.

Kinda, what I suggested. Should probably try it before seeing what else could be done.

 

Why would you need to have an item on the model as well as in the shop? The player can't access the shop if they're looking at the models, and the models won't be seen if the player is in the shop. I don't quite understand what you are thinking.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...