Enemies attacking behind door

Post » Sun Jun 15, 2014 8:10 am

I have a locked door and put some draugr behind it, but when you come close to the door, the red dots already show up on the compass and you hear the draugr sounds and stuff. So how do I keep them in place untill I actually unlocked the door and walk into the room?

User avatar
Madeleine Rose Walsh
 
Posts: 3425
Joined: Wed Oct 04, 2006 2:07 am

Post » Sat Jun 14, 2014 9:33 pm

Just a thought, not sure if it would work.

Make the draugr initially disabled and unlocking the door, enables them.

User avatar
Juan Cerda
 
Posts: 3426
Joined: Thu Jul 12, 2007 8:49 pm

Post » Sat Jun 14, 2014 6:24 pm

Good idea. I set an enemy to initially disabled to test it out. For the door I used this script:

Scriptname EnableEnemyOnOpen Actor Property myEnemy AutoEvent OnOpen()myEnemy.enable()endEvent

But it doesn't work, the draugr won't appear. I left away the extends objectreference, because otherwise it wouldn't compile. Maybe something to do with that?

User avatar
Krystina Proietti
 
Posts: 3388
Joined: Sat Dec 23, 2006 9:02 pm

Post » Sun Jun 15, 2014 6:49 am

It must extend ObjectReference, otherwise it will handle the OnOpen() event as a non-native event, and in this case will do nothing when the door is open. Your problem is likely the fact that you haven't supplied any parameters to the OnOpen event, and as you can see http://www.creationkit.com/OnOpen_-_ObjectReference, you have to provide the event with an ObjectReference. So you would have, for example:

Scriptname EnableEnemyOnOpen extends ObjectReferenceActor Property myEnemy AutoEvent OnOpen(ObjectReference akActionRef)myEnemy.enable()endEvent

Keep in mind that akActionRef isn't the door itself, it's whatever activated the door. In this case, you probably wouldn't have to worry about doing anything with akActionRef, since the player would likely be the only one opening the door.

User avatar
Code Affinity
 
Posts: 3325
Joined: Wed Jun 13, 2007 11:11 am

Post » Sun Jun 15, 2014 3:37 am

Thank you both very much.

User avatar
Danial Zachery
 
Posts: 3451
Joined: Fri Aug 24, 2007 5:41 am


Return to V - Skyrim