lesi123 Posted November 14, 2016 Share Posted November 14, 2016 I’m trying to set up a new MCM for my mod that has two quests that can be started or stopped at any time. Using Stop() has no issues but using Start() causes the MCM to freeze until you exit completely out of the menu. I’ve tried using RegisterForSingleUpdate(0.25) so that when you exit the menu, the OnUpdate block fires to start up the quest. However, if you were to select to enable the quest and then (without closing the menu) decide to keep it disabled, the OnUpdate still fires. It also seems to get a little complicated since there are two quests involved. Is there a better way to do this or am I missing something? Link to comment Share on other sites More sharing options...
FrankFamily Posted November 14, 2016 Share Posted November 14, 2016 "if you were to select to enable the quest and then (without closing the menu) decide to keep it disabled, the OnUpdate still fires." you could unregisterforupdate if the quest is disabled, should avoid that i think. Link to comment Share on other sites More sharing options...
lesi123 Posted November 14, 2016 Author Share Posted November 14, 2016 Ah, I didn't think to use that. I'll give it a try and report back. Link to comment Share on other sites More sharing options...
lesi123 Posted November 14, 2016 Author Share Posted November 14, 2016 Using UnregisterForUpdate works perfectly if I'm using it to start and stop a single quest, but having two different quests was causing one to unregister if I were to select to start both, then decide to stop one while still in the menu. I was able to fix the issue by using RegisterForSingleUpdate for each index check and put all four possible combos in the OnUpdate block so everything related to stopping and starting the quests would be handled once the menu was closed: event OnOptionMenuAccept(int option, int index) if (option == QuestAOID_M) QuestAIndex = index SetMenuOptionValue(QuestAOID_M, QuestAList[QuestAIndex]) if (index == 0) RegisterForSingleUpdate(0.25) elseif (index == 1) RegisterForSingleUpdate(0.25) endif elseif (option == QuestBOID_M) QuestBIndex = index SetMenuOptionValue(QuestBOID_M, QuestBList[QuestBIndex]) if (index == 0) RegisterForSingleUpdate(0.25) elseif (index == 1) RegisterForSingleUpdate(0.25) endif endif endEvent Event OnUpdate() if (QuestAIndex == 1) && (QuestBIndex == 1) QuestA.Start() QuestB.Start() Debug.Messagebox("Quest A and B have started.") elseif (QuestAIndex == 0) && (QuestBIndex == 0) QuestA.Stop() QuestB.Stop() Debug.Messagebox("Quest A and B have stopped.") elseif (QuestAIndex == 1) && (QuestBIndex == 0) QuestA.Start() QuestB.Stop() Debug.Messagebox("Quest A has started. Quest B has stopped.") elseif (QuestAIndex == 0) && (QuestBIndex == 1) QuestA.Stop() QuestB.Start() Debug.Messagebox("Quest A has stopped. Quest B has started.") endif endEvent Even though Unregister didn't work out, it helped put me on the right track. Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts