antstubell Posted October 31, 2020 Share Posted October 31, 2020 I'm going a little mad here because I'm sure I've done this before. Honestly all I ask is for somebody to take a quick look and fix it. It's a on activate toggle global value script with a notification to aid with my other scripting. Thank you and I know it sounds lazy but really a quick fix and lesson will be learnt. Actor Property PlayerRef AutoFloat Property Delay AutoGlobalVariable Property MyGlobal AutoAuto State WaitingEvent OnActivate(ObjectReference akActionRef)if akActionRef == PlayerREFGotoState("Busy")If MyGlobal.GetValue() == 0MyGlobal.SetValue(1)debug.notification("Global = "+ MyGlobal)Utility.wait(delay); time for animElseIf MyGlobal.GetValue() == 1MyGlobal.SetValue(0)debug.notification("Global = "+ MyGlobal)Utility.wait(delay); time for animGoToState("Done")EndIfEndIfEndEventEndState Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 31, 2020 Share Posted October 31, 2020 Currently, when the object is activated the first time it moves to the busy state. If the global variable value is 0 it does stuff and ends the block leaving the script in the busy state. If the global variable value is 1 instead it does some stuff and moves the script to the done state. In this setup the activation will never process again. I suggest that the GoToState("Done") be changed to GoToState("Waiting") and dropped down below the first EndIf. That way the script will go to the busy state and process something if the global variable value is 0 or 1 else it will just switch back to the waiting state. But if you have stuff in the Done state (that you did not include in the snippet) that moves the script back to the waiting state, then you need to check there to see what could be blocking the state switch. Link to comment Share on other sites More sharing options...
antstubell Posted November 1, 2020 Author Share Posted November 1, 2020 Kind of stupid of me. I wrote the script for a switch that I thought player would need to use once. Then I thought why would a switch on a generator only be allowed to turn off? I could make some s**t up but that would require at least some reasonable explanation somewhere. Anyways, you're correct about the state. The issue I have now is that the notification that displays, whether the global is 0 or 1 is this Global = [GlobalValue Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 1, 2020 Share Posted November 1, 2020 Change:debug.notification("Global = "+ MyGlobal)todebug.notification("Global = "+ MyGlobal.GetValue()) or use GetValueInt() if you do not want a float value shown Link to comment Share on other sites More sharing options...
antstubell Posted November 2, 2020 Author Share Posted November 2, 2020 Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts