Restcheck (code for mod rest scene compatibility with BG2:EE and other mods). Version 1.07
BCaesar
Member Posts: 480
Full Rest Check version 1.08
Update: One bug fix. In the ToB Imoen romance mod I had forgotten to copy over a Global("ImoenRomanceActive","GLOBAL",2) into restcheck. That's fixed now (it wouldn't have affected anything in the IR-Romance, but it was breaking my mod which used the restcheck code).
What this is:
Rest Check is code to prevent the rest scenes in your mod from triggering at the same time as the dreams and rest scenes in Baldur's Gate II - Enhanced Edition. It will stop any of your rest scenes from triggering before another one does, and for two turns (minutes) of real-time afterward.
The Rest Check Tool is code that triggers a dialogue every time you rest which checks whether or not restcheck is working.
How to add rest check to a mod you have created:
1) Open the restcheck tp2 file (I'm assuming with Notepad++). Copy and paste the contents into your own mod tp2 file, anywhere after BEGIN. If you want to use the restcheck tool then open that tp2 file and copy/paste that on the bottom of your mod tp2 file. Then use Find... (Under Search, or CTRL+F), go to the 'Replace' tab. Find what: ModFolderName and replace it with whatever the actual name of your mod folder is.
2) Copy the restcheck folder and paste it in your mod folder. Do the same with the restchecktool folder if you want to use that as well.
3) Add the following trigger to your mod's rest scenes:
Global("_rc_restcheck","GLOBAL",0)
You do not need to change the prefix.
4) You're done. Now your mod scenes will not trigger on the same rest as any of the in-game dreams or romance rest scenes in Baldur's Gate II - Enhanced Edition.
5) If you added the restchecktool to your mod as well then that will have a separate install option when your mod installs. It's only used for testing purposes. You don't need it for restcheck to work (only to verify that it is working).
Mods using restcheck:
I know of two so far:
Playable Clara and All things Mazzy
Corthala Romantique
Thank you.
-BCaesar
P.S.
Here's an example of the coding from restcheck, so you can see how it works. This is for the very first dream in Baldur's Gate SoA:
Update: One bug fix. In the ToB Imoen romance mod I had forgotten to copy over a Global("ImoenRomanceActive","GLOBAL",2) into restcheck. That's fixed now (it wouldn't have affected anything in the IR-Romance, but it was breaking my mod which used the restcheck code).
What this is:
Rest Check is code to prevent the rest scenes in your mod from triggering at the same time as the dreams and rest scenes in Baldur's Gate II - Enhanced Edition. It will stop any of your rest scenes from triggering before another one does, and for two turns (minutes) of real-time afterward.
The Rest Check Tool is code that triggers a dialogue every time you rest which checks whether or not restcheck is working.
How to add rest check to a mod you have created:
1) Open the restcheck tp2 file (I'm assuming with Notepad++). Copy and paste the contents into your own mod tp2 file, anywhere after BEGIN. If you want to use the restcheck tool then open that tp2 file and copy/paste that on the bottom of your mod tp2 file. Then use Find... (Under Search, or CTRL+F), go to the 'Replace' tab. Find what: ModFolderName and replace it with whatever the actual name of your mod folder is.
2) Copy the restcheck folder and paste it in your mod folder. Do the same with the restchecktool folder if you want to use that as well.
3) Add the following trigger to your mod's rest scenes:
Global("_rc_restcheck","GLOBAL",0)
You do not need to change the prefix.
4) You're done. Now your mod scenes will not trigger on the same rest as any of the in-game dreams or romance rest scenes in Baldur's Gate II - Enhanced Edition.
5) If you added the restchecktool to your mod as well then that will have a separate install option when your mod installs. It's only used for testing purposes. You don't need it for restcheck to work (only to verify that it is working).
Mods using restcheck:
I know of two so far:
Playable Clara and All things Mazzy
Corthala Romantique
Thank you.
-BCaesar
P.S.
Here's an example of the coding from restcheck, so you can see how it works. This is for the very first dream in Baldur's Gate SoA:
So what this does is if all the conditions for this dream are met (meaning it will happen the next time you rest) then it sets Global("_rc_restcheck","GLOBAL",1). On your rest scenes you add the condition trigger: Global("_rc_restcheck","GLOBAL",0), so your scenes will yield to those already in game.
Once the first Imoen dream starts (or any other scene) RestCheck sets Global("_rc_restcheck","GLOBAL",2), meaning that your dreams still will not trigger. Then this coding takes over://Rest check timer. IF Global("_rc_restcheck","GLOBAL",2) THEN RESPONSE #100 SetGlobal("_rc_restcheck","GLOBAL",3) RealSetGlobalTimer("_rc_restchecktimer1","GLOBAL",TWO_TURNS) END IF RealGlobalTimerExpired("_rc_restchecktimer1","GLOBAL") Global("_rc_restcheck","GLOBAL",3) THEN RESPONSE #100 SetGlobal("_rc_restcheck","GLOBAL",0) END </pre>
So once the dream starts and Global("_rc_restcheck","GLOBAL",2) is set then a 2 minute timer (real-time) starts. As long as that timer is running your rest scenes will still yield. This prevents your scene from occuring right after the Imoen dream finishes. After the 2 minutes Rest Check resets Global("_rc_restcheck","GLOBAL",0) meaning your rest scene is able to happen the next time you rest.
A variation of this coding is used for every dream and every romance rest scene in BG2:EE (and for all the Mod rest scenes in Rest Check for Mod Scenes. IF //First Imoen Dream GlobalTimerExpired("ImoenDream1","GLOBAL") Global("HadImoenDream1","GLOBAL",0) GlobalLT("Chapter","GLOBAL",4) Global("_rc_restcheck","GLOBAL",0) THEN RESPONSE #100 SetGlobal("_rc_restcheck","GLOBAL",1) END IF Global("HadImoenDream1","GLOBAL",1) Global("_rc_HadImoenDream1","GLOBAL",0) THEN RESPONSE #100 SetGlobal("_rc_HadImoenDream1","GLOBAL",1) SetGlobal("_rc_restcheck","GLOBAL",2) END </pre>
Post edited by BCaesar on
0
Comments
Then I have the script triggering the dialogue in korgan.baf (the normal file for korgan). Remember the first one is in the dream file: korgand. This way the dream file (korgand) only sets the trigger and then the normal file (korgan) keeps trying to start dialogue until it works (instead of trying only once). It seems to work much more reliably.
1) Keldorn, Edwin, and Nalia romances (I'm not looking up the links, but they're easy to find).
2) Mazzy Friendship: http://www.spellholdstudios.net/ie/mazzyfriendship
3) NPC IEP Banters: http://www.spellholdstudios.net/ie/npciep
4) Haer'Dalis Romance: http://www.spellholdstudios.net/ie/haerdalisromance
5) Sarevok Romance: http://www.spellholdstudios.net/ie/sarevokromance
6) Imoen Romance: http://www.imoen.blindmonkey.org/
7) Yoshimo Romance: http://www.baldursgatemods.com/forums/index.php?board=99.0
Let me know if there's any problems with it. It's been a year since I last messed with it so I may have missed something making this. I do remember that you cannot use this coding in your mod if your mod is any of the ones listed above. It'll create a yielding loop where your mod yields to it's own scenes and break everything.
I have it in my Mazzy/Playable Clara Mod and have confirmed it works with the first three Imoen dream sequences in the Imoen romance mod.
Also, you list Keldorn romance but all I see is a check for his romance active value for Haer'Dalis's rest talk. How is restcheck yielding to rest talks of the Keldorn romance, exactly?
Wow, I really botched that one. What's in the thread is correct. I deleted the readme. Also put the current files in. Ok should all be fixed now. This is what I get for waiting too long inbetween coding.
I had to do a quick change to make all the prefixes right again (they should've been _rc_ instead of _b) but anyways here's the code for the Keldorn file. It works like all the others, with it setting restcheck once the rest scene is ready to trigger, and then setting it to 2 (which starts the timer that eventually gets it back to zero) once the rest scene has already triggered.