Jump to content

[LE] most efficient way to detect when a set of items is picked up


irswat

Recommended Posts

Say I have 50 unique items and when anyone of these items are found I want to flag them as found. I assume I would use an OnItemAdded event and use some type of inventory filter, but what is the most efficient way to do this? I don't want the script running constantly, and I don't want the script wasting time detecting anything except these 50 items. Suggestions?

Another option I was considering was a small script using OnItemRemoved and then attaching it to the containers that the items are in. Is this the best way?

Link to comment
Share on other sites

At first glance the only two ways to do this effectively would be to set up a quest then use either a global variable or register forupdate papyrus scripts attached to the items. Thats just my guess though. Prolly attach them to 50 different stages in the quest and just have the items register the update to the quest through script on itemadded then a getitemcount script like u mentioned. This is just a guess though dont take my advice to heart. Edited by XN0X0neX
Link to comment
Share on other sites

Is it only the player picking these things up you're concerned about? E.g. if one of these unique items is a weapon and an NPC grabs it, you don't want to bother? And that you don't care if the player then drops it and picks it up again?

 

 

My solution would be a quest alias on the player, with an inventory filter that updates whenever one of the items is picked up, thereby removing it from future consideration. There's a few ways to implement that. I'd try this one:

 

1. Because the CK doesn't like Form as a property, pass the stuff in with a FormList. OnInit, add an inventory filter based on that. That should guarantee that only the items you're interested in fire the event. Then change the script state to a listening one.

2. Create an OnItemAdded event in the listening state. Do a sanity check to make sure the added form is in fact in the FormList, via HasForm. If it is, remove the inventory filter for that item and increment a counter.

3. If that counter is the same size (or greater, in case of oddities!) as the size of the FormList, clear the alias.

Link to comment
Share on other sites

thanks, I did throw all the items into a formlist and added an inventoryeventfilter with the form list oninit. I will flip a switch and remove the form from the form list. It's a treasure hunt so you only need to find the item once. These items are being displayed in a dynamic book/checklist which also contains clues.

Link to comment
Share on other sites

here is the list I came up with:

Alvante's Gloves

Alvante's Hood (x2)
Apron of the Master Artisan
Birthright of Astalon (x2)
Black Bend
Blackwoord Ring of Silence
Boots of the Swift Merchant
Brusef Amerlion's Armor
Brusef Smelion's Boots
Brusef Amelion's Gauntlets
Brusef Amelion's Helmet
Brusef Amelion's Shielf
Circlet of Omnipotence
Circlet of Verdure
Cowl of the Druid
Dondoran's Juggernaut
Draconian Madstone
Escutcheon of Chorrol
Eye of Sithis
Hands of Midnight (x2)
Hands of the Atronach
Helm of Ferocity
Jewel of the Rumare
Knight of the Chorrol Armor
Knight of the Chorrol Shield
NPC Boots
NPC Ebony Armor
NPC Gauntlets
NPC Helmet
NPC Shield
Quicksilver Boots (x3)
Rasheda's Special
Ring of Desiccation
Ring of Detect Life
Ring of Eidolon's Edge
Ring of the Gray
Ring of the Oceanborn
Ring of the Vipereye (x3)
Ring of Transmutation
Ring of Wortcraft
Robe of Creativity
Sorcerer's Ring
The Deceivers Finery
The Deceivers Finers Worn Over Leather Armor
The Deceivers Finers Worn Over Steel Armor
Tower of the Nine (x2)
Veil of the Seer
Worn Ebony Boots
Worn Ebony Gauntlets
Worn Ebony Helmet
Akaviri Sunderblade
Antique Cutlass
Battleaxe of Hatred
Blackwater Blade
Blackwater Blade Reforged
Brusef Amelion's Sword
Calliben's Grim Retort
Captain Kordan's Saber
Cursed Honorblade of Chorrol
Dagger of Discipline
First Mate's Scimitar
Frostwyrm
Hatreds Heart
Hatreds Soul
Honorblade of Chorrol
Redwave (x3-
Rockshatter
Shadowhunt
Sinweaver
Sufferthorn
Witsplinter
Captain Rein's Skull
Drained Sigil Stone
Two-Headed Septim

Link to comment
Share on other sites

thanks, I did throw all the items into a formlist and added an inventoryeventfilter with the form list oninit. I will flip a switch and remove the form from the form list. It's a treasure hunt so you only need to find the item once. These items are being displayed in a dynamic book/checklist which also contains clues.

 

You can't remove editor-added forms from a formlist, only script-added ones. That's why I used a counter.

 

If you want to drive a book/checklist, you can create a second, empty formlist (or an array, but formlists tend to work better for passing information to various CK systems) and add the found forms to it as they're processed.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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