Activate(OpenClose) Door with a target Spell

Post » Sat Jul 19, 2014 12:21 pm

As i was modding my house, I came with an idea. I would like to put a script on a door in my house that activates the door only when hit with a specific spell (e.g. Firebolt) and not with an interaction button.

User avatar
Noely Ulloa
 
Posts: 3596
Joined: Tue Jul 04, 2006 1:33 am

Post » Fri Jul 18, 2014 11:32 pm

You'll have to figure out how to remove the prompt on the door.

Anyway this works well.

Spoiler
Scriptname SpellActivationScript extends ObjectReference  Actor property PlayerRef autoSpell property ActivatorSpell autoAUTO STATE ClosedPosition ; assumed the door is closed by default(Open by default not checked on reference)Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \  bool abBashAttack, bool abHitBlocked)    if akSource == ActivatorSpell        self.Activate(PlayerRef)    endifEndEventEvent OnActivate(ObjectReference akActionRef)    GoToState("Busy")    self.SetOpen()    GoToState("OpenPosition")EndEventENDSTATESTATE BusyEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \  bool abBashAttack, bool abHitBlocked);empty, event thrown out.EndEventEvent OnActivate(ObjectReference akActionRef);empty, event thrown out.EndEventENDSTATESTATE OpenPositionEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \  bool abBashAttack, bool abHitBlocked)    if akSource == ActivatorSpell        self.Activate(PlayerRef)    endifEndEventEvent OnActivate(ObjectReference akActionRef)    GoToState("Busy")    self.SetOpen(false)    GoToState("ClosedPosition")EndEventENDSTATE
User avatar
james tait
 
Posts: 3385
Joined: Fri Jun 22, 2007 6:26 pm


Return to V - Skyrim