I want to use a book as a key. Is this possible?

Post » Thu Jun 21, 2012 10:47 am

I want to use a book as the key to a dungeon, it's rather important to the mod that I'm creating, I'd rather not have a "Pretend like this key doesn't exist" item that I put right next to the book to make the mod work, if that's at all possible.

I need to know how to label the book so that it's selectable from the dropdown list of keys in the menu for the door. If anyone can help out, that'd be great. Thanks in advance, especially if this turns out to be a stupid question.
User avatar
electro_fantics
 
Posts: 3448
Joined: Fri Mar 30, 2007 11:50 pm

Post » Thu Jun 21, 2012 5:39 am

What about a script? My scripting is not great so I would do something like this.

Create a trigger box by the door,

ScriptName bookiskey extends TrapTriggerBaseobjectReference property door01 autobook property bookkey autoEvent onTriggerEnter(objectReference triggerRef)if (Game.GetPlayer().GetItemCount(bookkey) == 1) ; check to see the player has the bookdoor01.unlock() ;unlocks the doorDebug.Notification("You have used a book to open the door") ; tells the player what he/she did with the bookendifendevent
User avatar
Holli Dillon
 
Posts: 3397
Joined: Wed Jun 21, 2006 4:54 am

Post » Thu Jun 21, 2012 5:32 am

Why thank you, I'll give that a shot and see how well it works.
User avatar
Manuela Ribeiro Pereira
 
Posts: 3423
Joined: Fri Nov 17, 2006 10:24 pm

Post » Thu Jun 21, 2012 7:43 am

also I am not sure what story relates to the book opening the door.

But if I am correct in assuming the story goes that there is some phase in the book the player reads to open the door you can do something cooler with this script.
You can force the camera into third person mode and make the player pull out the book and do a reading animation and read a phase (providing you have a voice actor).
You will need to create a new scene in the scene editor and select the reading idle and force into third person mode from there,

ScriptName bookiskey extends TrapTriggerBaseobjectReference property door01 autobook property bookkey autoScene property readbook autoEvent onTriggerEnter(objectReference triggerRef)if (Game.GetPlayer().GetItemCount(bookkey) == 1) ; check to see the player has the bookreadbook.Start() ;plays the animation and dialogueutility.wait(1) ;wait for the scene to finish before unlocking the door and telling the player he has opened the door.door01.unlock() ;unlocks the doorDebug.Notification("You have used a book to open the door") ; tells the player what he/she did with the bookendifendevent
User avatar
Jaylene Brower
 
Posts: 3347
Joined: Tue Aug 15, 2006 12:24 pm

Post » Thu Jun 21, 2012 2:20 am

Nah, nothing that complicated. if I could make it where the door didn't even become visible until the player had the book, that'd be even better, but I thik it's overkill.

The concept is that the book informs the player of an ancient location, and having the book allows the player to get into the dungeon. Theoretically the dungeon shouldn't appear until the book starts talking about it but I'm taking baby steps and focusing on the more important parts of the mod first - basically I don't want the player to stumble across the dungeon until they have the book.

But while you're at it, is there a quick and easy way to have the book start a conversation with the player?
User avatar
Natasha Callaghan
 
Posts: 3523
Joined: Sat Dec 09, 2006 7:44 pm

Post » Thu Jun 21, 2012 5:47 am

The game doesn't seem to be doing anything, it may be due to the positioning of the triggerbox, but I can't seem to get it to where I can SEE the triggerbox, so I don't know how to move it around.

Also I assume that bookkey and door01 need to be renamed to whatever's appropriate, I may have messed them up. Do I have to have something named book, for the script above to work?
User avatar
Kelsey Anna Farley
 
Posts: 3433
Joined: Fri Jun 30, 2006 10:33 pm

Post » Thu Jun 21, 2012 2:45 am

To make 3djake's code work, you'll need to right-click on the trigger and click Edit. Then move to the Scripts tab in the middle. Click on your Script and then hit the Properties button. Then you set those two variables, bookkey and door01, to your objects. If you still can't see the trigger, hit M while you're in the Render window to toggler Markers.

As an alternative... maybe when the player picks up the book the fast travel icon could be revealed on the World Map. And the text in the book can describe where the player should look on the World Map to see it. This is done a few times in the game already, so it might be familiar to other players. Yet it wouldn't be as unique as your approach. Another possibility anyway. :)
User avatar
vanuza
 
Posts: 3522
Joined: Fri Sep 22, 2006 11:14 pm

Post » Wed Jun 20, 2012 10:09 pm

as Aenara said you do not need to rename anything, just attach the script to a trigger box that covers up the whole of the door way. once the script is attached to the triggerbox you will need to right click it and select properties and set door and bookkey to what every you want. The reason it works like this is so that you can re-use the script with out making news ones all the time.

Yes you can make the book start a conversion but I am still learning the creation kit myself but I would try creating a scene and a event to trigger the scene, the book would have to be sitting on a table or something so maybe it talks before the player picks it up. If you were to try it this way I would try using some special effects that turn on while the book is talking so the player knows that it is the book.
User avatar
Elizabeth Davis
 
Posts: 3406
Joined: Sat Aug 18, 2007 10:30 am

Post » Thu Jun 21, 2012 1:16 pm

The triggerbox is invisible. how do I know if it covers the doorway? how can I select it, see it, and move it around?

Also when I go to the properties window, there are no variables to set to the objects. do I have to create them? There's a list of around a hundred different variable types, which ones do I use? nvm, think I got that figured out. still worried about the invisible triggerbox though.
User avatar
Neil
 
Posts: 3357
Joined: Sat Jul 14, 2007 5:08 am

Post » Thu Jun 21, 2012 8:34 am

It's not working. and when I right click the script and select edit source, I see this:

Scriptname bookiskey2 extends ObjectReference
{ScriptName bookiskey extends TrapTriggerBase

objectReference property door01 auto
book property bookkey auto

Event onTriggerEnter(objectReference triggerRef)
if (Game.GetPlayer().GetItemCount(bookkey) == 1) ; check to see the player has the book
door01.unlock() ;unlocks the door
Debug.Notification("You have used a book to open the door") ; tells the player what he/she did with the book
endif
endevent}

ObjectReference Property Door01 Auto

Book Property bookkey Auto
User avatar
Ownie Zuliana
 
Posts: 3375
Joined: Thu Jun 15, 2006 4:31 am

Post » Thu Jun 21, 2012 1:25 am

You have two scriptname lines? That might be your problem right there.
User avatar
Lory Da Costa
 
Posts: 3463
Joined: Fri Dec 15, 2006 12:30 pm

Post » Thu Jun 21, 2012 2:12 am

changed it to
-------------------
Scriptname bookiskey2 extends ObjectReference
{

Event onTriggerEnter(objectReference triggerRef)
if (Game.GetPlayer().GetItemCount(bookkey) == 1) ; check to see the player has the book
door01.unlock() ;unlocks the door
Debug.Notification("You have used a book to open the door") ; tells the player what he/she did with the book
endif
endevent}

ObjectReference Property Door01 Auto

Book Property bookkey Auto


-------------------
no dice.

tried putting the variable declarations at the beginning, and inside the brackets. those changes didn't work either.
User avatar
Darrell Fawcett
 
Posts: 3336
Joined: Tue May 22, 2007 12:16 am

Post » Thu Jun 21, 2012 8:04 am

You need to get rid of the curly braces { }. They designate comments that are used to describe the script, which in this case means that your entire script is a comment. Remove the one after ScriptName and the other after EndEvent and you should be good.
User avatar
Kate Murrell
 
Posts: 3537
Joined: Mon Oct 16, 2006 4:02 am

Post » Thu Jun 21, 2012 11:15 am

this is what happens when I try to save that script.

Starting 1 compile threads for 1 files...
Compiling "bookiskey2"...
d:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\bookiskey2.psc(9,7): unlock is not a function or does not exist
No output generated for bookiskey2, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on bookiskey2
User avatar
Emma Pennington
 
Posts: 3346
Joined: Tue Oct 17, 2006 8:41 am

Post » Thu Jun 21, 2012 1:05 am

Unlock isn't a Papyrus function. Instead use door01.lock(false)
User avatar
brandon frier
 
Posts: 3422
Joined: Wed Oct 17, 2007 8:47 pm

Post » Thu Jun 21, 2012 2:34 am

here's what it looks like now:

Scriptname bookiskey2 extends ObjectReference
Book Property bookkey Auto
ObjectReference Property Door01 Auto
Event onTriggerEnter(objectReference triggerRef)
if (Game.GetPlayer().GetItemCount(bookkey) == 1) ; check to see the player has the book
Door01.lock(false) ;unlocks the door
Debug.Notification("You have used a book to open the door") ; tells the player what he/she did with the book
endif
endevent

it compiles, it runs, it does nothing. It has to be the triggerbox at this point, I think. And with no way to see the dimensions of the triggerbox, nor to move it around, nor resize it, I want to change this script to run on the door when the player attempts to open it and fails. if they have to hit the use button twice, that's fine, but I need it to be workable. What's teh trigger for using the door, onTriggerActivate?

GRR!
OnTrigger, OnActivate, and OnTriggerActivate all do nothing. yet they compile. wow this is incredibly frustrating. This should be very simple!
User avatar
Tyler F
 
Posts: 3420
Joined: Mon Aug 27, 2007 8:07 pm

Post » Thu Jun 21, 2012 6:53 am

If you don't see the triggerbox, make sure you check the right checkbox (i believe "Markers > Collision Objects") in the Show/Hide Window (which you can find in the View menu).
Then you can resize/move your triggerbox by activating the scale gizmo (numpad 2).
User avatar
Dean
 
Posts: 3438
Joined: Fri Jul 27, 2007 4:58 pm

Post » Thu Jun 21, 2012 6:31 am

Everything is checked there,it's still invisible.

selecting the triggerbox, clicking the render window's title bar, hitting numpad 2, and zooming INSIDE the door, I see the red green and blue axes that might indicate that the triggerbox is infinitely tiny. How can I go about manually changing its size, and what size would be appropriate?
User avatar
sally coker
 
Posts: 3349
Joined: Wed Jul 26, 2006 7:51 pm

Post » Thu Jun 21, 2012 2:10 am

Make sure you are using a trigger from the Trigger menu and not from the objects window. I know that was what I was first doing and would get triggers without a primitive attached to it. After finding out about the Trigger menu they have the primitive which you can then place where needed in the render view. Not sure if thats whats going on for you but was sure a good bit of what I was running into at the start with some of my triggers.
User avatar
hannaH
 
Posts: 3513
Joined: Tue Aug 15, 2006 4:50 am

Post » Thu Jun 21, 2012 2:26 am

K, where's the trigger menu? whelp found that.
still not working.

here's the script, named bookiskey2:
Scriptname bookiskey2 extends ObjectReference
Book Property bookkey Auto
ObjectReference Property Door01 Auto
Event onTriggerEnter(objectReference triggerRef)
if (Game.GetPlayer().GetItemCount(bookkey) == 1) ; check to see the player has the book
Door01.lock(false) ;unlocks the door
Debug.Notification("You have used a book to open the door") ; tells the player what he/she did with the book
endif
endevent

it's in the scripts tab under the trigger object named MysteriousJournalTriggerBox2.
If I have a savegame where my character is near the location where the door trigger is, do I have to load an earlier save, or start a new game to check the scripts to see if they'll work?
User avatar
Sherry Speakman
 
Posts: 3487
Joined: Fri Oct 20, 2006 1:00 pm

Post » Thu Jun 21, 2012 9:05 am

select the door and hit the button that has a picture of a box with a T in it, name the trigger box buy hitting new then pull it towards where the player stands, attach the script and then right click and select you property's from there :)

Edit: sorry did not see your last reply, yeah try a early save and make sure the trigger box is big enough and the property's are set.
Do you get the debug message? "You have used a book to open the door"
User avatar
Alberto Aguilera
 
Posts: 3472
Joined: Wed Aug 29, 2007 12:42 am

Post » Thu Jun 21, 2012 3:10 am

I just tested it out, it works.
Here is how to do it just in case you are missing a step
http://epick.org/keybook.avi
User avatar
Nichola Haynes
 
Posts: 3457
Joined: Tue Aug 01, 2006 4:54 pm

Post » Thu Jun 21, 2012 8:11 am

Bizarre. I had created a trigger box and searched out "triggerbox" in the list to make my triggerbox and it didn't work, but when I gave it a new name THERE it magically worked. Thanks so much. Now I'm just going to fix up the conversation, and the hard parts will be over!
User avatar
Sophie Miller
 
Posts: 3300
Joined: Sun Jun 18, 2006 12:35 am


Return to V - Skyrim