pepperman35 Posted July 6, 2021 Share Posted July 6, 2021 Okay, I have a terminal setup with four entries. The Papyrus Fragment for each looks like the following. Can I get away with using the bool doOnce in this manner or do I need a unique name for each (e.g., doOnce01, doOnce02, doOnce03, doOnce04)? Thus far, neither approach seems to be working for me. As the MLS_SubStationProtocolScript takes some time to process, I’d like to prevent the player from selecting each entry more than once. Connect Settlements in Quadrant #1bool doOnce = FalseIf(doOnce == False) doOnce = True (akTerminalRef as MysticLake:MLS_SubStationProtocolScript).SubstationsinQuad1()EndIf Connect Settlements in Quadrant #2bool doOnce = FalseIf(doOnce == False) doOnce = True (akTerminalRef as MysticLake:MLS_SubStationProtocolScript).SubstationsinQuad2()EndIf Connect Settlements in Quadrant #3bool doOnce = FalseIf(doOnce == False) doOnce = True (akTerminalRef as MysticLake:MLS_SubStationProtocolScript).SubstationsinQuad3()EndIf Connect Settlements in Quadrant #4bool doOnce = FalseIf(doOnce == False) doOnce = True (akTerminalRef as MysticLake:MLS_SubStationProtocolScript).SubstationsinQuad4()EndIf Link to comment Share on other sites More sharing options...
dylbill Posted July 6, 2021 Share Posted July 6, 2021 With fragments, I believe they make a new instance every time they are used, so doOnce will always be false doing it that way. You can try to add a bool property for each fragment, and in this case they would need different names I think. Or you can use separate global variables for each fragment instead. Link to comment Share on other sites More sharing options...
SKKmods Posted July 6, 2021 Share Posted July 6, 2021 Script fragment variables are temporary create/destroy as the fragment runs, they are not persistent. Creating persistent script level variables in fragments is difficult to do and maintain. Suggestions: (a) Create GlobalVariables for each doOnce and .getValue() .setValue() on them in the fragments.if pMyQuadrant01DoOnce.GetValue() == 0...pMyQuadrant01DoOnce.SetValue(1) (b) Create a quest attached master script that holds script persistent variables, likeif (pMyQuestName as MyQuestNameScript).bQuadrant01DoOnce = = false...(pMyQuestName as MyQuestNameScript).bQuadrant01DoOnce = true © have an actor value on the actual object to .getValue() .setValue() on the ObjectReferences in the fragments (dirty business holding Objectreferences in script properties):if Quadrant1Substation.GetValue(pMyDoOnce) == 0...Quadrant1Substation.SetValue(pMyDoOnce, 1) Link to comment Share on other sites More sharing options...
pepperman35 Posted July 6, 2021 Author Share Posted July 6, 2021 Thanks guys for the input and suggestions. I think I have a way forward. Link to comment Share on other sites More sharing options...
Recommended Posts