Jump to content

How to use WornObject's methods from SKSE?


Recommended Posts

Hello! I'm trying to make use of GetEnchantment(Actor akActor, int handSlot, int slotMask), SetEnchantment(Actor akActor, int handSlot, int slotMask, Enchantment source, float maxCharge), and CreateEnchantment(Actor akActor, int handSlot, int slotMask, float maxCharge, MagicEffect[] effects, float[] magnitudes, int[] areas, int[] durations), but I can't make it so that it only accepts a handSlot.

 

I've tried this:

myEnchantment = WornObject.GetEnchantment(wiseman, 1, none)

 

I'm essentially trying to get the enchantment of my right-hand weapon, but the method requires SlotMask to be not none, otherwise I get an error. What is the right way to use this method from the WornObject script?

Link to comment
Share on other sites

Try this:

myEnchantment = WornObject.GetEnchantment(wiseman, 1, 0)

There's some documentation in the WornObject.psc source: "Use zero when using hand slot"

A word of caution - using SetEnchantment() to set an enchantment to None (remove it) seems to cause a CTD if there's no enchantment there to remove.

Link to comment
Share on other sites

Same idea, reversed:

Actor actorRef = Game.GetPlayer()
int slotMask = Armor.GetMaskForSlot(30) ; head

; get the enchantment on the item at this slot
Enchantment ench = GetEnchantment(actorRef, 0, slotMask)

; remove the enchantment on the item at this slot
if ench != None
SetEnchantment(actorRef, 0, slotMask, None, 0)
endIf

Basically, it ignores the hand slot parameter if you specify a non-zero slot mask.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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