LivewareCascade Posted December 3, 2015 Share Posted December 3, 2015 Hello, I am producing a modders resource that works similar to the light switch script but takes into account whether the lights have actually been built yet or not. I'm trying to understand the process of calling a script function from another script, but I'm having difficulty understanding the process - I'm thoroughly mystified by the process of casting. Basically you have a script running on a persistent controller objectref (typically an XMarker) called the "controller". This is the one that contains state switching logic for the lights on, lights off, or lightsnotbuilt state. LightsNotBuilt is the entry state, and DOES NOT contain any conditions that enable the script to move out of it's state. This is to make the process of actually "building" the lights entirely event-driven. A second, smaller script acts on a miscitem when the player "builds" the lights at a house workbench. This is the CraftItem script, and enables an initially disabled objectref called "BuildMarker" and then removes itself. A function, LightsBuiltCheck contained in the Controller script checks the Enable State of the build marker, and then moves to Lights On/Lights Off as appropriate. It is this function I am trying to call when the CraftItem script fires. I'm hoping that someone might be able to assist me with the syntax of calling this function, as I've been unable to compile and call it so far. I've managed to specify the Controller script as a parent, but it doesn't appear to do anything. Additionally, given that this function is switching between states in the Controller script, can it still force a movement in states if called within another function? If not, is there a way to specify it's parent script and to force it to change states? The Controller script can be found hereThe CraftItem script can be found here Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 3, 2015 Share Posted December 3, 2015 Just answered you on your other post.....http://forums.nexusmods.com/index.php?/topic/3495335-calling-a-function-in-one-script-from-another/ Link to comment Share on other sites More sharing options...
Recommended Posts