Make player sneak to pass through door

Post » Sun May 05, 2013 6:01 pm

How can I make it so the player has to sneak (in game it will say "You must duck to enter") in order to pass through a door into an interior cell and the same to get out?

User avatar
Amelia Pritchard
 
Posts: 3445
Joined: Mon Jul 24, 2006 2:40 am

Post » Sun May 05, 2013 6:35 am

Maybe something like this...?

Scriptname testaaa extends ObjectReferenceMessage Property YouMustSneakMes AutoEvent OnInit()    Self.BlockActivation()endEventEvent OnActivate(ObjectReference akActionRef) ;wiki says it still fires despite BlockActivation()    Actor kActor = akActionRef as Actor    if kActor.IsSneaking()        Self.Activate(akActionRef, true) ;true bypasses BlockActivation()    elseIf kActor == Game.GetPlayer()        YouMustSneakMes.Show()    endIfendEvent
User avatar
OTTO
 
Posts: 3367
Joined: Thu May 17, 2007 6:22 pm

Post » Sun May 05, 2013 6:11 pm

@mojo22 - I put the script on an autoload door and it doesn't work. Player walks towards door gets the message "To marker storage unit" enters door and the screen goes black. Can't see, don't know if I am moving, sounds like I am still outside and I have to quit.

User avatar
Justin Hankins
 
Posts: 3348
Joined: Fri Oct 26, 2007 12:36 pm

Post » Sun May 05, 2013 6:17 pm

Hmm, instead of Activate(), can you just do MoveTo and place an xmarker instead.

User avatar
Sophie Louise Edge
 
Posts: 3461
Joined: Sat Oct 21, 2006 7:09 pm

Post » Sun May 05, 2013 3:20 pm

I am starting a new thread explaining what I want to do. Thanks.

User avatar
Connor Wing
 
Posts: 3465
Joined: Wed Jun 20, 2007 1:22 am

Post » Sun May 05, 2013 2:46 am

Script glued to the autoload door:
Spoiler


Oops. Ninja'd
User avatar
Tai Scott
 
Posts: 3446
Joined: Sat Jan 20, 2007 6:58 pm

Post » Sun May 05, 2013 1:09 pm

Same thing happens as it did with mojo's script, black screen and no teleport.

User avatar
Kathryn Medows
 
Posts: 3547
Joined: Sun Nov 19, 2006 12:10 pm

Post » Sun May 05, 2013 3:50 pm

Forget the sneak can I just block the door from player entering but NPC must be allowed to pass?

User avatar
Sweets Sweets
 
Posts: 3339
Joined: Tue Jun 13, 2006 3:26 am

Post » Sun May 05, 2013 7:45 am

Are you sure your door is linked properly to the other side? If it is and it's some weird glitch with calling Activate on a door, use MoveTo. Also if you just want to block the player...

Scriptname testaaa extends ObjectReference;ObjectReference Property TeleportMarker AutoEvent OnInit()    Self.BlockActivation()endEventEvent OnActivate(ObjectReference akActionRef)    if akActionRef != Game.GetPlayer()        Self.Activate(akActionRef as Actor, true) ;or akActionRef.MoveTo(TeleportMarker)    endIfendEvent
User avatar
rheanna bruining
 
Posts: 3415
Joined: Fri Dec 22, 2006 11:00 am

Post » Sun May 05, 2013 9:16 am

Using the script

Event OnInit()

Self.BlockActivation()

endEvent

and also trying

Event OnLoad()

Self.BlockActivation()

EndEvent

this is what happens. The first part of the video is without any script on the autoload door and the second part is with the script - either of them.

http://www.youtube.com/watch?v=CNAMnsvBzEs

User avatar
Sammygirl
 
Posts: 3378
Joined: Fri Jun 16, 2006 6:15 pm

Post » Sun May 05, 2013 11:15 am

That is weird. How about trying a normal door rather then auto load. The scripts that have been provided to you will make it automatically activate anyway as long as you are sneaking. I'm just clutching at straws to be honest, but worth a shot :shrug:

- Hypno
User avatar
Amy Siebenhaar
 
Posts: 3426
Joined: Fri Aug 10, 2007 1:51 am

Post » Sun May 05, 2013 3:28 pm

Works with normal doors but NPCs can't get through.

User avatar
Alina loves Alexandra
 
Posts: 3456
Joined: Mon Jan 01, 2007 7:55 pm

Post » Sun May 05, 2013 5:56 pm

Have you re-finalised the navmeshes to account for your new door markers?

- Hypno
User avatar
Liv Staff
 
Posts: 3473
Joined: Wed Oct 25, 2006 10:51 pm

Post » Sun May 05, 2013 6:25 am

Yes. NPCs pass through without script being attached.

User avatar
Chris Cross Cabaret Man
 
Posts: 3301
Joined: Tue Jun 19, 2007 11:33 pm

Post » Sun May 05, 2013 6:02 pm

Ok, then your sneak script is probably blocking them. Here's JustinOther's script edited to only give the player the sneak limitation but allow anything else to use it as normal:

ScriptName YourDoorScript Extends ObjectReferenceMessage Property kYourMESG AutoEvent OnInit()	BlockActivation()EndEventEvent OnActivate(ObjectReference akActionRef)   If akActionRef == Game.GetPlayer()      If (akActionRef As Actor).IsSneaking()         Activate(akActionRef)      Else         kYourMESG.Show()      EndIf   Else      Activate(akActionRef)   EndIfEndEvent
- Hypno
User avatar
sam
 
Posts: 3386
Joined: Sat Jan 27, 2007 2:44 pm

Post » Sun May 05, 2013 8:55 am

The sneak option I discarded, I need that player cannot use the door at all but NPCs can. Thanks.

User avatar
candice keenan
 
Posts: 3510
Joined: Tue Dec 05, 2006 10:43 pm

Post » Sun May 05, 2013 2:51 pm

Oh right, well the script Mojo posted last should do the trick then.

What exactly is the end result you are trying to achieve? A bit of context might get an alternate solution out of us :)

- Hypno
User avatar
Red Sauce
 
Posts: 3431
Joined: Fri Aug 04, 2006 1:35 pm

Post » Sun May 05, 2013 2:56 pm

The original quest line was this. Payer is going to find a dwarf that lives in a small cave. Eventually when scripting is finished if the dwarf gets LOS he will run into his cave. I wanted to use a teleport script so that when the dwarf enters a trigger box that is at the cave entrance he just QUICKLY disappears. This I did but I need him to return and run a patrol package every night between 12-3am when he tends flowers, this would be the only time the dwarf leaves the cave and the player has the chance to "catch him" and talk to him before he disappears into his cave. In order that the player can't follow I scaled the cave entrance very small and a debug notification tells the player that he is too big to pass through so player has to wait until the following night, when dwarf runs his patrol package to have another chance to speak with him. Then I thought what if player could enter the cave but had to "duck"/sneak to enter. This was a little silly because it would require a lot of scaling of the interior cell, anyway I abandoned the idea. SO it was back to player cannot enter at all. Teleporting was working when the dwarf entered the cave but he wouldn't teleport out when the patrol package began, also teleporting required several trigger boxes, xmarkers and travel to xmarkers inside trigger boxes that had teleport scripts on them. SO a simple autoload door seemed better as the dwarf could quickly run away, thing is the player needs to be blocked from entering. Using mojo's scripts. respect mojo, on autoload doors resulted in the black screen (see link), so I used normal doors which one looks weird if the dwarf is running away has to stop to open a door and two a door to a cave...I think not. Anyway the script...

Event OnActivate(ObjectReference akActionRef)

if akActionRef != Game.GetPlayer()

Self.Activate(akActionRef as Actor, true)

endIf

endEvent

...doesn't do anything and the script...

Event OnInit()

Self.BlockActivation()

endEvent

...prevents the dwarf from using the door. So what I want effectively is that the dwarf leaves his cave at 12.00am goes to tend his flowers (patrol package), gets sight of player and runs away into his cave. Player attempts to enter the cave gets the message "This entrance is too small for you to fit through." and has to wait until the next night to catch the dwarf.

User avatar
JaNnatul Naimah
 
Posts: 3455
Joined: Fri Jun 23, 2006 8:33 am


Return to V - Skyrim