QUOTE(MrSly @ Nov 10 2008, 11:01 PM)

Ok, I've made a spell that unequips everything from the target. So far, so good, Nude People. Now I need to know how to loop through all of the items in the target's inventory so I can DROP them. I know I've seen it before somewhere, but can't remember where. It looped through the inventory, got the ID's, then the number of each item, then issued a "DROP ID Number" command.
Oh, and I don't want to have to use the OBSE for this. Trying to make it vanilla compatible.
Thanks for any help...
I am not completely sure how the mechanics work, but I think the game itself logs the inventories of the entities. Wouldn't that be possible to read the inventory ID of the NPC, and loop the contents of it.
However, I never imagined that this could be done without OBSE since I can't remember any vanilla NPC ever to drop anything, so I am assuming that the dropping command is only written for the player in the vanilla. However if there is such NPC action in the original game, you can use that for reference. As for looping the command on the inventory, could it be possible to use the same principle as you use for unequipping the NPC:s? The other option is to not to drop them, but to spawn the items, and then deleting the inventory. Somehow the looping trough the inventory seems so elementary basic to do, yet I can't get my finger on how to do it (I wonder if you could solve this problem by regressing temporary to newbie modder and rethink it therefore from different view. How do you initially loop any list? If there is one, or more, items in the inventory, read the ID of the first item in the inventory and drop it, then recheck the amount of the items in the inventory, since you already may unequip the apparel you have to know how to read the inventory, no? Although, this might also confuse you even more if you don't catch my drift on here... and besides I only know the theory of coding).
However, I just figured that this might have interesting effects on some NPC:s (for example daedra), that have their organs in their inventories. Would this spell kill them, or just ignore the organs (and maybe the quest items too, since otherwise it would become too easy to make some quests).