After a particularly inspiring chat with my muse/co-scripter/reason for not being dead earlier this evening, I decided to push my Oblivion companion work a bit further. I'd thus far been tinkering with a new companion system of my own devising, but I've now shoved that plugin aside and started in on a new one centering around my favorite companion, [CENSORED].
I'm implementing not only my testing stuffs for possible future use in a CM modification... but also some goodies that I want just for me and may well never see the light of upload.
While setting up some basic dialog, I saw just how truly fucked Oblivion is, as far as companion makers are concerned. I had known FO3 was a step up; but not this big a step.
In FO3, when you wish to access a companion (or any other NPC, for that matter)'s inventory, you simply set them as a teammate and use an openteammatecontainer call.
I was setting up the inventory share dialog in the new plugin, and couldn't recall Oblivion's function for said calling. I got to reading the CS wiki. It turns out I couldn't remember the function to call because there isn't one.
Oblivion has no provision whatsoever for directly accessing an NPC's inventory.
I'll say that again: None.
But Nos, you say, CM does it! All those companion mods do it. There must be a way.
Oh, there is, but it redefines the term 'needlessly convoluted'.
In Oblivion, to access companion inventory, one must have created a container for said NPC. Container must be moved to the same cell as the player, all NPC inventory transferred to container. Container then force-activates the player. Inventory share what-have-you commences. Container's inventory is then dumped back on to NPC, and an item added, equipped, and removed to force an equipping update. Container is then moved back to its home cell, to await the next call.
Now, this means one of two things, as far as I can see.
1) Bethsoft devs are the most oblivious people to ever create a game, and never looked farther than the end of their own noses.
2) Bethsoft devs legitimately thought that players would never need to access an NPC's inventory for any reason.
I had always thought they considered companion NPCs to be an afterthought... but damn.
I knew this was going to be a pain, but I was hoping it wouldn't be this much of one...