Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by

TechAngel85

Uploaded by

StepModifications

Virus scan

Safe to use

About this mod

Just In Time - Remastered is JIT, rewritten with simplicity in mind!

Permissions and credits
Changelogs

Just In Time, remastered for simplicity and usability.
Works for Skyrim LE and Skyrim SE.


Just In Time - Remastered (JITR)  is a custom solution for the toggling of lights using triggers and lightweight scripts. This solution allows mod authors to toggle lights on/off based upon the players location/path through a space. The reason this is useful is because toggling lights off that are outside of the player's view is a way to work around the game's light limitations. Surpassing these limitations causes mesh and light flicker issues while moving around an area. JITR is a solution to this problem. It's still JIT, however, the way everything works has been completely remastered.


What's the difference?

Terminology
  • JIT: "LightingBall" & "LightingBallController"
  • JITR: "Light Controller" (Controller for short) & "Light Controller Trigger" (Trigger for short)
To use JIT - Remastered, users should understand the terminology. The original names from JIT were a bit confusing to me when I first started using it. Therefore, JITR updates the names to signify what they're doing. Controllers control the light references. Triggers control when the toggling actions happen; "triggered" by the player. To stay consistent, this terminology is used everywhere from the documentation to the scripts.


Controller Light Reference Limits
  • JIT: 4
  • JITR: 128 (technically)
JIT limited the number of lights that could be used per Controller to 4 because of the way the scripts were written. JIT - Remastered has been rewritten to use an array in place of individual light reference properties. Therefore, JITR is technically limited to 128 references per Controller. I decided to not limit the array for expandability, however, users are recommend to use a realistic number of references per Controller.


Timer Controllers
Timer Controllers work the same as they do in JIT, however, they too have been rewritten to use an array and can support up to 128 references.


Trigger Controller Reference Limits
  • JIT: 4
  • JITR: 128 (technically)
The same is true for the Triggers as for the Controllers. Triggers use an array so the technical limit is 128 Controller references, however again, use a realistic number when implementing. In addition, JIT required at least two Controller references on Triggers due to how the scripts were written. This requirement has been eliminated in JIT - Remastered; thus, Triggers can now use a single Controller reference, if desired.


Door Triggers
Currently, the Door Trigger feature from JIT is not implemented. The code is there but it's untested, thus, is hidden from the scripts. It will likely be added in a future update.


Implementation
JIT has a required way you have to implement it. For example, the references have to be filled in sequential order. Since JIT - Remastered uses arrays, this required implementation has been eliminated. The array will automatically fill, in order, and the entirety of all the scripts have been reworked to use these arrays.


Scripts
With all the changes above, the scripts have been massively simplified and optimized vs JIT. The use of an array for all references and the separation of the Timer feature into its own script has allowed for a great deal of simplification. The scripts are now much smaller than they used to be and written with as little restrictions as possible. As an example, the JIT LightingBall script (now named LightController) was reduced by over 200 lines of code and the Trigger script by nearly 100 lines of code!

Most of the debugging code was stripped along with a few functions because they simply weren't needed after the rewrite. The majority of the remainder of the work was to rewrite the code to use the arrays.



Controller/Trigger Setup
How to use JIT -  Remastered

The main feature of Just In Time - Remastered is being able to toggle lights based on the player's interaction with placed Triggers. A Trigger is always accompanied by one or more Controllers. Users will have to create new triggers in the CK. When creating these new triggers, it is recommended to use a unique name (i.e. Prefix_JITRController) and to attach its corresponding script to the new base trigger. This will prevent users from having to attach the script every time a one of the base triggers are placed. Let's first look at the Triggers using the reference image below.


Reference Image


Light Triggers
Triggers are standard triggers created in the CK. The Primitive Type recommend for Triggers is the Box type. Triggers should be placed at the location where the toggling action should occur. They should be high and wide enough that the player can not accidentally get around the them. Keep in mind the toggle event will happen when the player leaves the Trigger, therefore, don't make them much thicker than what the character can stand in. In the reference image, two Triggers are placed for toggling light references 1 and 3. Notice that the Triggers expand into the walls slightly. This is perfectly okay and is a good practice to ensure the player can't walk around them.

A placed Trigger should have the LightControllerTrigger script attached to it. The following script properties are available:
  • AdvancedDebug
  • DebugMode
  • JITR_Controllers

The Debug features are discussed below. However, the JITR_Controllers property is the array that holds the Controller(s) the Trigger will activate. This is the only required property but it can't be filled until the Controllers are added. Lets go there now...


Controllers
Controllers are also standard triggers created in the CK. The Primitive Type recommend for Controllers is the Sphere type. This is optional and simply helps to distinguish the Controllers from the Triggers. Controllers can be placed anywhere, as long as they're within the same cell as the their Trigger, however,  it's recommended to place them near the Trigger that references them. This helps to keep track of which Triggers active which Controllers. In the reference image there are two Controllers placed near the Triggers.

A placed Controller should have the LightController script attached to it and the script's properties filled. The following properties are available:
  • AdvancedDebug
  • DebugMode
  • JITR_Lights
  • PreventDisable
  • PreventEnable

The Debug features are discussed below. However, the JITR_Lights property is the array that holds the light references the Controller will toggle and it should now be filled. This is the only required property. In the reference image Controller 1 has light reference 3 populated, and Controller 2 has light reference 1 populated.

Now that the Controllers are placed, users can return to the Triggers and populate their arrays. In the reference image Trigger 1 has Controller 1 populated, and Trigger 2 has Controller 2 populated. The setup is now complete.

How it works...
Using the reference image, as the player travels in the direction of the green arrows, they will first run through Trigger 1. Since Controller 1 is connected to it, the lights populated in Controller 1's array will toggle. In the example, light reference 3 is populated to Controller 1 and is set Initially Disabled, meaning it's off. Once the player is leaves Trigger 1, light reference 3 will toggle on before the player rounds the corner and the light's glow is in view.

As the player continues, they will next run through Trigger 2, which has Controller 2 populated in it's array. Since light reference 1 is populated in Controller 2's array, it will toggle off when the player leaves the Trigger. Since light reference 1 is no longer in view, toggling it off allows the placement of more lights that are within the players view, thus eliminating light reference 1 from the engine's light limitation count.

If the player turns around and runs in the opposite direction, the Triggers will work in reverse. This is a very simplistic example of how Just In Time - Remastered is implemented and works.

PreventDisable and PreventEnable
The two remaining properties for the LightController script are used for special cases. Checking them will prevent the populated light references on that Controller from toggling either off or on. These properties can be used where a light may be desired to be toggled on and remain on, or toggled off and remain off, despite the player's interaction with the Trigger the Controller is assigned to. When using PreventDisable, the light references should be Initially Disabled. They will be toggled on by the Trigger, but never turned off again. The reverse is true for PreventEnable. When used, the light references should be enabled. They will be toggled off by the Trigger, but never turned on again.

These properties will affect all lights populated within the Controller's array. Therefore when utilizing one of these properties, separate Controllers should be used with only the light references populated that should be affected by the property. Only one of these properties should be checked on any given controller. Having both checked will break the toggling.


Other Uses
It should be noted that, though JIT - Remastered has been written specifically as a solution for working around the engine's lighting limitations, it can be used for any object reference; it doesn't have to be solely light references populating the Controller array.

For example, if the desire to switch out a burning fireplace and light with a non-burning and non-lit fireplace during specific times of the day, then the Timer Controller could be utilized to accomplish this. The Timer Controller could reference the lit versions of the assets and set the unlit assets as children to the lit version with "Enabled Opposite of Parent". When the Timer Controller hits the Start/End times, the assets will be switch out.



Timer Controllers
Do you have the time?

Timer Controllers are a special Controllers to control the toggling of lights based on time-of-day. These Controllers have their own separate script because they are always used without a Trigger. The script takes care of the toggling, therefore, there is no need for a player-activated Trigger. JIT originally had this feature incorporated into the "LightingBall" script, which is now the "LightController" script.

The Timer Controllers are implemented in the same way are regular Controllers, but without the accompanying Trigger and by attaching the LightControllerTimer script. It is recommended to place Timer Controllers near the lights they control. Once a Timer Controller is placed, it's properties should be filled. The following properties are available for Timer Controllers:
  • JITR_TimerLights - this is the array that holds the light references.
  • OnTimerBeginTime - this is the time the populated references will be toggled on.*
  • OnTimerEndTime -  this is the time the references will be toggled off.*
  • OnTimerUpdateTime - this is the time in seconds the script will check for an update. This should be set to a value greater than 0 for the feature to work (5 will approximately equal 1 game minute).

* OnTimerBeginTime and OnTimerEndTime use "24-hour Clock Time", or "military time" (8am = 08 / 10pm = 20). Setting these times to the same value will result in the populated references remaining enabled.



Error Checking
Bugs ! Bugs! Bugs!

DebugMode
Debug Mode is disabled by default. Users can check it for the script to complete some error checking. This mode is meant to be used one controller(s)/trigger set at a time. Once the single set is complete and working, then Debug Mode should be disabled for script efficiency before the mod is released. The following will be checked while in Debug Mode:
  • Controllers without the JITR_Lights array populated.*
  • Two or more Controllers attached to the same Trigger who have matching light references. (doesn't work so don't do it)
  • Triggers without the JITR_Controllers array populated.*
  • Timer Controllers without the JITR_TimerLights array populated.*
  • Timer Controllers without the OnTimerUpdateTime set or set to 0. (won't work, so delete or set the value > 0)

* without a references attached in the scripts, Controllers and Triggers serve no purpose. Thus, this Debug check is useful for users to know if there are orphaned or bugged assets left in the cell. Orphaned assets should be removed to clean up the mod. If receiving this message on a Controller or Trigger that has the array populated, there is an issue that needs to be addressed. We have no way of knowing what the issue is, but users will need to investigate.

AdvancedDebug
The Advanced Debug option is disabled by default. Enabling it will provide on-screen notifications of the scripts working while in-game. It provides information like variable values and whether or not parts of the scripts are passing checks. This option will only be useful for someone wanting to dive into the script, or someone that is familiar with papyrus and needs to debug where something is failing. Therefore, it is really only for debugging the scripts, themselves.



Remastered Utilization
Where JIT - Remastered is used...

The following mods incorporate Just In Time - Remastered:

If you use JIT - Remastered, please contact me to have your mod linked above.