Here is the global variable script:
Spoiler
Scriptname RedwoodsTools extends Quest{ Global functions used by Redwood's Mods }import gameimport utilityimport mathbool Property MapRequestBool AutoLLNNavOrgScript Function GetLLNO(RedwoodsTools SelfIn) Global ; Should be completely unnecessary. Return SelfIn.NavigationOrgItemEndFunctionFunction UpdateRequest()Debug.Notification("Map request Function Call") If !MapRequestBool ; Will prevent multiple registrations MapRequestBool = True UnRegisterForUpdate() RegisterForSingleUpdate(1) Endif Utility.Wait(5) MapRequestBool = FalseEndFunctionbool Function IsBetween(Float B, Float A, Float C) global if A > C && ( A > B && B > C) return TRUE elseif A < C && (A < B && B < C) return TRUE elseif A == C && A == B ; Special case,all equal return TRUE endif return FALSEendFunctionFloat Function DistanceBetween(Objectreference A,ObjectReference
global ; Returns the distance between 2 objectreferences return A.GetDistance(
; Really just a way to call it without referencing one of the objects in the call.EndFunctionint function RollDice(int Number, int type) global ; Return the result of rolling number Dice with type sides each. int count=0 int Value=http://forums.bethsoft.com/topic/1362677-why-isnt-my-script-seeing-this-global-variable/0 while count < Number Value += RandomInt(1,type) count += 1 endwhile return Valueendfunctionfunction BounceItem(ObjectReference Item) global ; Add a random Havok Impulse to the item. float X = (RollDice(1,360) as float) float Y = (RollDice(1,360) as float) float Z = (RollDice(1,360) as float) float Force = (RollDice(1,99) as Float) Item.ApplyHavokImpulse(X,Y,Z,Force)Endfunction; Variables for Linked List implementationActivator property NodeType Auto ; what type of object are we using as default nodes? Make sure to attach the linked list node script to said object type!FormList property RandomNodeType Auto ; Optional list of random object types for the nodes. Make sure the linked list node script is attatched to all such objects!LinkedListControls property LList Auto ; Dummy node used to call the node creation functions.ObjectReference property NodeAxis AutoActivator Property NodeAxisType Auto ; What type of object is the node axis?ObjectReference Property NodeAxisHideSpot Auto ; Where do we hide the node axis?LLNOrgItem Property NodeOrgItem Auto ; Tvar.NodeOrgItem = For the linked list testing spell, to handle list organization outside the effect.Activator Property NodeOrgItemType Auto ; = The item type for the above organizer item.LLNNavOrgScript Property NavigationOrgItem Auto; Tvar.NavigationOrgItem = The organizer item for Navigatiion node linked lists.Activator Property NavNodeOrgItemType Auto ; = The Item type for the above organizer item.\Bool Property MapRequest=False Auto ; Is there a ship trying to get a map and unable to find the map controller?LinkedListControls Property NavMapList Auto ; Gvar.NavMapList = List of maps for navigation control. Ordinary vanilla linked list.PyramidLLNControllerScript Property RoomNodeControlItem Auto ; The Node Controller for the Pyramid Maze linked listsActivator Property RoomNodeControllerItemType Auto ; The Item Type for the above controller item.ObjectReference Function InitializeLL(ObjectReference NodeAxis,Activator NodeAxisType) Global ObjectReference NewAxis if !NodeAxis ; We haven't got a place to put node lists yet! NewAxis = FindClosestReferenceOfTypeFromRef(NodeAxisType,Game.GetPlayer(),100000) ; Look for one. if !NewAxis ; None in the cell! NewAxis = Game.GetPlayer().PlaceAtMe(NodeAxisType,1,true) ; Emergency...make one! endif endif return NewAxisEndFunctionLinkedListControls Function SetLList(ObjectReference NodeAxis,Activator NodeType) global ; Function to make a dummy node. LinkedListControls NewLList while !NewLList NewLList = (NodeAxis.PlaceAtMe(NodeType,1,true) as LinkedListControls) ; Dummy Linked List node just to use to call functions. endwhile return NewLListEndFunctionEvent OnInit() UnRegisterForUpdate() RegisterForSingleUpdate(1)EndEventEvent OnUpdate() ; Checks periodically to make sure important global variables get filled when needed. string Msg = "Quest OnUpdate:" if !NodeAxis MSG = MSG + " Initialize Node Axis" NodeAxis = InitializeLL(NodeAxis,NodeAxisType) else MSG = MSG + " Node Axis Exists" endif if !LList MSG = MSG + " Make Dummy Item" LList = SetLList(NodeAxis,NodeType) else MSG = MSG + " Dummy Exists" endif if !NavigationOrgItem MSG = MSG + " Make NavOrg" NavigationOrgItem = (NodeAxis.PlaceAtme(NavNodeOrgItemType,1) as LLNNavOrgScript) else MSG = MSG + " NavOrg Exists" endif if !NodeAxis || !LList || !NavigationOrgItem MSG = MSG + " ImpossibleCondition" endif RegisterForSingleUpdate(10.0) Debug.Notification(MSG)EndEventAnd here is the OnInit part of the Script I'm having trouble with:
Scriptname MovingNavigationByTranslatesScript extends ObjectReferenceimport RedwoodsToolsimport UtilityRedwoodsTools Property Gvar Auto ; Global variable Quest Script. Works for every other script that uses it.; Attach this script to the object to be moved.Int Property MapToUse = 0 AutoLinkedListControls property MyMap AutoLinkedListControls Property CurrentInstruction AutoNavigationNodeDataScript property Direction autobool property Updating = False autoLLNNavOrgScript Property MapController Auto ; The Linked list controller item for the maps.Event OnInit() If !Updating Updating = True ; Prevents this from running twice. setMotionType(Motion_Keyframed, TRUE) While !Gvar.NavigationOrgItem ; Wait until Orginizing item is initialized before proceeding. Wait(1.0)Debug.Notification("Waiting for Nav Org Item") ; spams this, despite making 100% sure the variable was initilized. endwhileDebug.Notification("Gvar.NavigationOrgItem Initialized.") While !MapController MapController = Gvar.NavigationOrgItem ; Never gets here. EndWhile while !MyMapDebug.Notification("Map Controller loaded. Getting Map for "+name) MyMap = MapController.GetMap(MapToUse) if !MyMap MapController.MakeMaps()Debug.Notification("Trying to make maps for "+Name) Wait(5.0) Endif endWhileDebug.Notification("Map Loaded for "+Name) CurrentInstruction = MyMap.First Direction = (CurrentInstruction.Data as NavigationNodeDataScript) Gvar.MapRequestBool = False Updating = False EndifEndEventWhen I boot the game up from a completely clean save, the quest script goes through it's update once initializing the variables, then repeatedly verifying that they're still loaded, but the other script gets stuck in the while loop checking whether one of the three variables is initialized...at the same time that the quest's update is repeatedly verifying it.
All the other parts of my mod that use this variable script have worked just fine. Why doesn't this one?
I've tried everything obvious, and quite a few things that aren't. The Gvar property is correctly assigned to the quest, the script isn't running multiple threads (At least I'm pretty darn sure it isn't...) and it's not on any other objects, only on the global variable quest. I know that both scripts are running, and that the variables are loaded...so what could possibly be causing this?

