DeepBlueFrog Posted February 5, 2014 Posted February 5, 2014 I am running around in circles with CK and Papyrus, so I need to stop and first ask if that can be done at all. If I have an enchanted ring, with a script based enchantment, is there a way from that script to get a reference to the enchanted ring itself? I am looking at events for active magic effect and I was hoping the caster or the target when that effect starts would be the item itself but it turns out both caster and target actors are the NPC wearing the ring... not the ring itself.
jbezorg Posted February 5, 2014 Posted February 5, 2014 You can us GetWornForm() if you know in advance what slot the item occupies. http://www.creationkit.com/Slot_Masks_-_Armor int Property kSlotMask30 = 0x00000001 AutoReadOnly ; HEAD int Property kSlotMask31 = 0x00000002 AutoReadOnly ; Hair int Property kSlotMask32 = 0x00000004 AutoReadOnly ; BODY int Property kSlotMask33 = 0x00000008 AutoReadOnly ; Hands int Property kSlotMask34 = 0x00000010 AutoReadOnly ; Forearms int Property kSlotMask35 = 0x00000020 AutoReadOnly ; Amulet int Property kSlotMask36 = 0x00000040 AutoReadOnly ; Ring int Property kSlotMask37 = 0x00000080 AutoReadOnly ; Feet int Property kSlotMask38 = 0x00000100 AutoReadOnly ; Calves int Property kSlotMask39 = 0x00000200 AutoReadOnly ; SHIELD int Property kSlotMask40 = 0x00000400 AutoReadOnly ; TAIL int Property kSlotMask41 = 0x00000800 AutoReadOnly ; LongHair int Property kSlotMask42 = 0x00001000 AutoReadOnly ; Circlet int Property kSlotMask43 = 0x00002000 AutoReadOnly ; Ears int Property kSlotMask44 = 0x00004000 AutoReadOnly ; Unnamed int Property kSlotMask45 = 0x00008000 AutoReadOnly ; Unnamed int Property kSlotMask46 = 0x00010000 AutoReadOnly ; Unnamed int Property kSlotMask47 = 0x00020000 AutoReadOnly ; Unnamed int Property kSlotMask48 = 0x00040000 AutoReadOnly ; Unnamed int Property kSlotMask49 = 0x00080000 AutoReadOnly ; Unnamed int Property kSlotMask50 = 0x00100000 AutoReadOnly ; DecapitateHead int Property kSlotMask51 = 0x00200000 AutoReadOnly ; Decapitate int Property kSlotMask52 = 0x00400000 AutoReadOnly ; Unnamed int Property kSlotMask53 = 0x00800000 AutoReadOnly ; Unnamed int Property kSlotMask54 = 0x01000000 AutoReadOnly ; Unnamed int Property kSlotMask55 = 0x02000000 AutoReadOnly ; Unnamed int Property kSlotMask56 = 0x04000000 AutoReadOnly ; Unnamed int Property kSlotMask57 = 0x08000000 AutoReadOnly ; Unnamed int Property kSlotMask58 = 0x10000000 AutoReadOnly ; Unnamed int Property kSlotMask59 = 0x20000000 AutoReadOnly ; Unnamed int Property kSlotMask60 = 0x40000000 AutoReadOnly ; Unnamed int Property kSlotMask61 = 0x80000000 AutoReadOnly ; FX01
DeepBlueFrog Posted February 5, 2014 Author Posted February 5, 2014 Thanks... that will be helpful elsewhere but not in this case. The question above was a simplification of a problem I have with Mind Control. I want to get the object reference of the item attached to the mind control enchantment.I am trying to make it a full enchantment so I don't know in advance what slot it will be using (although now that I am writing this, I can tell which NPC is wearing it through a 'container changed' event... maybe I could use a keyword to identify the item... I need to think about that one more...).
jbezorg Posted February 5, 2014 Posted February 5, 2014 Loop through all the slots and test if there is an item. If there is an item, test if it has an effect keyword.
jbezorg Posted February 5, 2014 Posted February 5, 2014 int slot = 0 while i <= 32 armor nth = akTarget.GetWornForm( pow(2.0, i as float) as int ) as armor if nth & nth.GetEnchantment() == kMyMindControlEnchantment // do stuff endIf i += 1 endWhile
jbezorg Posted February 5, 2014 Posted February 5, 2014 Oh nice, you can actually swap enchantments on items. http://www.creationkit.com/SetEnchantment_-_Armor
DeepBlueFrog Posted February 5, 2014 Author Posted February 5, 2014 Base object though... not object reference .. so watch out for unintended consequences That also means I can't use that for freshly enchanted items. It works fine for the default mind control circlet, since the base object has the enchantment, but if I disenchant it and enchant a ring instead, the ring will not be detected as carrying that enchantment.
DeepBlueFrog Posted February 6, 2014 Author Posted February 6, 2014 In yet another wrinkle, I found that if I have a reference alias to an object with a script attached to the alias itself, the script will not work when I use the option to create the object dynamically when the quest starts. But if I set the alias to a unique reference selected from the viewer, the script will work without any issue.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.