SKSE GetEnchantment() not work on player enchanted wep?

Post » Thu Apr 14, 2016 2:24 am

I have found that if a player makes their "normal" weapon into an enchanted weapon then GetEnchantment() will not work.



Is this correct? If so is there another way to detect if a weapon object ref is an enchanted weapon or not?




if (!AttackerWeapon.GetEnchantment())

debug.notification("Your weapon is enchanted.")

endif
User avatar
Quick draw II
 
Posts: 3301
Joined: Thu Nov 08, 2007 4:11 pm

Post » Thu Apr 14, 2016 12:50 am

Is AttackerWeapon a Weapon variable or an ObjectReference variable? I think the Weapon.GetEnchantment function only returns an enchantment when the base form has an enchantment. ObjectReference.GetEnchantment has a comment above it that says "Returns the player-made enchantment if there is one". WornObject.GetEnchantment has the same comment above it and is probably what you'll want to use if the weapon you are checking is equipped by an actor.

User avatar
Dalton Greynolds
 
Posts: 3476
Joined: Thu Oct 18, 2007 5:12 pm

Post » Wed Apr 13, 2016 9:41 pm

right sorry



AttackerWeapon is cast from aksource as a weapon (that hit in a onhit event ).


So I need to get the ObjectReference. That will be harder but it can be done.


Thank you very much MrJack.
User avatar
Danial Zachery
 
Posts: 3451
Joined: Fri Aug 24, 2007 5:41 am

Post » Wed Apr 13, 2016 5:29 pm

oh for pete's sake this was easier than I was thinking you meant...



if (WornObject.GetEnchantment(playerref, 1, 0)) ; 1 is right hand the next zero is slot for weapons



Thanks again MrJack.




Edit: do you know if I must do BOTH:



AttackerWeapon.GetEnchantment() ; AttackerWeapon is a weapon var


WornObject.GetEnchantment()


To get both vanilla enchantments AND player made enchantments?
User avatar
JERMAINE VIDAURRI
 
Posts: 3382
Joined: Tue Dec 04, 2007 9:06 am


Return to V - Skyrim