Jump to content

Strategy for companion control and fixing


Recommended Posts

Greetings, peeps who know 10,000% more about this stuff than I do! I've been poring over Oblivion scripting tutorials, but they're not much help for this (just how to add objects and spaces and scripts fired by them, mostly).

 

I want to build a mod that determines whether NPCs are companions/followers (by various criteria), and if so, periodically does things with them, like reset stats that keep "migrating", fix the "angry face" bug on them (where companions look angry if they took damage for any reason like a steep jump), make sure they stay in follow mode if you didn't manually take them out of it, and so on, make sure they are not unarmed and unarmored if in the outdoors or a dungeon, etc. Would also like to apply this stuff to horses, e.g. keep them in stay-here mode or in follow mode instead of changing from one to the other for no apparent reason (and I really want to prevent them ever following into cities and buildings which keeps happening), but the horse thing may be a separate project.

 

I can think of multiple approaches to this, and I don't know which is best:

 

1) Use a hidden quest to run a script every 5 sec. or so that does this stuff.

1a) Have it keep a list of the NPCs in question in an array - "do these checks and fixes for this set of NPCs I have detected as companions"

1b) Have it keep a list as an external INI file that is written out when it changes, the way Menu Marker Overhaul saves out its list of markers.

1c) Create a bunch of variables, one for each affected NPC (myModCompanion001, etc.)

1d) Have it operate only on-the-fly: "I detect that this NPC is a companion, so apply these checks and fixes."

2) Depend on an in-inventory item (hidden) that declares "this NPC is a companion according to this mod, so apply the checks/fixes".

2a) Run the check/fix script every X amount of time on everyone with that item.

2a1) Globally

2a2) Only in current cell

2b) Run it only when engaging in dialogue

3) Have script effect as a lesser power or something that one casts to apply the checks/fixes

4) Trigger the checks/fixes on cell load.

5) Probably others.

 

I have no idea what the efficiency and practicality consequences of any of these options are.

 

So far, I can't find any tutorial info on:

* How to create hidden quests, and when doing so is/isn't a good idea for using a "quest" (in the code sense, not the roleplaying sense) as a way to do timed (default: every 5 sec.) scripts.

* How to determine if an NPC is in possession of a particular item.

* How to determine if an NPC is in follow mode.

* How to create arrays of variables.

* How to read/write INI files and the like.

* How to determine whether a change of state (e.g. from follow to wander) was initiated by the PC or by something else.

* How to address an NPC ID such that if one's mod load order changes, the scripting can handle it (it occured to me that if a particular NPC's instance ID is something like 06002D7A, they might end up being 07002D7A the next time you loaded the game if you added another mod and BOSS put it before that companion mod). If this is an intractable problem, at least need to be able to detect that something changed and that the companion list needs to be rebuilt.

* How to trigger things based on possession of an item versus picking up the item or equipping it (e.g., have a certain spell/script effect available on nothing but the basis that you have item X in your possession - or, rather, NPC having a scripted effect because they have something in inventory).

 

I DID find info on how to figure out if someone's in a faction, what their Disposition is, etc., and info on how to trigger scripts by taking or equipping an item, so I'm not UTTERLY lost. Plus I learned how to make switches and put them in rooms, and make rooms and doors, and create regular quests, and NPCs, and all else the tutorials covered. I'm just lost about doing what I actually want to do!

 

I have no real experience modding Oblivion, just Morrowind (a little, and mostly for OpenMW with OpenMW-CS - I'm on a Mac and play Oblivion in a VM). I have not used TES4CS much. All the Oblivion mod editing I've done has been with TES4Edit (which seems great for some things and really tedious for others) and TES4Gecko. I've got an idea how TES4CS works just from reading lots of tutorials today, so I'm not worried about it. I pick stuff up fast (e.g. I've already produced some graphical patches for several broken-texture or broken-mesh mods, plus some reskins, with NIFSkope in an hour or less yesterday after never having used NIFSkope in my life before).

 

Anyway, here are the very specific goals so far:

* Produce a companion list with names, IDs and possibly other info, both for the mod scripting and for player reference (and later scripting of other sorts).

* Detect companions/followers by multiple means: follow mode, Player faction membership, player ownership of animal (or person for that matter), specific "you have me as a companion" variables in hand-coded companions that are well known (e.g. Vilja), specific items used by particular mods for IDing companions (Duke Patrick's Friendship Ring for Companion Detection, and an invisible similar thing in AoG), vanilla quest scripting that makes someone a follower NPC for a specific purpose, and general NPCs turned into companions by various mods that specialize in that (they each likely have a particular way of marking NPCs as companions).

* Auto-fix the "angry face after any damage" thing.

* Set a baseline Disposition (default 89) to prevent the "creepy companion grin" bug. While Wrye Bash and some other stuff MOSTLY fixes it, it still occurs sometimes, especially with custom races, and the setting minimum smile distance to -1 is a crude hack which makes everyone look expressionless all the time (unless genuinely angry and scowling).

* But have a way to exclude particular NPCs from this Dispo limit, e.g. romanceable companions with whom a 100 Dispo is important.

* Also do not set it to 89 if was lower and has never been as high as 89 (e.g., you just met).

* But set it back to 89 if it drops because of friendly fire, etc. (especially important on slower machines, where fights with multiple combatants can lag bad enough that you end up doing two hits after the enemy is already dead, probably with a companion receiving the blows).

* Force particular stats to be set to particular minimums and/or maximums, across the board or on a per-companion basis, to work around both "bouncing stats" bugs and recalcitrant companion mods that keep doing dumb things like resetting Blade skill to 200.

* Fix companions who have dropped out of follow mode for no reason.

* Fix companions who have entered follow mode for no reason (same with horses, especially).

* Fix companions stuck in Sneak mode or weapon-out mode.

* Upon game start-up, apply various checks and fixes of this sort to ALL companions, whether present in the cell or not, whether following or not.

* Distinguish between YOUR companions and NPCs simply available as companions (like CM Partners you haven't even talked to yet).

* Account for companions you've dismissed (e.g. "Break Up" option in CM Partners), and exclude them henceforth.

* Include pet creatures, too. Lot of us have dogs and cats and so on from various mods.

* Have all this stuff be INI configurable (some people may want to manually "work" companion

Dispo as a roleplaying thing, while for others having to deal with it is a tedious hassle).

* Have at least some basic features work without OBSE if possible.

 

I can think of lots of other stuff, but these are what I want to address first (problem-solving rather than feature-adding). One feature idea is universal parties, so non-CM and CM companions can all be managed at once, at least for basic "follow" and "stay" commands.

 

PS: I'm the type to read forums and tutorials and documentation and scripts themselves, and not ask for advice. So, me asking for advice here is a mixture of humility and desperation. I really have no idea how to do this stuff yet, but badly want to do it, not just for my own gaming sanity but because it should make companion management easier for a large number of players, even if it's just built one feature at a time over a long stretch. This game takes forever (even compared to Morrowind) so there's no hurry. :-)

 

I also care little about kudos and glory, and am perfectly happy if someone else says "I know how to do all that and can whip it up by tomorrow", though I would hope the licensing restrictions were very lax (i.e. "just give credit"). I do everything as dual-licensed under GPL and Creative Commons Attribution-ShareAlike, to get away from the destructive early-2000s "don't you dare do anything with MY mod" trend, which has had a lot of cascading negative effects over time. Basically, I'm just very open-sourcey and like to encourage that view, since we get better gaming out of it in the long run.

 

Many thanks in advance for any tips, pointers, snippets, warnings, clues. I hate being a cluebag at this, and yearn for competence!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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