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 toggling 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. It's useful to toggle lights off that are outside the player's view as 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.

Though the intended purpose of JIT - Remastered is a solution for working around the engine's lighting limitations, any object reference can be filled into the arrays. Therefore, authors/users can implement them in various ways. For example, one could switch out a burning fireplace with a non-burning fireplace at specific times of the day by using the Timer Controller. Or one could enable specific enemies or bosses based on the players route through an area. That's not to say there aren't other ways to do these things, however, JITR can be used to do several things with an easy and quick setup.


What's the difference between JIT and JITR?

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.

Reference Limits
  • JIT: 4
  • JITR: 128 (technically)
JIT limited the number of how many things that could be connected to 4 because of the way the scripts were written. JIT - Remastered has been rewritten to use an array in place of individual reference Properties. Therefore, JITR is technically limited to 128 references Controller/Trigger. It was decided to not limit the array for expandability, however, users are recommend to use a realistic number of references per Controller/Trigger. Additionally, users have the option to fade or pop in/out the attached references; something missing from the original JIT.

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
The original JIT has a required way you have to implement it due to how it's coded (e.g., 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.
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.

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 implementation has allowed for a great deal of simplification. The scripts are now much smaller 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 weren't needed after the rewrite. The majority of the remainder of the work was to rewrite the code to use 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
  • Fade
  • JITR_Controllers

The Debug features are discussed below. Fade is disabled by default. Enabling it will attempt to fade the attached references in/out. By default the references "pop" in/out. 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.



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:
  • Fade - edit and tick this box to attempt to fade the attached references in/out. Disabled by default, which "pops" references in/out.
    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.