Jump to content

Is it possible to open a book with an activator?


JPTR1

Recommended Posts

Good morning!

 

I made a map as an static object hanging on the wall with an activator on it. If the player clicks the activator it disables the static map and adds the map (book form) in the players inventory.

Could i add something to the script, so that the player UI opens/reads the map before it gets added to the inventory? Just like if you pick up a book directly with the "read" action.

 

I tried placing the map item somewhere and let it be activated by my trigger, but that was too easy and didn't work. :laugh:

 

Self.GetLinkedRef(LinkedRefKeyword).Activate(Self) - Is there an read command maybe to replace activate?

 

 

 

 

Link to comment
Share on other sites

Fantastic, "it just works" (realy)

Thanks again dylbill! :thumbsup:

 

Maybe do you have an idea for a solution if the reading screen is left with ESC? The note is gone then, my trigger too ofc. It's not a big thing, but probably players want the map keep hanging there, so they leave with ESC.

 

 

 

Scriptname MansionTakeFloorMap02B extends ObjectReference
{Take the map}

ObjectReference Property OrbOfChildhood Auto
ObjectReference Property ActivatorBox Auto
ObjectReference Property BookRef Auto

Event OnActivate(ObjectReference akActionRef)
OrbOfChildhood.disable()
Self.BookRef.Activate(Game.GetPlayer())
ActivatorBox.enable()
EndEvent


Edited by JPTR1
Link to comment
Share on other sites

No Problem. What is the OrbOfChildhood? Is that the map activator? If so, you can re-enable it after the menu closes if the player doesn't have the book in their inventory. For none skse you can use Utility.wait(0.1) to wait till the menu closes.

 

Event OnActivate(ObjectReference akActionRef)
    OrbOfChildhood.disable()
    Self.BookRef.Activate(Game.GetPlayer())
    ActivatorBox.enable()
    Utility.wait(0.1) ;wait for book menu to close
    if Game.GetPlayer().GetItemCount(BookRef) == 0 
        OrbOfChildhood.enable() 
    Endif
EndEvent

This won't work if skyrim souls is installed though, cause that unpauses the game during menus. To account for that you can use skse's registerForMenu("Book Menu") and OnMenuClose to detect when the menu closes. https://www.creationkit.com/index.php?title=OnMenuClose_-_Form

 

Be sure to unregisterForMenu in the OnMenuClose event so it only fires once.

Link to comment
Share on other sites

OrbofChildhood in this case is the static map.

ActivatorBox enables an XMarker, which removes the trigger as its parent.

 

I see this "Souls mod" is widely spreaded, so maybe to avoid the wait function i could simply let enable a triggerbox(actorzone, with the static map as parent) with the "GetItemCount(BookRef) == 0" check. So everytime the map is taken it will check and re-enable the mapTriggers if it was not taken, when leaving the room for example. Not the most immersive solution, but the result would be fine.

 

Now you wrote some things i never focused on. Is there any point in keeping it "none skse"? I have so much scripts now, how do i know if SKSE is needed? And is SKSE compatible with all Skyrim editions now? Sry i'm realy not into this, if this is escalating the topic just ignore it.

Link to comment
Share on other sites

The reason to keep it none skse is if you want to upload your mid to xbox, otherwise using skae shouldnt be a problem. To tell if it requires skse, check the functions and events on the creation kit wiki. It says at the top if it requires skse
Link to comment
Share on other sites

Much thanks dylbill! Just saw i havn't even installed SKSE right now, so i assume all should be fine.

Edited by JPTR1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...