NPC No Open Doors

Post » Thu Jun 21, 2012 4:17 am

I have an NPC that keeps opening a door that is supposed to remain locked for the player to open.

The door is locked with a key too, yet the NPC, who is in battle with the player, will open that door and ruin the sequence (he is carrying the key that the player is supposed to use on that door).

I've tried various default scripts and xmarker enabled collision markers etc to no avail.

Any idea how to keep him from opening that door?

Thanks!
User avatar
xxLindsAffec
 
Posts: 3604
Joined: Sun Jan 14, 2007 10:39 pm

Post » Thu Jun 21, 2012 12:27 am

Remove the key from the actor's inventory, add a small script to the actor with an OnDeath event, and in that event use AddItem to add the key to the actor. That way there is no key until he's dead. Note that this way the key can't be pickpocketed, though you could fix that as well with additional scripting.
User avatar
Adam Kriner
 
Posts: 3448
Joined: Mon Aug 06, 2007 2:30 am

Post » Wed Jun 20, 2012 2:57 pm

Remove the key from the actor's inventory, add a small script to the actor with an OnDeath event, and in that event use AddItem to add the key to the actor. That way there is no key until he's dead. Note that this way the key can't be pickpocketed, though you could fix that as well with additional scripting.

I've been tinkering with "defaultActivateLinkedRefOnceOnDeath" on the actor but it requires a keyword. I can't figure out what keyword would be appropriate and it doesn't do what I want without one it seems.

The scene is actually a bit complicated.

On the key I have "GetKeyFromBanditEnable" to enable a ghost who motions you to the door once the key is in the players possession. It also activates three triggers that are meant to deactivate the ghost when the player gets close (using an xmarker). This ghost is standing in front of that door.

Right now, the trigger that activates the enemy also triggers the collision marker. To keep the guy from opening that door.

So, the enemy is not enabled until you go through a trigger and he shows up at a door to fight you. No chance to pickpocket unless you can hide until he stops combat.

Can you give an example of adding in item using the "Event OnDeath(Actor killer)" handle?
User avatar
how solid
 
Posts: 3434
Joined: Mon Apr 23, 2007 5:27 am

Post » Wed Jun 20, 2012 10:25 pm

I've found a script that adds a key to the actor and changed out "OnInit()" with "OnDeath(Actor killer)" and it doesn't work.

Here's the script:

Scriptname antreAddItemKeyOnDeathScript extends defaultAddItemScriptKey property _KeyToAdd Autobool property unique = True Auto{If the player already has this item, don't give the actor one. Defaults to True for keys.};Stores the key. DefaultAddItemScript takes care of the rest.;Event OnInit()Event OnDeath(Actor killer)	ParentUnique = Unique	ItemToAdd = _KeyToAddEndEvent

Can you show me what is wrong with it?

Thanks!
User avatar
lacy lake
 
Posts: 3450
Joined: Sun Dec 31, 2006 12:13 am

Post » Wed Jun 20, 2012 4:25 pm

I've found a script that adds a key to the actor and changed out "OnInit()" with "OnDeath(Actor killer)" and it doesn't work.

Here's the script:

Scriptname antreAddItemKeyOnDeathScript extends defaultAddItemScriptKey property _KeyToAdd Autobool property unique = True Auto{If the player already has this item, don't give the actor one. Defaults to True for keys.};Stores the key. DefaultAddItemScript takes care of the rest.;Event OnInit()Event OnDeath(Actor killer)	ParentUnique = Unique	ItemToAdd = _KeyToAddEndEvent

Can you show me what is wrong with it?

Thanks!
I think that OnDeath is fired only for script that extends Actor.
User avatar
claire ley
 
Posts: 3454
Joined: Fri Aug 04, 2006 7:48 pm

Post » Wed Jun 20, 2012 11:33 pm

Make the key the Death Item for the NPC.
User avatar
benjamin corsini
 
Posts: 3411
Joined: Tue Jul 31, 2007 11:32 pm

Post » Wed Jun 20, 2012 9:20 pm

Thanks guys!

I figured it out:

http://www.gamesas.com/topic/1366634-add-item-on-death-scr/
User avatar
Alina loves Alexandra
 
Posts: 3456
Joined: Mon Jan 01, 2007 7:55 pm


Return to V - Skyrim