Skyrim

File information

Last updated

Original upload

Created by

ekroemer

Uploaded by

ekroemer

Virus scan

Safe to use

Documentation

Readme

View as plain text

###################################################################
# EK_RingLimiter #
# #
# a mod for wearing a user-defined number of rings #
###################################################################

IMPORTANT: - Make sure you have read the sections 'Technical Notes'
- I mean it!
- Especially concerning amulets!

DEPENDENCY: This mod needs SKSE version 1.6.3 or later!
In earlier versions the command RemoveSlotFromMask is
broken and you'll not be able to wear more than one
ring! Any SKSE version supporting Skyrim 1.8 will be fine.

NOTE: as of v1.0, whenever I say ring, I mostly mean ring/amulet!

-------------------------------------------------------------------
| Description |
-------------------------------------------------------------------

By popular (for some values of ;-) demand I've written this small
mod, that allows you to have more than one ring or amulet equipped
simultanously.

What's the difference to other Unlimited Rings mods out there?

1. While the basic mechanism that allows you to wear more than one
ring is the same one (namely: remove the ring-slot dependence of
the item), this mod adjusts rings on the fly instead of altering
them in the CK.
Thus rings from mods are covered, automatically, provided they
have the 'ClothingRing'-keyword set and you and I don't have to
worry about keeping the mod up-to-date.

2. The mod keeps track of the number of rings and amulets you have
equipped and will make sure you don't wear more than the number
you've defined.

-------------------------------------------------------------------
| Startup |
-------------------------------------------------------------------

As of version 0.6 as a safety feature ring slots are stripped
OnItemEquipped, too, so you most probably can skip the following
procedure:

The very first thing to do after activating this mod, is to drop
all the rings you have in your inventory and pick them up, again.

During pickup their slot dependency will be removed - only a ring
that does not occupy the ring slot can be worn as 2nd, 3rd, ...
ring.

-------------------------------------------------------------------
| Configuration |
-------------------------------------------------------------------

For configuration you can

- call the lesser power "EK_RingLimiter Configuration"
- use the MCM configuration menu "EK_RingLimiter"

There are only two variables to change:

set EK_GlobRingsAllowed to 2
set EK_GlobAmuletsAllowed to 1

Using the menu you can vary this variables between -1 and 20, where
-1 means 'unlimited'.

Using the console you can exceed this limit.

Via MCM you can switch off the lesser power configuration for a
less crowded magic menu, equivalent to

set EK_GlobGiveRHConfigPower to 0

-------------------------------------------------------------------
| Technical Notes |
-------------------------------------------------------------------

********************** Topic 1:

Changing ring characteristics on the fly, namely stripping the
item's dependence on the ring slot is convenient and has its
advantages, mainly: the mod is maintenance-free.

Tests seem to indicate and purplelunchbox has confirmed that these
changes are _not_ stored in the savegame so there are no
concerns regarding de-activation, either.

Just in case some other mod needs the ring slot to be set, the mod
works in the following way:

* A ring is stripped of its slot when picked up (OnItemAdded).
* The slot is added when the ring is dropped (OnItemRemoved).

This is true whether the slot has been there (Vanilla) or not
(conventional UnlimitedRings mods).

* Using the menu you can add the slot dependence to all rings in
your inventory.

This should cover most of the cases that can possibly occur.

********************** Topic 2:

Keeping track of rings worn is done efficiently using On(Un)Equip
blocks.
I have always been slightly worried the game might loose or delay
events occasionally, and first reports seem to indicate that this
may indeed lead to inconsistent behaviour, mainly when
- you're playing on a lower end rig and/or
- you are using a multitude of script heavy mods.

The problem is the following:

- Papyrus events (here: OnItem(Un)Equipped) are _scheduled_ by an
outside action (here: user clicking).
- The event is _processed_ some time later. You don't have any
influence over the time of processing or (as events are
processed in parallel threads) even about their order.
- So, when you are rapidly clicking, you may initiate two
OnItem(Un)Equipped events, that run overlapping (the second
starting while the first one has not yet finished).
- Now we run into a typical problem of parallel programming: more
then one thread wants to modify the same thing.
- In my mod a typical sequence is
(1) read the actual number of equipped rings from a global
variable GLOBAL into a script-local one
(2) de/increment the local variable
(3) write the incremented value back to GLOBAL (to save for
later use).
- Now picture 2 threads A, B doing these steps simultanously:
you might end up with a situation where
o A reads GLOBAL
o B reads GLOBAL
o A writes GLOBAL
o B writes GLOBAL
thus effectively dismissing A's work, so you might have
the ring A equipped but not registered as worn.
Later on you might unequip the ring and this action might be
registered, thus even enabling negative ring counters.

What's the solution?

- The first is simple: when clicking, simply wait until your
action registers before clicking again.
You'll get a message in the left upper screen corner when
your ring load is changed.
Sadly, I've seen occasions when messages sent do not appear.

- I've built in a safety census activated once a minute that'll
reset your absolute ring-count, thus overwriting the
incremental result from the event blocks.

It is, however, possible that this census is running
simultanously to you (un)equipping a ring, yielding an outdated
result.
You might notice this but it shouldn't lead to problems: no
rings are unequipped automatically and the count will most
probably be corrected with the next census (until you're
unlucky enough to (un)equip right then, again ;-)

- For those with underpowered rigs: you can set the maximum
number of wearable rings to -1 (minus one). In this case
I've disabled bookkeeping completely, you can wear an
unlimited number of rings because they are still slot-stripped.

********************** Topic 3:

Amulets are a sore point:
Identification is via the keyword ClothingNecklace, but
- (religious) Amulets don't have this keyword, so they are not
handled.
However, winterlove tells me that the USKP patch 1.2.7 adds
the ClothingNecklace keyword to a lot of items.

- Cloaks from Cloaks of Skyrim _do_ carry the keyword, so they
are handled even if they shouldn't be.
The reason for this seems to be that this way they can be
enchanted, so as of version 1.01 I extended the ring/amulet
recognition:
now, in addition to the correct keyword, the item must occupy
the correct slot (0x40 for rings, 0x20 for amulets) or none.
So cloaks, occupying other/additional slots, won't be taken for
amulets despite the keyword.

-------------------------------------------------------------------
| Known Issues |
-------------------------------------------------------------------
As soon as you have reached the limit of simultanously wear-able
rings any attempt to equip another ring will fail.

But:
* The graphical equipment menu is not immediately updated, so the
new ring will falsely stay 'ticked'. Re-opening the menu or
(de)activating another item will show the ring correctly
unequipped.
* Decreasing EK_GlobRingsAllowed below the number of the rings
worn at that time won't have an immediate effect. Any attempt
to put on a ring will fail until you've manually unequipped
enough rings to fall below the treshold.

I've made no effort (nor will I ;-) to show the additional equipped
rings on the character's fingers.

-------------------------------------------------------------------
| Compatibility and Interplay with other Mods |
-------------------------------------------------------------------

* You can use this mod together with an unlimited rings mod.
The only reason for this would be to wear more than one amulet
until EK_RingLimiter will handle this, too.

However, any ring you drop will get its ring slot back. After
that the other unlimited rings mod will stop working with this
ring because the change it made to the ring will be overwritten.

* There may be other mods that change the ring slot dependence for
their own purposes (I don't know any). This mod may prevent such
a mod from working.

* You might want to use USKP patch 1.2.7+ for a wider range of items
working correctly (especially amulets)

* Cloaks of Skyrim adds the ClothingNecklace keyword to its cloaks
to enable cloak enchanting; should be handled as of v1.01

-------------------------------------------------------------------
| Installation/Update |
-------------------------------------------------------------------
Unzip into ${SKYRIMBASE}/data/, activate.

There are the files
EK_RingLimiter.esp
EK_RingLimiter.bsa
EK_RingLimiter.txt

Remove these files for de-installation.

Update simply by overwriting.

After an update you may have to wait for the safety census
(every minute) for incorrect counts from a safegame to be corrected.

-------------------------------------------------------------------
| Version History |
-------------------------------------------------------------------
v0.5: - Initial release
v0.6: - Allowed -1 (meaning unlimited) as max number of rings,
so you can still use part of the mod when your machine is
struggling with script lags.
- Ring slots are now re-stripped at OnItemEquipped as it
seems the changed slot is not saved into the savegame.
v0.65: - Some script cleanup to prevent warning messages appear
in Papyrus.log* in case you have activated debug messages
in Skyrim.ini.
v1.0 - Handles necklaces/amulet (with all caveats detailed above)
v1.01 - Changes in the ring/amulet detection for better
compatibility with Cloaks of Skyrim and other mods that
abuse the ClothingRing or ClothingNecklace keywords.
v1.02 - added MCM configuration menu

-------------------------------------------------------------------
| Credits |
-------------------------------------------------------------------
I'd like to thank

- as always the SKSE team: without you this would not be possible
- Maegfaer for pointing me RemoveSLotFromMask and other advice

-------------------------------------------------------------------
| Legal |
-------------------------------------------------------------------
There's no point in trying to protect published sourcecode from
being used and it wouldn't be my style, anyway, because I've
learned a lot by looking at other people's scripts.

So, you're welcome to use this or parts of it in your work.
You could then, however, do me the favour of
- notifying me if you find any bugs or have suggestions for
improvements
- pointing me to your work, so I can have a look at it and adopt
back what I like about it.