Jump to content

Created Helm, want it ONLY during combat


Recommended Posts

  • 3 weeks later...

this armor set i created for my follower, i only want the helm to appear during combat. is there a small script to add to it or do i need to create a quest and script it?

 

 

Hey, yes you can do this fairly easy by creating a new spell / ability that detects whether the NPC is in combat or not. Make a new magic effect: Script, Constant effect, Self. Then make a new spell, Type: Ability, constant effect, self, and put your magic effect on it with the condition IsInCombat == 1.

 

Put this script on your Helm:

 

 

Scriptname MyhelmScript extends ObjectReference 


Spell Property DetectCombatState Auto ;This is the spell you just made


Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
    If (akNewContainer as actor)
       (akNewContainer as actor).AddSpell(DetectCombatState) ;adds detect combat spell ability to NPC
    Endif
   
    If (akOldContainer as actor)
        If (akOldContainer as actor).GetItemCount(Self.GetBaseObject()) == 0
            (akOldContainer as actor).RemoveSpell(DetectCombatState) ;remove detect combat spell from old NPC
        Endif 
    Endif 
EndEvent

Name the script something unique.

 

Put this script on your magic effect:

 

 

Scriptname DetectCombatScript extends ActiveMagicEffect 

Armor Property Helm Auto

Event OnEffectStart(Actor akTarget, Actor akCaster) ;effect starts when NPC starts combat
    akTarget.EquipItem(Helm)
EndEvent 


Event OnEffectFinish(Actor akTarget, Actor akCaster) ;effect stops when NPC leaves combat
    akTarget.UnEquipItem(Helm)
EndEvent

 

 

 

Again, name the script something unique.

Edited by dylbill
Link to comment
Share on other sites

I had another thought. If you only want this function for your specific follower, you could make a new quest, start game enabled, and make a new reference alias on the quest that points to your follower. Put this script on the reference alias:

 

 

 

Scriptname HelmEquipScript extends ReferenceAlias 


Armor Property Helm Auto


Event OnCombatStateChanged(Actor akTarget, int aeCombatState)
    If aeCombatState == 1
        GetActorRef().EquipItem(Helm)
    Elseif aeCombatState == 0
        GetActorRef().UnEquipItem(Helm)
    Endif 
EndEvent

 

 

Again name the script something more unique.

Edited by dylbill
Link to comment
Share on other sites

  • Recently Browsing   0 members

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