stop a book from getting picked up

Post » Wed Jan 23, 2013 1:04 am

i want the player to be able to read the book but not take it i have checked the box Can's be taken but it does nothig.


also is there a way to add books to a bookshelf
User avatar
Code Affinity
 
Posts: 3325
Joined: Wed Jun 13, 2007 11:11 am

Post » Tue Jan 22, 2013 10:48 pm

Yeh, that checkbox is a remnant from past games, would be better if it still worked.

The only thing I can think of is to place a script on the book that basically takes it off them and puts it back the moment the book enters the players inventory with a notification of "you cannot take this"

- Hypno
User avatar
Misty lt
 
Posts: 3400
Joined: Mon Dec 25, 2006 10:06 am

Post » Tue Jan 22, 2013 10:34 pm

ok i tried this code but it does not seam to drop the book when you try and take it

Scriptname MyBook extends ObjectReferenceObjectReference Property TheItem  AutoEvent OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)  if (newContainer == Game.GetPlayer())	Game.GetPlayer().DropObject(TheItem,1)  endifEndEvent
User avatar
Johnny
 
Posts: 3390
Joined: Fri Jul 06, 2007 11:32 am

Post » Wed Jan 23, 2013 12:01 am

Did you fill the 'TheItem' property?
User avatar
evelina c
 
Posts: 3377
Joined: Tue Dec 19, 2006 4:28 pm

Post » Wed Jan 23, 2013 12:43 am

yes with the book i do nt want you to take
User avatar
Megan Stabler
 
Posts: 3420
Joined: Mon Sep 18, 2006 2:03 pm

Post » Wed Jan 23, 2013 5:24 am

Small Tutorial, soon ill post it on the Wiki on how to achieve this

Creating a Activator
  • Object Window -> WorldObjects -> Activator
  • Create a new activator, name it _S_MyBookActivator
  • Give it a name, we are going to call it 'Smithing'
  • For the model we are going to use Clutter\Books\BasicBook05.nif
  • Create a new script for our Activator, clicking Add (From the Papyrus Script frame) and selecting New Script and name our script _S_MyBookActivatorScript
Spoiler

ScriptName _S_MyBookActivatorScript Extends ObjectReference  ReferenceAlias Property pBook AutoEvent OnActivate(ObjectReference akActionRef)	pBook.GetRef().Activate(Game.GetPlayer())EndEvent

Creating the Book
For this step we are going to use a pre-made book
  • Object Window -> Items -> Book
  • Create a new instance of the book 'SkillSmithing1' and name it _S_MySmithingBook
Placing the book into the world
  • Cell View -> Interiror -> RiftenBlacksmith
  • Place the Activator for our Book into the Blacksmith Cell, example on a Table, have it Disabled by Default (Right Click to Edit Properties)
Implementing into a Quest
  • Create new Alias Reference, name it 'BookActivator' and Specific Reference -> RiftenBlacksmith Cell, and select _S_MyBookActivator, make sure Allowed Disable is checked
  • Create new Alias Reference, name it 'Book' and select Create Reference to Object -> _S_MySmithingBook Create@ BookActivator and make sure Initially Disabled is checked
  • Below is placed into a Quest Fragment
Spoiler

Alias_BookActivator.GetRef().Enable()

Filling Activator Properties
  • Object Window -> WorldObjects -> Activator
  • Select _S_MyBookActivator and edit the script Properties, and select your quest that contains the book alias
User avatar
Kirsty Collins
 
Posts: 3441
Joined: Tue Sep 19, 2006 11:54 pm

Post » Wed Jan 23, 2013 4:32 am

- snip-
Does this actually work?
From what I can see, once you interact with the activator you are then dealing with the book, which can then simply be taken as per normal.........
Also your whole set-up seems needlessly complex, why is anything initially disabled to only end up being enabled straight away? Why use reference alias properties instead of object reference properties? I just don't understand.
User avatar
Lil Miss
 
Posts: 3373
Joined: Thu Nov 23, 2006 12:57 pm

Post » Tue Jan 22, 2013 8:12 pm

See if this works:
Scriptname MyBook extends ObjectReferenceEvent OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)  if (newContainer == Game.GetPlayer())		Game.GetPlayer().DropObject(Self, 1)  endifEndEvent
You don't actually have to make a property if the script is attached to the object your dropping.
User avatar
Rude Gurl
 
Posts: 3425
Joined: Wed Aug 08, 2007 9:17 am

Post » Wed Jan 23, 2013 5:44 am

Non Quest Related Activator
The Previous tutorial is only good for those who want to use it in their quest

Follow the same steps in creating only the Activator, the difference between this one is that it does not require a Quest
Just fill in the properties for your Book

Spoiler

ScriptName _S_MyBookActivatorScript Extends ObjectReference  Book Property pBook AutoEvent OnActivate(ObjectReference akActionRef)	ObjectReference pBookRef = Game.GetPlayer().PlaceAtMe(pBook, abInitiallyDisabled = true)	if pBookRef != none		pBookRef.Activate(Game.GetPlayer())		pBookRef.Delete()	endifEndEvent

Does this actually work?
From what I can see, once you interact with the activator you are then dealing with the book, which can then simply be taken as per normal.........
Also your whole set-up seems needlessly complex, why is anything initially disabled to only end up being enabled straight away? Why use reference alias properties instead of object reference properties? I just don't understand.

Yes it works

Book alias is disabled because it is created right next too the BookActivator, no one wants a new instance of the original book plopping up in the world space
The BookActivator can be enabled/disable during quest stages due to it using a Reference Alias from a quest, otherwise if the Quest is not running and the book is still in enabled in the world space, the Book Alias will be filled as a null

Example Quest for this would be
  • Quest Giver -> Go read a book at the temple
  • Book is now enabled for only the quest (OnRead event advances the quest stage, from the Book Alias Script)
  • Player Arrives at Temple, goes to the Altar and reads a few pages then steps back
  • NPC intervenes in a scene and grabs the book (Disabled at the End of the scene, so it looked as it was picked up from the NPC)
You get what i am trying to explain i hope?

If you don't simply want to use it for a quest based, then just use the non quest version of the Activator
User avatar
Harry Hearing
 
Posts: 3366
Joined: Sun Jul 22, 2007 6:19 am

Post » Tue Jan 22, 2013 8:00 pm

Thank you for the help i found a way to do it


i created 2 books
MyBook
MyBook1

i put this script on MyBook1
Scriptname MyBook1 extends ObjectReferenceObjectReference Property ReadBook  AutoEvent OnLoad()  BlockActivation()  SetMotionType(Motion_Keyframed)EndEventEvent OnActivate(ObjectReference reader)  ReadBook.Activate(Game.GetPlayer())EndEvent
and this code on MyBook
Scriptname MyBook extends ObjectReferenceMessage Property ChoiceMessage  AutoObjectReference Property TheItem  AutoObjectReference Property Storage  AutoEvent OnLoad()  SetMotionType(Motion_Keyframed)EndEventFunction ReadMyBook(bool fromWorld)  int choice = ChoiceMessage.Show()  if	 (choice == 0)	; do nothing  elseif (choice == 1)	; Choice 1 code  else	; WTF  endifEndFunctionEvent OnEquipped(Actor reader)  Utility.WaitMenuMode(2.0)  ReadBlockActivation() Blocks normal activation processing on MyBook1 but the UI still shows you and read it and the OnActivate events stills fires

SetMotionType(Motion_Keyframed) stops both books from being moved by the player

i put Mybook1 int my cell where the player can read it
i put a playerchest in the cell where the player can not get to it and i put MyBook on top of it

ReadBook Property in the MyBook1 script is set to the MyBook Object

TheItem Property in the MyBook script is set to the MyBook Object

Storage Property in the MyBook script is set to the PlayerChest

i added the TheItem.MoveTo(Storage) as the ChoiceMessage would not show if i left the book in the chest so for a book with no ChoiceMessage it sould works with out the TheItem.MoveTo(Storage)
User avatar
Lewis Morel
 
Posts: 3431
Joined: Thu Aug 16, 2007 7:40 pm


Return to V - Skyrim