Oblivion Mod:Cobl/Projects/General Signals

A UESPWiki – Sua fonte de The Elder Scrolls desde 1995
Cobl: Old Project Page: This is an old and now inactive discussion article for a Cobl project. If you have questions about this or other Cobl projects, do not edit this page, but instead discuss it at the official forums on Relz topic.

Goals

To provide for communication between mods through signal globals, quest variables and factions.

Signal Type Overview

There are several ways to define signals, each has its advantages and disadvantages...

Globals

  • Summary: Good if signal does not require different states for different NPCs and/or creatures. I.e., good for conditions that apply only to PC, or apply to a location.
  • Can be float or integer. Integers are not reliable at higher values because they're actually stored as floats.
  • Has least performance hit of various options.

Quest Variables

  • Summary: Similar to global variables, but better for groups of variables.
  • Good if there are many variables that naturally belong in a group.
  • It's the only way to store reference variables.

Reference Variables

  • Similar to quest variables, but with some pluses/minuses. Probably best to use quest variables in almost all cases.
  • Needs three elements (script, base object, reference) vs. two (script, quest) for quests.
  • Quest variables can be initialized more easily, but quests take up a little more processing time (probably negligible though).
  • Quest variables are reset if the quest is turned off. But so long as no one turns off the quest (which is unlikely to happen accidentally) this isn't a problem.

Factions

  • Good if signal is faction-like. (I.e., applies to some npcs, creatures, but not others.)
  • Can be applied to PC, NPCs and creatures.
  • Allows numeric value in range of -1 to 127(?)
  • Can be used to affect disposition of PCs/Creatures. (However, this requires that the factions of those other creatures also be altered.)

Spell Effects

  • A spell effect can be applied to an npc or creature. This can be tested for with the IsSpellTarget script command.
  • Summary: If possible, use a faction instead.
  • Pro: Can be made to time out automatically
  • Pro: Can include visual effects.
  • Pro: Abilities get copied to clones and seem to be permanent (tested)
  • Pro: Spell effects can mark containers (although nonscript-token might be better)
  • Con: Only provides binary information (whether the spell is present or not).
  • Con: Likely has additional processing overhead compared to a faction.
  • Con: Abilities apply to the base actor (AddSpell->Base, Cast->Ref)

Proposed

Inventory Tracking

Incorporate the Inventory Tracker mod into COBL. Every two seconds IT takes a snap-shot of the player's inventory. Any changes are stored as references and counts that you can retrieve. In v1.02 these lists of changes were stored on linked lists using tokens - I tried to make that as easy as possible, but the background of it isn't straightforward. In the Pluggy version, I use Pluggy so the lists are really lists (IMG:style_emoticons/default/smile.gif) That is, if the player has lost 10 Iron arrows, all 5 of their Restore Health potions and gained 10 Apples in the last 2 seconds they will show up on the 5 arrays as:

New array - empty
Added array - empty
Increased array (ref) - Apple
Increased array (count) - 10
Removed array - Restore Health potion
Decreased array (ref) - Restore Health potion, Iron arrow
Decreased array (count) - 5, 10

Then you have another 2 seconds to look at these arrays and do whatever you want. The snapshots are taken in GameMode and most MenuModes, so it should be pretty flexible.

Both have been used without problems for a while now. As for size, the non-Pluggy version is rather hefty at ~900k unpacked while the Pluggy version is only ~5k (9k packed).

I'm not sure if I would offer both versions or not, and may only allow the pluggy version. It is a much faster way and is in a technical sense safer, but OTOH I can offer both without to omuch problem.

Sounds good. I would probably prefer to only have the pluggy version. Easier maintentance, and I think that only OBSE users would be using this functionality anyway. --Wrye 00:01, 27 March 2008 (EDT)
Pluggy-only it is, then. If I remember correctly I need to update it to use some new Pluggy functions, but otherwise I should have it ready in a couple of days after I send you the preliminary RUE (should be no later than this weekend).--Haama 00:10, 27 March 2008 (EDT)

Suggested

Prior discussion: Wipz topic.

PcFakeLife

  • global bool
  • Player is in some sort of fake life situation (is a ghost, in a dream, etc.)

In Progress

PcFormVars (Morph)

  • quest with common variables
  • Holds variables related to player disguises and shape shifting.
  • External Variables:
    • curId: Unique numeric identifier of current form.
    • curDoppleRef: If player is doppelganger of an npc, this is a ref to that npc.
  • Internal Variables
    • curCrimeGold: Crime gold of current form.
    • curCrimeGoldSE: SE crime gold of current form.
    • curFame: Fame of current form.
    • curInfamy: Infamy of current form.
    • nextId: Id to be used if a new identity is created. Should/will be incremented by one after being used.

Currently in development to provide a common basis for shape shifting mods (currently just Breeze582000's Succubi/Seducer's mod, and Wrye's Morph mod (dervied from Breeze's mod). Since the mods are still in beta, they'll probably need to progress a bit more before the design is stablilized. --Wrye 23:00, 30 October 2007 (EDT)

Accepted: This was mentioned several times on the forum and then released in version 1.12. Probably still needs some development though, depending on needs of Breeze and Wrye's respective morph mods. --Wrye 18:41, 10 January 2008 (EST)

Completed

Following signals have been implemented. For usage info, see Modders/Signals.

ActorNoMove

  • faction bool
  • Actor is protected against repositioning spells.

Needed to prevent scripted actors or actors checked for cell-conditions via quest scripts (like volendrung : free ogers in cave) to prevent from being moved and therefore circumventing or breaking original scripts/quests.

SpellMods that use these teleport functions are MidasMagic, SupremeMagicka and a whole bunch of mark&recall uses in smaller mods (teleporting back home for example). COBL-AfterDeathHandling could use it to prevent teleportation as well as any quest to insure not getting teleported out of protected environments. --Scanner (forum post)

Agree: --Wrye 03:36, 29 October 2007 (EDT)
Agree: --Dev akm 13:26, 1 November 2007 (EDT)

Implemented as cobFactNoMove in version 1.11 --Wrye 00:20, 24 December 2007 (EST)

ActorNoTransform

  • faction bool
  • Actor is protected against transformation spells.

Proposed: Needed to prevent using SetScale or polymorph scripts on the actor. SetScale might be done only once and shouldn't be mixed and polymorph to different states (from same or different mods) might not be wanted.

Midas Magic has SetScale magic and will use polymorph. Smaller mods use SetScale spells. There are needs for werewolf, lich and other transforms. But different mods of this kind can't recognize each other states of transformation. This will simply prevent a second transformation or make creatures immune for all those mods. --Scanner (forum post)

Agree: --Wrye 03:36, 29 October 2007 (EDT)
Agree: --Dev akm 13:26, 1 November 2007 (EDT)

Implemented as cobFactNoTransform in version 1.11 --Wrye 00:20, 24 December 2007 (EST)

CompNoFollow

  • global bool
  • Companions should not follow player. This is mostly to prevent companions from teleporting into a situation where they shouldn't go.

Proposed --Scanner (forum post)

Agree: --Wrye 03:36, 29 October 2007 (EDT)
Agree: --Dev akm 13:26, 1 November 2007 (EDT)

Implemented as cobSigNoCompFollow in version 1.11 --Wrye 00:20, 24 December 2007 (EST)

OBSE and SI detectors

There are ways of detecting whether the player is using OBSE and/or SI without making COBL dependent on either. (If you're interested, here's the "how-to"s.) The Alchemy Sorter already uses the tricks, so the first question is whether to include them in COBL Main.

The next question is how to implement them: I have them set up as result scripts so they can be used instantly, but they need to be used each time you need to tell if the player is using OBSE/SI. Another method would be to set up quests that set a global flag, and let modders just check the globals. I prefer the result scripts, but that's because I'm ultra paranoid (there are 5 whole game seconds where it matters :P). The second is easier for modders to use, though.--Haama 13:14, 24 December 2007 (EST)

Proposed:

Agree: Haama has already done an implementation, and I expect to include that along with Haama's OBSE Alchemical Sorter upgrade. --Wrye 18:41, 10 January 2008 (EST)

Implemented as cobSigSe and cobSigSi in version 1.16. --Wrye 22:24, 18 January 2008 (EST)

PcNoNeeds

  • global bool
  • Player's needs (hunger, thirst, sleep) are suspended. (Note that this must be set separately from PcFakeLife.)

Proposed --Scanner (forum post)

Agree: --Wrye 03:36, 29 October 2007 (EDT)
Agree: --Dev akm 13:26, 1 November 2007 (EDT)

Implemented as cobSigNoPcNeeds in version 1.11 --Wrye 00:20, 24 December 2007 (EST)

PcNoTeleport

  • global int
  • Player not allowed to teleport (mark/recall, etc.) into or out of location.
  • The difficulty of getting out is specified by a level of 1 to 5.
0: teleport allowed
1: Basic teleport (mark/recall) disallowed.
5: God level teleport disallowed.

Proposed --Scanner (forum post)

Agree: --Wrye 03:36, 29 October 2007 (EDT)
Agree: --Dev akm 13:26, 1 November 2007 (EDT)

Implemented as cobSigNoPcTeleport in version 1.11 --Wrye 00:20, 24 December 2007 (EST)

WeatherIsFixed

  • global bool
  • Scripted changes to weather not allowed.

Proposed --Scanner (forum post)

Agree: --Wrye 03:36, 29 October 2007 (EDT)
Agree: --Dev akm 13:26, 1 November 2007 (EDT)

Implemented as cobSigNoWeatherScript in version 1.11 --Wrye 00:20, 24 December 2007 (EST)