Help requested: script mechanism for slot usage

Post » Sun Nov 18, 2012 4:35 pm

Hi there,

when you look at the unlimited rings/amulet mods out there, they all seem to manually remove the item property ('uses ring-slot' / 'uses amulet-slot') which is suboptimal for a number of reasons:
  • only vanilla items are handled,
  • creating and maintaining such a mod is tedious,
  • slot dependence removal plays havoc with scripted attempts to identify an object by the slot it uses (item keywords are not reliable).

Can you think of a way to shortcut the slot-occupation mechanism dynamically using Papyrus, for example something like
  • strip the item slot dependence in an OnEquip block or
  • prevent the game from unequipping a previous ring when equipping a new one?
I've no idea if something along these lines is possible, but using these one could build a lean mod allowing to equip a configurable number of items simultanously (surely one could wear 2 cloaks... ;-)

Any ideas on alternatives?
User avatar
Ridhwan Hemsome
 
Posts: 3501
Joined: Sun May 06, 2007 2:13 pm

Post » Sun Nov 18, 2012 11:04 am

SKSE provides such a function:

http://www.creationkit.com/RemoveSlotFromMask_-_Armor

But remember that if you do this in an OnEquip Event the ring will be equipped before it's slot is changed. Assuming that this won't cause instability, you should probably do a scripted re-equip of the ring. Or make use of an OnItemAdded Event to remove the slot mask the moment it gets added to the player's inventory.
User avatar
Michelle davies
 
Posts: 3509
Joined: Wed Sep 27, 2006 3:59 am

Post » Sun Nov 18, 2012 11:47 am

Thank you very much for your answer, Maegfaer,

it seems, this is possible, after all.

I wrote the script below that keeps track of the number of equipped rings (seems to work ok) and dynamically removes (OnItemAdded) or re-adds (OnItemRemoved) the ring slot dependence from the item, as you suggested.

Spoiler
Scriptname EK_RingHandlerWatchDog extends ReferenceAliasImport Armor;;;; bind to external parameters -------------------------------------------->; player aliasReferenceAlias Property EK_PlayerAlias Auto; maximum/current ring numberGlobalVariable Property EK_GlobRingsAllowed		  AutoGlobalVariable Property EK_GlobRingsEquipped		 Auto;;;; bind to external parameters --------------------------------------------

Ring slot in CK is 36, so RemoveSlotFromMask(0x00000040) should be correct?
Problem is: GetSlotMask() returns 64 (0x40) before and after the calls RemoveSlotFromMask or AddSlotToMask.

So these are not working? I'm still using SKSE 1.5.09. Do you see something amiss?
User avatar
Daddy Cool!
 
Posts: 3381
Joined: Tue Aug 21, 2007 5:34 pm

Post » Sun Nov 18, 2012 2:55 am

You should only use decimal integers as parameters I think.
User avatar
Bryanna Vacchiano
 
Posts: 3425
Joined: Wed Jan 31, 2007 9:54 pm

Post » Sun Nov 18, 2012 6:11 pm

That doesn't seem to work, either, even in 1.7 Skyrim with SKSE 1.5.11 :-(
User avatar
Rachel Hall
 
Posts: 3396
Joined: Thu Jun 22, 2006 3:41 pm

Post » Sun Nov 18, 2012 2:28 pm

Best ask the SKSE team then how to properly use it.

Btw, why do you have Import Armor at the top of your script?
User avatar
Annick Charron
 
Posts: 3367
Joined: Fri Dec 29, 2006 3:03 pm

Post » Sun Nov 18, 2012 3:40 am

Yes, I just asked there.

Maybe the Import Armor is not strictly necessary but e.g. GetSlotMask
  • comes from Armor.psc and thus without import I'd have to call it using a syntax Armor.Function
  • and is a method instead of a function (or whatever the correct designation is), so it has to be called ArmorProperty.GetSlotMask() instead of GetSlotMask(ArmorProperty).
Maybe something like Ring.(Armor.GetSlotMask()) would work but it's so ugly I didn't try it ;-)
User avatar
Conor Byrne
 
Posts: 3411
Joined: Wed Jul 11, 2007 3:37 pm

Post » Sun Nov 18, 2012 5:37 am

Maybe something like Ring.(Armor.GetSlotMask()) would work but it's so ugly I didn't try it ;-)

The fact that Ring is an object of Armor type automatically opens up all functions from the Armor script to that object (excuses for unprofessional choice of words). Ring.GetSlotMask() will work without an import of Armor.
User avatar
Tinkerbells
 
Posts: 3432
Joined: Sat Jun 24, 2006 10:22 pm

Post » Sun Nov 18, 2012 6:39 am

Hmmm, I tried this and it seems you're right.

I could have sworn that on many occasions I had gotten compiler errors telling me there was no such thing as XXX for type YYYY and an import of YYYY had fixed this. I even seem to remember people being told in the forums to use import...

Whatever, today it works without :-)
User avatar
Captian Caveman
 
Posts: 3410
Joined: Thu Sep 20, 2007 5:36 am

Post » Sun Nov 18, 2012 4:45 pm

Just fyi: over in the SKSE thread ianpatt told me that RemoveFromSlotMask was not working correctly atm but would be fixed in the next release.
User avatar
C.L.U.T.C.H
 
Posts: 3385
Joined: Tue Aug 14, 2007 6:23 pm


Return to V - Skyrim