Jump to content

[LE] Anyway to make a script fire when 'any' book is read?


Baaleos

Recommended Posts

I am looking at Remote Events

Event OnInit()
; Register for Activate event from the secret door
RegisterForRemoteEvent(SecretDoor, "OnActivate")
EndEvent
 
; Special event to receive when the door is activated
; Note the type in the event name matches the type of the first parameter, and is also the script where the
; event is originally defined.
Event ObjectReference.OnActivate(ObjectReference akSender, ObjectReference akActionRef)
Debug.Trace(akSender + " was activated by " + akActionRef)
EndEvent

Which looks like it will allow me to do what I want without having to bind a script to every book in the game.
However, I am unsure how to populate the first field of the RegisterForRemoteEvent

Since this field needs to be the book that is being read.

Is there a way with Quest Alias' to make it match any book in the game?

I am basically trying to get a script to fire when someone reads any book - just as a short cut to having to edit hundreds of form objects to add a script call.

Link to comment
Share on other sites

Isn't that a fallout 4 event?

 

 

OnRead exists in Skyrim as far as I know.

at the moment, the only way I know to detect it is by attaching the event to the book itself.

But remote events would be able to detect it - in theory.

If I found a way to bind it to all books.

Link to comment
Share on other sites

Extra:

 

I have tested this and it works. If you want to catch books the player reads from their inventory, OnObjectEquipped fires for that. Attach this script to the player somehow and test it.

 

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
	if akBaseObject as Book
		Debug.Trace("This actor just equipped a book!")
	endIf
endEvent
Edited by B1gBadDaddy
Link to comment
Share on other sites

Extra:

 

I have tested this and it works. If you want to catch books the player reads from their inventory, OnObjectEquipped fires for that. Attach this script to the player somehow and test it.

 

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
	if akBaseObject as Book
		Debug.Trace("This actor just equipped a book!")
	endIf
endEvent

Thanks for solving that for me.

Someone contacted me asking for assistance with getting their mod created.

They were on the verge of going through every book form adding a script to it, but this solution is much easier.

 

Link to comment
Share on other sites

  • 1 year later...

what an awesome script

 

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
	if akBaseObject as Book
		Debug.Trace("This actor just equipped a book!")
	endIf
endEvent
Edited by javaplaza
Link to comment
Share on other sites

  • Recently Browsing   0 members

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