In a mod I am developing, one stage of the quest has the PC recovering property that belongs to several NPCs, from an intermingled container. I plan to have a message box when the PC activates the container which asks if they want to return the items to the NPCs. If the PC says no, then the container thereafter behaves normally, and the items within are available for looting as usual. If the player says yes, however, I need to distribute the items to the NPCs that I have previously defined as the owners.
I'm an experienced programmer in other languages (Java, PHP, SQL, etc.), but relatively new to TES scripting. So I'm not asking for detailed syntax advice here, just a guideline on what general *approach* to take with "tagging" the items in the common container.
My initial thinking is that the items need to exist outside the container at stage 1 of my quest, because I don't *think* you can set ownership on an item added directly to the container in the CS, right? So I'll put them all on a table or something and then have a script move them into the container (once) at the first step of the quest, and set their ownership just before doing so. I assume I can set owner on a reference, without having to make a custom object, right? I would hate for every instance of "torch" and "iron dagger" to have to be a custom object.
Is there a better way to do this? Will what I propose even work?
Thanks!