Jump to content

Modding question about enchantments and references


DeepBlueFrog

Recommended Posts

Posted

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.

Posted

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
Posted

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...).

Posted


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

 

Posted

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.

Posted

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.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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