I've begun writing a script that adds some OBGE screen effects to vanilla quests. I know OBSE topics aren't covered here, but that's not the focus of the advice I'm looking for anyway. I've put together a skeleton of the script to manage some special effects for the dream sequence portion of the Bravil "Through a Nightmare, Darkly" quest. No OBSE/OBGE specific code is included. This quest script just controls when the effects are turned on and off. Pretty basic. I wouldn't mind some input though, since I'm trying to come up with some conventions that will help me keep my script-writing clean and consistent, and hopefully avoid a few pitfalls as a bonus. I'd appreciate any comments on style, approach, or general script hygiene you care to share.
ScriptName OBGEScreenEffectsMS05Script
; Convenience constants
short FALSE = 0
short TRUE = 1
; Processing control flags
short bDelayTweaksOn = FALSE
short bRelaxTweaks = FALSE
short bKillEffectsProcessing = FALSE
float fQuestDelayTime
Begin GameMode
;===================================================================================
; Script processing controllers - tweaks script execution delays for better frame sync when close to
; dream-state transitions. Tweaks are relaxed between transitions (when not close to final transition) to
; lighten CPU overhead. Processing is halted here after final transition.
;===================================================================================
If (GetStage MS05 > 10 && bDelayTweaksOn == FALSE)
Set fQuestDelayTime to 1
Set bDelayTweaksOn to TRUE
EndIf
If (bRelaxTweaks == TRUE)
Set fQuestDelayTime to 1
Set bRelaxTweaks to FALSE
EndIf
If (GetStage MS05 == 40 || GetStage MS05 == 75)
Set fQuestDelayTime to 0.01
EndIf
If (bKillEffectsProcessing == TRUE)
StopQuest MS05ScreenEffects
Return
EndIf
;=============================
; Dream sequence effects controllers
;=============================
; Detect player entered in-dream quest stages and start effects
If (GetStage MS05 == 50)
; Start dream sequence effects
; Relax script processing
Set bRelaxTweaks to TRUE
EndIf
; Detect player left in-dream quest stages and stop effects
If (GetStage MS05 >= 80)
; Stop dream sequence effects
Set bKillEffectsProcessing to TRUE
EndIf
End
Things to note:
Since I'm indirectly modifying a vanilla quest, I decided to make a separate quest and quest script to monitor progress through the target quest instead of modifying the original or adding activator objects to cells. From what I've read, quests aren't the most efficient way to run a script, but as far as I can see it's the closest thing to a global script that Oblivion has. And it should help avoid compatibility issues with other mods that might alter either Bravil interiors or quests. Blood & Mud comes to mind, but I haven't checked it. Thoughts? Counter-points? I've added convenience constants for clarity. I haven't tested to see if C-style declaration/initialization combos work in TES scripting yet. They compile, but the script engine may ignore everything after the variable declaration for all I know. A pointer there would be nice, but I'll find out sooner or later. If it does work, what do you think of the convention?
My first script, so be nice Thanks in advance!