Jump to content

[LE] Identifying containers dynamically (without formlists)?


corrado33

Recommended Posts

New mod... Going to spell it out from the get go in case anyone has already done it they can just point me there.

 

I want to write an "item search" mod. Like, you lost the ebony blade in a container in one of your houses somewhere and you can't, for the life of you, find it. I only found ONE.... on google, and it wasn't what I wanted to do. It was basically an MCM menu that let you spawn in items from specific mods.

 

If that HASN'T been done....

 

I need a way to identify containers. Of course I could just drag all the game's containers into a formlist and go from there, but that's... not DLC safe. I looked through the conditional statements in papyrus and found nothing. Only a few that related to furniture (which aren't...containers.)

 

The only way I could think to do this.

 

Both doors and containers can be locked. I'm assuming non traditional containers can be locked (like sacks) although I haven't tried. I don't.... THINK anything else can be locked. So if I run "isLocked" and get 1 or 0, then the object must be LOCKABLE. Therefore it must be a door or a container.

 

Now, this is likely all hogwash and that function is likely just to return 0 if the object can't be locked (like a chair.) Honestly, I haven't tried, I'm just spitballing here. Anyway, if the above is true, then I can simply identify a door by checking if the object is static? or a container. Or maybe parse the name of the object for the word "Door". Or check if the object has an inventory... Maybe I should start with that. If it's a container then I'm good!

 

Anyway, is there a better way to do this?

 

The only reason I'm writing this mod is cause I'm an idiot and I constantly lose stuff in the house. And I hate spawning stuff in, too cheaty.

 

Hell, it'd be even funnier to make one of the NPCs in the house run around to each found container and "interact" with it, then they return the item to you if/when they find it.

 

The rest of the mod should be pretty easy, in essence it's almost identical to my last mod. I just need to know if there's an easy way to identify if an object is a container.

Edited by corrado33
Link to comment
Share on other sites

 

Use a quest to search for it? Easiest way, I'd think.

 

No that's.... what I had planned on doing...

 

I need to identify containers so that I can have the container it's in... glow.... so that the player can find it.

 

 

Use a quest alias to look for and find any chests with a given form or forms in them, via GetIsObjectType and GetItemCount conditions, then apply an effect shader to any of the aliases that are filled. I used something similar to create a loot-aura enchantment.

 

The tricky bit is in finding some way to allow the player to specify what item(s) they're looking for, without them actually having the items on them at the time.

Edited by foamyesque
Link to comment
Share on other sites

 

 

Use a quest to search for it? Easiest way, I'd think.

 

No that's.... what I had planned on doing...

 

I need to identify containers so that I can have the container it's in... glow.... so that the player can find it.

 

 

Use a quest alias to look for and find any chests with a given form or forms in them, via GetIsObjectType and GetItemCount conditions, then apply an effect shader to any of the aliases that are filled. I used something similar to create a loot-aura enchantment.

 

The tricky bit is in finding some way to allow the player to specify what item(s) they're looking for, without them actually having the items on them at the time.

 

 

GetIsObjectType doesn't have any documentation that I can find (other than this crap which doesn't... elaborate.), can you elaborate?

 

I was just going to allow the player to type in a name to search for, then use string utils to.... well... search through the names of the items in the chests. Or, if that's not possible, setup an array of menu options for different types of stuff.... weapons-sword-greatsword etc. then armor then daedric artifact etc. However, typing a name in would be so... so much easier, albeit slower.

Edited by corrado33
Link to comment
Share on other sites

Have you used Conditions at all?

 

GetIsObjectType effectively can be used to say 'fill this Quest Alias' (or 'apply this magic effect' or 'turn on this perk', etc) 'with an item that is of type X'. That type can be, basically, any of the form types that can be object references in the game. Container, Activator, Weapon, Armor, Book, Potion, and so on. The CK will give you a button to push that will give you the list, and you just choose what you like from that.

 

For example, from the loot-detection thing I did:

 

TEqzSGA.jpg

Link to comment
Share on other sites

Have you used Conditions at all?

 

GetIsObjectType effectively can be used to say 'fill this Quest Alias' (or 'apply this magic effect' or 'turn on this perk', etc) 'with an item that is of type X'. That type can be, basically, any of the form types that can be object references in the game. Container, Activator, Weapon, Armor, Book, Potion, and so on. The CK will give you a button to push that will give you the list, and you just choose what you like from that.

 

For example, from the loot-detection thing I did:

 

 

 

 

Oh, perhaps this was one of those times where I should have just... tried it rather than reading about it first. :(

 

Sorry.

Link to comment
Share on other sites

If you're fine using SKSE functions then you can use something like SkyUILib to give the player a text box to provide a target name. Then start a quest to locate all nearby containers by filling aliases. Put a script on each alias that checks the name of each item inside the container to your target and if it matches run the shader.

 

Finding things is almost always best done by filling aliases on a quest. The Papyrus functions to find objects are much less powerful (and are also slower) than the process used to fill aliases.

Link to comment
Share on other sites

If you're fine using SKSE functions then you can use something like SkyUILib to give the player a text box to provide a target name. Then start a quest to locate all nearby containers by filling aliases. Put a script on each alias that checks the name of each item inside the container to your target and if it matches run the shader.

 

Finding things is almost always best done by filling aliases on a quest. The Papyrus functions to find objects are much less powerful (and are also slower) than the process used to fill aliases.

I had planned on pretty much doing exactly what you suggest, mainly because that's how my other script already works and it's easy to change it around. Thanks!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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