Jump to content

Quest Stage keeps resetting, I think because of a script


Recommended Posts

So, I'm making a custom follower mod, and making quite a lot of dialogue. At one point, the NPC (Kimberly) will want to be alone for 24 hours, before being available to be a companion. Here's how I accomplish this.

 

A conversation leads to her saying she wants to be left alone, and sets the quest stage to 40. The 40 quest stage has a papyrus fragment pointing to a function in a script. This is the script

 

Scriptname KimberlyRelaxTimer extends Quest
Function Relax()
StartTimerGameTime(24, 1)
EndFunction
Event OnTimerGameTime(int timerID)
if (timerID == 1)
(Self as Quest).SetStage(50)
endif
EndEvent
As you can see, the script waits 24 hours, then should set the parent quest stage to 50, and be over, At the quest stage of 50, Kimberly has dialogue to enable her being a follower. If you accept her as a follower, it sets the quest stage to 10, which has a papyrus fragment to make her follow you, along with all her regular dialogue.
FollowersScript.GetScript().SetCompanion(Kimberly.GetActorReference())
Up to here, it works flawlessly. However, here's my issue. It enables her as a follower perfectly fine, and she follows. However, her dialogue goes back to the stage 50 dialogue. If I use the GetStage console command, it shows me stage 50. If I use SetStage to set it to 10, then check the stage again, it's still 50. I cannot for the life of me figure it out.
I'm pretty much a complete novice with scripting, and what I have there is just learned from Seddon4494's YouTube tutorials. If anyone can help, that would be fantastic. Thanks!
UPDATE: I now know that this is how it's designed, and that the quest stages can't go in reverse. Thanks.
Edited by sgtmcbiscuits
Link to comment
Share on other sites

Are you testing on a save that is done before your mod was installed? Quests might be tricky if testing on "old" save.

 

Also, check that any dialogue isn't setting stages where you don't want it.. tho that doesn't make much sense if it doesn't work even on SetStage command.

 

Other than that.. hmmh, double check you are trying to set stage on right quest and no script is resetting it for some reason. I'm working on a companion mod too and using same function FollowersScript.GetScript().SetCompanion(xxx.GetActorReference()), and everything works here so thats pretty much all ideas I have.

 

Also try checking vanilla companion quests if you can see anything there you are missing.

Edited by vkz89q
Link to comment
Share on other sites

did you remember to cancel your timer? CancelTimerGameTime(1) ? as your example above shows it will fire off every 24 hours and sense you have repeat stages checked, set the current stage to 50 again.

 

I didn't have that in the script, but I just put it in there and it didn't change things.

 

Are you testing on a save that is done before your mod was installed? Quests might be tricky if testing on "old" save.

 

Also, check that any dialogue isn't setting stages where you don't want it.. tho that doesn't make much sense if it doesn't work even on SetStage command.

 

Other than that.. hmmh, double check you are trying to set stage on right quest and no script is resetting it for some reason. I'm working on a companion mod too and using same function FollowersScript.GetScript().SetCompanion(xxx.GetActorReference()), and everything works here so thats pretty much all ideas I have.

 

Also try checking vanilla companion quests if you can see anything there you are missing.

 

1) I'm testing it on an existing save, but not one that had this mod installed previously. I'm loading a save, going to meet the NPC for the first time, going through the dialogue, etc. I'll try on a new save, but I don't think it should change things.

 

2) No dialogue in the entire mod sets the stage to 50 (the script does)

 

3) Making the NPC follow me isn't the issue, so I know it's the right stage and everything. It seems like it switches to stage 10 (The stage to recruit the NPC) for just a moment, enough to load the script to make the NPC my follower, but then switches back to stage 50. The NPC still follows me.

 

4) The only script that sets the stage to 50 is the timer, which is only called on in stage 40. It seems like the script is constantly setting the stage to 50, not just once.

 

 

Again, I'm rather new to scripting, so I have a hard time wrapping my head around some of the functions and stuff like that. But what seems to me that's happening is that the script sets the timer perfectly, then once the timer expires, it sets the stage to 50, like it should. But, it KEEPS setting the stage to 50, forever. That's what seems to be happening, at least.

 

Also, to ensure it wasn't dialogue bugs, I set the stage 50 dialogue to only play when the NPC is NOT a follower (this shouldn't be needed, as stage 50 should only be used when the NPC isn't a follower). With it set that way, the NPC just says idle greetings after being recruited, nothing else. So it definitely seems to be an issue with the quest stage constantly being set to 50 by some script or something.

 

Thanks for all the help so far, hopefully we can figure this out!

Link to comment
Share on other sites

An update, I did some testing, and it appears that the script isn't the problem. It's that, for some reason, the quest refuses to be set to any stage with a lower number. I set the recruiting stage to 60, rather than 10, and it worked flawlessly. Switching it back to 10, however, keeps the stage stuck at 50. Very strange... I'll have to look into this more.

 

UPDATE: I now know that this is how it's designed, and that the quest stages can't go in reverse. Thanks.

Edited by sgtmcbiscuits
Link to comment
Share on other sites

Uhh, seems like I learn something new everyday. Yes, seems like quest stage can't go lower no matter what. It will still run the fragment tho, that's why I never noticed lol. And thats why vanilla companion quests use globals(or actor values) to see what dialogue to run(like hatred/love etc).

 

For example, it will still run the Pickup companion fragment in stage 80 if you set it from stage 90, but quest stage remains in 90. Only way to go back is to run Reset(), but it resets aliases too.

Edited by vkz89q
Link to comment
Share on other sites

  • Recently Browsing   0 members

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