SetEnchantment() on staves

Post » Wed Sep 03, 2014 2:15 pm

I tried to do this to see if it works by making a script that apply an enchantment to an unenchanted staff I equip. The enchantment hot applied, but the staff has no MAXIMUM charge (it seems it doesn't even have a charge bar) so I can't cast the spell unless I have TGM on.

Any workaround around this ? I tried setEnchantmentCharge but it does nothing as it affects the current charge instead of the Max and the item is recognized by soul gems when trying to use them.

User avatar
Soku Nyorah
 
Posts: 3413
Joined: Tue Oct 17, 2006 1:25 pm

Post » Wed Sep 03, 2014 5:51 am

I don't think there's currently a function to change the maximum charge used by a base form/weapon. However it would probably be pretty easy to do, so you could request one in the SKSE thread if you want it.

There is a workaround, though, in the meantime -- you can use WornObject.SetEnchantment() to add an enchantment only to that specific staff you are holding (instead of editing the enchantment used by all staff weapons of that type). SetEnchantment lets you specify a maximum charge when you use it. It would look something like:

;slot valuesint  property  LEFT_HAND   = 0  autoreadonlyint  property  RIGHT_HAND  = 1  autoreadonlyint  property  WEAPON_SLOT = 0  autoreadonly;weapon typesint  property  STAFF_TYPE  = 8  autoreadonly;energy valuesfloat  property  PETTY_SOUL   = 250.0  autoreadonlyfloat  property  LESSER_SOUL  = 500.0  autoreadonlyfloat  property  COMMON_SOUL  = 1000.0 autoreadonlyfloat  property  GREATER_SOUL = 2000.0 autoreadonlyfloat  property  GRAND_SOUL   = 3000.0 autoreadonlyEnchantment property SomeCoolEnchantment autoActor       property PlayerRef           autoFunction YourFunctionHere()    if (PlayerRef.GetEquippedItemType(RIGHT_HAND) == STAFF_TYPE)        WornObject.SetEnchantment(PlayerRef, RIGHT_HAND, WEAPON_SLOT, SomeCoolEnchantment, GRAND_SOUL)    elseif (PlayerRef.GetEquippedItemType(LEFT_HAND) == STAFF_TYPE)        WornObject.SetEnchantment(PlayerRef, LEFT_HAND, WEAPON_SLOT, SomeCoolEnchantment, GRAND_SOUL)    else        debug.notification("Player isn't holding a staff we can enchant!")    endifEndFunction
User avatar
kirsty williams
 
Posts: 3509
Joined: Sun Oct 08, 2006 5:56 am


Return to V - Skyrim