Saturday, November 6, 2010

Oblivion Observations

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...


  1. So let me see if I'm understanding this...

    Each time I want to look at Talitha's inventory:

    1) A container similar to a merchant's container is created in the cell we are currently in.

    2) Everything she's carrying is moved into that container and it opens for me like opening a chest in a dungeon.

    3) When I exit the container everything is moved back into Talitha's inventory and the container is removed from the cell.

    Is that the general gist of it? If so, that is indeed rather inefficient. But since an NPC's inventory is in effect a container itself, why not just access that container directly without all this moving? The devs really made that impossible to do?

  2. Well, the container isn't created on the spot - it's moved in and out using moveto commands and a sort of home marker... but aside from that, yeah; you've got the idea.

    OBSE may have some kind of command to do it, but no, there's nothing in the base engine itself to allow for directly accessing an NPC's inventory from within the game.

    Then again, considering CM requires OBSE, and still uses the moving container trick... I'm going to have to venture a guess and say that yes, it is patently impossible without rewriting parts of the engine itself.

  3. I'm confuzzed.

    "there's nothing in the base engine itself to allow for directly accessing an NPC's inventory from within the game."

    So when an Imperial Legion Soldier dies, why then can I take his stuff? Isn't that directly accessing an NPC's inventory? Or is it that only dead NPCs and creatures can be accessed? And if that's the case, seems like there should just be a script switch somewhere to turn on or off that would make accessing live NPC inventories possible.

    But then, why on Earth would they make it that simple? I know, I know...

  4. I misspoke.

    You can do it when they're dead. It's doing it via dialog when they're alive that's the bitch.

  5. That's nucking futs... Who in their right mind would write a game engine that forces you to jump through hoops to access a live characters's inventory? Heck, even Bioware didn't do that with Neverwinter Nights or Dragon Age (I don't know how they did things for Baldur's Gate, but then that game isn't easily modded).

  6. You can pickpocket a live NPC. Is there some kind of loophole there that can be manipulated? But you wouldn't want to have to be sneaking for it to work. I know CM Beast companions can only be communicated with in sneak mode, and I always thought that was kinda lame.

  7. Maybe you will crack and just rework the main engine and make life easy for you >.<

    This is why I hate the idea of trying to mod but I am debating to try to learn how to do quests as I would like to see more quests

  8. "Maybe you will crack and just rework the main engine and make life easy for you."

    Eh... not only is that above my pay grade, but modifying the executable is a hefty violation of copyright law, and we here at NosCo cannot afford to have our asses sued back into the stone age.