Jump to content

Recommended Posts

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 #1

bool doOnce = False

If(doOnce == False)

doOnce = True

(akTerminalRef as MysticLake:MLS_SubStationProtocolScript).SubstationsinQuad1()

EndIf

 

Connect Settlements in Quadrant #2

bool doOnce = False

If(doOnce == False)

doOnce = True

(akTerminalRef as MysticLake:MLS_SubStationProtocolScript).SubstationsinQuad2()

EndIf

 

Connect Settlements in Quadrant #3

bool doOnce = False

If(doOnce == False)

doOnce = True

(akTerminalRef as MysticLake:MLS_SubStationProtocolScript).SubstationsinQuad3()

EndIf

 

Connect Settlements in Quadrant #4

bool doOnce = False

If(doOnce == False)

doOnce = True

(akTerminalRef as MysticLake:MLS_SubStationProtocolScript).SubstationsinQuad4()

EndIf

 

 

Link to comment
Share on other sites

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

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, like

if (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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...