Jump to content

Photo

Is it possible to open a book with an activator?

script

  • Please log in to reply
8 replies to this topic

#1
JPTR1

JPTR1

    Old hand

  • Members
  • PipPipPip
  • 501 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?

 

 

 

 

Attached Files

  • Attached File  map.jpg   194.92KB   1 downloads


#2
dylbill

dylbill

    Resident poster

  • Premium Member
  • 2,923 posts

Yes, Instead of adding to player inventory you can do: 

 

BookRef.Activate(Game.GetPlayer()) 

 

which makes the Player activate your BookRef 



#3
JPTR1

JPTR1

    Old hand

  • Members
  • PipPipPip
  • 501 posts

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.

 

Spoiler

 


Edited by JPTR1, 18 June 2022 - 04:48 PM.


#4
dylbill

dylbill

    Resident poster

  • Premium Member
  • 2,923 posts

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.creation...enuClose_-_Form

 

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



#5
JPTR1

JPTR1

    Old hand

  • Members
  • PipPipPip
  • 501 posts

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. 



#6
dylbill

dylbill

    Resident poster

  • Premium Member
  • 2,923 posts
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

#7
JPTR1

JPTR1

    Old hand

  • Members
  • PipPipPip
  • 501 posts

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


Edited by JPTR1, 19 June 2022 - 01:52 PM.


#8
dylbill

dylbill

    Resident poster

  • Premium Member
  • 2,923 posts

No problem. Happy Modding :)



#9
VampiricEmpress

VampiricEmpress

    Newbie

  • Members
  • Pip
  • 17 posts

Anything that can be activated(has a type of prompt to do an action) can be uh activated with Activate(). Doors, books, actors, chests, etc.


Edited by VampiricEmpress, 26 June 2022 - 06:00 AM.






Also tagged with one or more of these keywords: script

IPB skins by Skinbox
Page loaded in: 0.937 seconds