Jump to content

[LE] onRead not working


Recommended Posts

Have you tried "OnActivate(ObjectReference akActionRef)" instead of "OnRead()"?

 

It's been a while since I haven't used this function but I vaguely remember I has some issues with some notes too.

 

Not sure if that's your issue, but if your note moves from within a container (satchel) into another container (player), the game probably does not load it and unloaded refs' scripts don't fire.

 

Try dropping the note, then picking it up to read it, see if your script fires then.

Link to comment
Share on other sites

The only way I've found it to slightly work is when the script is only attached to the letter itself

 

the onread doesn't work yet

but when you take it, the quest completes immediately.

Scriptname a027_QSuDBookScript extends ObjectReference  
Quest Property QSuDBookProp  Auto  
Quest Property MyQuest Auto
int Property readStage  Auto  
int Property takeStage Auto

event onRead()
	Utility.wait(0.5)
	MyQuest.SetStage(readStage)
endEvent

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
	if (akNewContainer == Game.GetPlayer())
		MyQuest.setStage(takeStage)
	EndIf
EndEvent
Link to comment
Share on other sites

Hoamii .. i changed the scene to have the letter sitting out , per what u said, and the quest did not start.

 

however after picking it up, and dropping it. Reading it after dropping it started the quest!!! Such a good sight to see..

 

i have a tut for onactivate i havent watched yet, ill start that now and give it a try, since i want this to work the first time you try to read it :wink:

 

 

edit :: can i use onActivate on a book/note ?

Edited by javaplaza
Link to comment
Share on other sites

Sometimes like with the "OnReadSetStage" you might need to put - add a fail safe.


1) First add the "OnRead" Script on the note's Reference menu, add localy.

2) Also add the "OnRead" on the quest menu, as a fail safe, so if the one dosen't fire the other will.

(this is one of the strange bugs i've found in quest making).


* I still don't understand why not use the defaults vanilla script as is.

Edited by maxarturo
Link to comment
Share on other sites

max you said that last time, and im literally copy/pasting the script from another script within the game... is that not vanilla?

 

edit... as i was watching a tutorial for onactivate just now.. it hit me what you're suggesting

you mean for me to use the scripts in the rar file from bethesda ? i guess i hadn't thought of that, im still a novice

 

still doesn't work..lol

Edited by javaplaza
Link to comment
Share on other sites

A. If the script fires when you drop the note and pick it up - and it starts your quest as you want it to, that means your script works fine.

B. If the same script does not work when the note sits in the world and you pick it up to read it (without dropping it first), that means "onRead()" simply does not fire in that instance. For some reason, the game does not consider it as "read" even though your note is obviously loaded.


Several possible workarounds to figure out what's going on and find a solution:

1. Try placing your "OnRead()" script on a book instead of a note, just for test. If it fires, that means your issue is with notes - "OnRead()" still works but not for notes. If that's the case, you can stop trying to use it on a note.

2. Try "OnActivate(...)" on your in-world note.

 

3. Try "OnEquipped()" on your in-world note.

4. Try "OnGrab()" on your in-world note.

5. I read you've tried "OnContainerChanged()" - but did it work when you set it up to start the quest instead of ending it?

To answer your question above: when placed on an object, "OnInit()" will fire as soon as the object is loaded by the game. If it sits in the world, it'll fire the moment you enter the cell which holds it, and that's long before the player even grabs it. If it's sitting in a container the moment you load your game, your "OnInit()" event will only fire the first time your object has 3D loaded, in this instance when you drop it. There's yet another instance when "OnInit() will fire, it's when the script is placed on a craftable object, it will fire every time you craft a new instance of the object (even though, technically you'd think it's not 3D loaded).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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