Jump to content

[LE] Checking which Keyword an Armor has from a ActiveMagicEffect


AslanKebab

Recommended Posts

Hello

 

I have added keywords to a few pieces of armors that enhance the effect of an enchantment of the main armor piece.

The intention is to give the actor the full effect of an enchantment once they are equipped with a with a complete set by adding to a modifier variable.

Scriptname ArmorCheckScript extends activemagiceffect
;------------------------------------------------------
Float Property protModifier Auto
;-----------------------------------------------------
Keyword BattleMageCuirass
Keyword BattleMageHelmet
Keyword BattleMageBoots
Keyword BattleMageGloves
;-----------------------------------------------------
Actor ActorREF
;----------------------------------------------------
Event OnEffectStart(Actor akActor, Actor akCaster)
	ActorREF = akActor
	EndEvent
;----------------------------------------------------
Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)

		if 	ActorREF.WornHasKeyword(BattleMageCuirass)
			protModifier = 0.36 
		 	Debug.Notification("Actor has unequipped Battle Mage Cuirass")
	    endif

		if ActorREF.WornHasKeyword(BattleMageHelmet)
 			protModifier -= 0.27
 			Debug.Notification("Actor has unequipped Battle Mage Headgear")
 		endif

 		if ActorREF.WornHasKeyword(BattleMageBoots)
 			protModifier -= 0.23
 			Debug.Notification("Actor has unequipped Battle Mage Boots")
 		endif

 		if ActorREF.WornHasKeyword(BattleMageGloves)
 			protModifier -= 0.14 
 			Debug.Notification("Actor has unequipped Battle Mage Gloves")
 		endif
 	
	EndEvent
;----------------------------------------------------
Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
	Utility.Wait(0.5)
 
		if ActorREF.WornHasKeyword(BattleMageCuirass)
			protModifier = 0.36
		 	Debug.Notification("Actor has equipped Battle Mage Cuirass")
	    endif

	 	if ActorREF.WornHasKeyword(BattleMageHelmet)
 			protModifier += 0.27
 			Debug.Notification("Actor has equipped Battle Mage Headgear")
 		endif

 		if ActorREF.WornHasKeyword(BattleMageBoots)
			protModifier += 0.23
			Debug.Notification("Actor has equipped Battle Mage Boots")
		endif

 		if ActorREF.WornHasKeyword(BattleMageGloves)
 			protModifier += 0.14
 			Debug.Notification("Actor has equipped Battle Mage Gloves")
 		endif

	EndEvent

Here´s the bit of script.

 

As far as I can see, the WornHasKeyword() is returning negative.

 

and Debugging for it in-game is producing [Form in the notifications.

 

I've also used this variation below.

	(DrV_BattleMageBarrierPrototype as DRV_GuardEnchScript).protModifier

		protModifier = 0.36 
		if akBaseObject as Armor && akBaseObject.HasKeyword(BattleMageHelmet)
 			protModifier -= 0.27
 			Debug.Notification("Actor has unequipped Battle Mage Headgear")
 		endif

 		if akBaseObject as Armor && akReference.HasKeyword(BattleMageBoots)
 			protModifier -= 0.23
 			Debug.Notification("Actor has unequipped Battle Mage Boots")
 		endif

 		if akBaseObject as Armor && akReference.HasKeyword(BattleMageGloves)
 			protModifier -= 0.14 
 			Debug.Notification("Actor has unequipped Battle Mage Gloves")
 		endif
 	
	EndEvent
;----------------------------------------------------
Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
	Utility.Wait(0.5)

	 	if ActorREF.HasKeyword(BattleMageHelmet)
 			protModifier += 0.27
 			Debug.Notification("Actor has equipped Battle Mage Headgear")
 		endif

 		if akBaseObject as Armor && akReference.HasKeyword(BattleMageBoots)
			protModifier += 0.23
			Debug.Notification("Actor has equipped Battle Mage Boots")
		endif

 		if akBaseObject as Armor && akReference.HasKeyword(BattleMageGloves)
 			protModifier += 0.14
 			Debug.Notification("Actor has equipped Battle Mage Gloves")
 		endif

	EndEvent

Both seem to return negative.

 

Unfortunately, I am not Using SKSE or SSE at the moment.

So, I can not make use of :

of GetWornForm() event or IsEquippedArmorType feature.

 

Any help with this would be greatly appreciated!

 

 

Link to comment
Share on other sites

Remember the difference between "script variable" and "property"!

Keyword PROPERTY BattleMageCuirass auto   ; prefill with CK, the keyword you have created
Keyword PROPERTY BattleMageHelmet  auto
Keyword PROPERTY BattleMageBoots   auto
Keyword PROPERTY BattleMageGloves  auto

maybe for better explaining, but this is not really important

  Actor target

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
    target = akTarget
ENDEVENT

it does not make sense

if akBaseObject as Armor && akReference.HasKeyword(BattleMageBoots)

better would be the next, https://www.creationkit.com/index.php?title=HasKeyword_-_Form

IF (akBaseObject as Armor)
    IF akBaseObject.HasKeyword(BattleMageBoots)
            protModifier += 0.23                                             ; modifier you like to change, 
;;          What do you think about GlobalVariable instead of Float?

            Debug.Notification("Actor has equipped Battle Mage Boots")       ; for testing only
   ENDIF
ENDIF
Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

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