Jump to content

Generator activated via a terminal


Recommended Posts

Okay, I thought I knew how to do this but was obviously WRONG. Lol. Not the first time mind you, and certainly not the last. Okay, so here is what I want to do.

  1. Have a Generator – Fusion (DLC02WorkshopGeneratorFusion) placed in the world and linked to the respective WorkshopRef with the keyword WorkshopItemKeyword.
    1. I’d like for this generator to begin in an OFF start and not be directly activatable by the player.
    2. Instead, as part of a quest, I’d like to activate it via a terminal.
  2. I removed the keyword WorkshopStartPoweredOn from the generator and replaced it with WorkshopStartUnpoweredOff. I also added the BlockPlayerActivation keyword. Furthermore, I added LinkTerminalSwitch keyword and set the Native Terminal to nativeWorkshopSwitchTerminal.
  3. I added a terminal and linked it to the generator.

Upon checking, the Generator is not starting in the OFF start as expected. Obviously, must be missing something in my setup. Advice welcomed and appreciated.

 

Link to comment
Share on other sites

How about an OnLoad handler that calls Activate when the generator first loads? Maybe and a FirstTime auto state so that only happens once and doesn't turn the generator off every time the player leaves and comes back.

Link to comment
Share on other sites

You can attach a script like this to the generator:

ActorValue Property PowerGenerated Auto Const


Event OnWorkshopObjectPlaced(ObjectReference akReference)

   Utility.Wait(0.2)

   If Self.GetValue(PowerGenerated) > 0

      Self.Activate()

   EndIf  

EndEvent

It should turn off the generator when you first place it.

Link to comment
Share on other sites

Okay, thanks for the script. While this work on the object (generator) if the generator is placed via the CK?

 

It will. You just need to attach a script to the generator (DLC02WorkshopGeneratorFusion). I've made the code for you:

Scriptname YOURSCRIPTNAME extends ObjectReference Const

ActorValue Property PowerGenerated Auto Const


Event OnWorkshopObjectPlaced(ObjectReference akReference)

   Utility.Wait(0.2)

   If Self.GetValue(PowerGenerated) > 0

      Activate(Self)

   EndIf  

EndEvent

Link to comment
Share on other sites

How about an OnLoad handler that calls Activate when the generator first loads? Maybe and a FirstTime auto state so that only happens once and doesn't turn the generator off every time the player leaves and comes back.

DocClox, I tried your idea as well. I don't have much experience and/or understanding of STATES but here is what I can up with

Scriptname MysticLake:GenSetToOFF extends ObjectReference Hidden Conditional
{Script designed to set the initial state of a generator/reactor to OFF so 
that it can be turned on via a terminal.  Script is placed on generator/reactor 
of interest.}
;
;-- Properties --------------------------------------
;

ObjectReference Property theGenerator Auto Const Mandatory
GlobalVariable Property GeneratorFlagGlobal Auto Const Mandatory
;
;-- Variables ---------------------------------------
;
;-- State ---------------------------------------
;
auto state GeneratorOFF
	Event OnLoad()
		Utility.Wait(5.0)
		if (theGenerator.Is3DLoaded() && GeneratorFlagGlobal.GetValue() == 0 as float)
			theGenerator.SetOpen(True)
			GeneratorFlagGlobal.SetValue(1 as float)
		Else
			gotoState("DoNothing")
		EndIf
	EndEvent
endState
State DoNothing
	;do nothing
endState

I think this would work as long as one used it on a single generator. Anywho, we have some methods documented for future posterity. BTW, I tried using the Default2StateActivator on the generator but could not get that to work.

Link to comment
Share on other sites

I think you need an empty OnLoad() handler in the DoNothing state

State DoNothing
    Event OnLoad()
            ;do nothing
    EndEvent
endState

You might get away with it in Fo4, but Skyrim was always picky about that sort of thing.

 

 

I think this would work as long as one used it on a single generator.

Nah. Each placed generator is an objectref, and each one has its own script instance, and it's own state.

 

That said, if you're placing them from the workshop, OnWorkshopObjectPlaced is a better solution, although may still want the state to stop the generator from turning off each time it's moved. (Or that might be useful behavior, depending on the situation). If you're placing from the CK, I'd go with OnLoad every time.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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