How to start a scene upon opening the door?

Post » Sat Nov 17, 2012 12:09 am

Hi,

I'm trying to achieve the following result: PC opens the door, and this triggers a scene. How do I go about that? Thanks in advance for any suggestions.
User avatar
Isabell Hoffmann
 
Posts: 3463
Joined: Wed Apr 18, 2007 11:34 pm

Post » Sat Nov 17, 2012 3:46 pm

I’m not the best at scripting, but could you put a script on the door and use GetOpenState (http://www.creationkit.com/GetOpenState_-_ObjectReference )to start the scene? You might want to set the state of the door to closed and you’d also need to be sure that it could only be opened by the player at the specific time you wanted to run your scene. Or you could use a quest stage as a condition to make the MyScene.Start() valid.
User avatar
Emmanuel Morales
 
Posts: 3433
Joined: Sat Oct 06, 2007 2:03 pm

Post » Sat Nov 17, 2012 10:47 am

Balok, thanks for both suggestions. I will probably go the latter route, and this little script does look promising. I want this scene to trigger only when the quest is at stage 10, will the following work?


int openState = QuestDoor.GetOpenState()
int MyQuestStage = MyQuest.GetStage()
if (openState == 1 || openState == 2 || MyQuestStage == 10)
QuestScene01.Start()
endIf

I would test it myself, but I'm at work without access to CK. I'm also thinking about using Xmarks, but I have had no experience with them whatsoever.
User avatar
Chris Duncan
 
Posts: 3471
Joined: Sun Jun 24, 2007 2:31 am

Post » Sat Nov 17, 2012 1:57 am

Lol, I'm at work too, but you also might want to put a check in there to make sure it's the player opening it, and not a follower or another NPC.
User avatar
Jonny
 
Posts: 3508
Joined: Wed Jul 18, 2007 9:04 am

Post » Sat Nov 17, 2012 7:47 am

Since I can't use CK at this moment, I did some more searching, and I found this on CK wiki:


A Trigger That Detects When The Player Enters

Scriptname ExampleTrigger extends ObjectReference

Event OnTriggerEnter(ObjectReference akActionRef)
if(akActionRef == Game.GetPlayer()) ; This condition ensures that only the player will trigger this code
Debug.MessageBox("Yippee!")
endif
EndEvent

This could come handy with some extra conditions to make sure it runs only during the specific stage of specific quest, but I think this is what I'm looking for, if I apply it to the floor tile.
User avatar
Alina loves Alexandra
 
Posts: 3456
Joined: Mon Jan 01, 2007 7:55 pm

Post » Sat Nov 17, 2012 3:22 pm

Why won't OnActivate work?

Add a script to the door. Make sure it's being opened and that the PC is the one opening it. Then start the scene.
User avatar
Siobhan Wallis-McRobert
 
Posts: 3449
Joined: Fri Dec 08, 2006 4:09 pm

Post » Sat Nov 17, 2012 6:15 am

Hmm, Doc, thanks for this suggestion, but keep in mind you are talking to somebody with a very limited knowledge and experience when it comes to scripting. Sorry for being a bother, but how exactly do I use OnActivate?
User avatar
Lavender Brown
 
Posts: 3448
Joined: Tue Jul 25, 2006 9:37 am

Post » Sat Nov 17, 2012 5:32 am

Hmm, Doc, thanks for this suggestion, but keep in mind you are talking to somebody with a very limited knowledge and experience when it comes to scripting. Sorry for being a bother, but how exactly do I use OnActivate?

For OnActivate, I'd do this tutorial or follow it's explanations and use it on your door.

http://www.creationkit.com/Bethesda_Tutorial_Papyrus_Hello_World
User avatar
Samantha Wood
 
Posts: 3286
Joined: Sun Oct 15, 2006 5:03 am

Post » Sat Nov 17, 2012 3:04 pm

Awesome, thanks. I will give it a try.
User avatar
Len swann
 
Posts: 3466
Joined: Mon Jun 18, 2007 5:02 pm

Post » Sat Nov 17, 2012 2:43 am

Also, as
Since I can't use CK at this moment, I did some more searching, and I found this on CK wiki:


A Trigger That Detects When The Player Enters

Scriptname ExampleTrigger extends ObjectReference

Event OnTriggerEnter(ObjectReference akActionRef)
if(akActionRef == Game.GetPlayer()) ; This condition ensures that only the player will trigger this code
Debug.MessageBox("Yippee!")
endif
EndEvent

This could come handy with some extra conditions to make sure it runs only during the specific stage of specific quest, but I think this is what I'm looking for, if I apply it to the floor tile.

I'm doing exactly this in my quest. I'll post up the script for you when I get home. The way I got around the conditions was to set the trigger as initially disabled, and enabled it at exactly the time when I needed it to trigger the scene. In the stage I wanted it to trigger I enabled the trigger box so that it would only be triggered when I needed it to be. That way, there were no need for conditions because the script also disables the trigger once it fires.
User avatar
suniti
 
Posts: 3176
Joined: Mon Sep 25, 2006 4:22 pm

Post » Sat Nov 17, 2012 9:29 am

How to create a trigger primitive:

http://www.creationkit.com/Creating_Primitives

Type: Box
Collision Layer: L_ACTORZONE

Make your prim, add a script and define properties for your scene and/or quest if you're using one.

ScriptName BalokTriggerScene01 extends ObjectReferenceimport gameScene Property MySceneTrigger AutoQuest Property MyQuest Auto  auto STATE waitingForPlayer    EVENT onTriggerEnter(objectReference triggerRef)        If triggerRef == getPlayer() as actor            Debug.Notification("Player entered the trigger")       			 MyScene.Start()				    MyQuest.setObjectiveCompleted(50)            Debug.Notification("SCENE STARTED")            gotoState("hasBeenTriggered")            Disable()                    EndIf    EndEvent    EndSTATESTATE hasBeenTriggered    ; this is an empty state.endSTATE
User avatar
Lizs
 
Posts: 3497
Joined: Mon Jul 17, 2006 11:45 pm

Post » Sat Nov 17, 2012 7:12 am

Or...

just use the http://www.creationkit.com/OnOpen_-_ObjectReference event. :P
User avatar
phil walsh
 
Posts: 3317
Joined: Wed May 16, 2007 8:46 pm

Post » Sat Nov 17, 2012 2:16 am

Give the man a prize!
User avatar
Laura Ellaby
 
Posts: 3355
Joined: Sun Jul 02, 2006 9:59 am

Post » Sat Nov 17, 2012 2:44 pm

Thank you for all your suggestions, everyone. Your help is much appreciated.
User avatar
maya papps
 
Posts: 3468
Joined: Mon Aug 07, 2006 3:44 pm


Return to V - Skyrim