SKKmods Posted December 11, 2021 Posted December 11, 2021 The symptoms you are seeing (have to leave and return) are typically liked to scripts using the OnLoad or OnUnload event or script states to manage settings. If the script runs when the object is created all is good, but if the script is deferred nothing happens until the object can unload and reload in the uGridsToLoad active area around the player.
bud9961 Posted December 11, 2021 Author Posted December 11, 2021 The symptoms you are seeing (have to leave and return) are typically liked to scripts using the OnLoad or OnUnload event or script states to manage settings. If the script runs when the object is created all is good, but if the script is deferred nothing happens until the object can unload and reload in the uGridsToLoad active area around the player.thanks good to know i think im unlikely to make this mistake again lol it turned a 5 min change into a day wasted problem
niston Posted December 12, 2021 Posted December 12, 2021 There is OnInit(), which I use to circumvent this issue. Basically, OnInit fires whenever an object is first introduced to the game and then only ever again when the area around it reset (should never happen for workshops). The area around the object doesn't have to be loaded for OnInit to fire. Event OnInit() Load() EndEvent Event OnLoad() Load() EndEvent Function Load() If (Is3DLoaded()) ; stuff to do only when 3D for the object is loaded Else ; stuff to do only when 3D for the object is not loaded EndIf ; stuff that's always to do EndFunction
Recommended Posts