Jump to content

Help with some papyrus


Recommended Posts

Hi there,

 

So I'm trying to have a lightswitch which can toggle on and off the lighting of the room which can ultimately only be used if the Circuit Breaker has enabled an XMarker. Here's my isse.

  • The first time I tried to do this, I set the master XMarker as an enable parent to all room XMarkers. That, obviously, wouldn't work as then the lightswitches could not toggle their respective XMarker as it's enable state was already being controlled by the master XMarker.
  • The second time I attempted this I tried to get the lightswitch script to check if the master XMarker was enabled, then if it was to pass the normal function of the lightswitch. Now, I think that I'm on the right track here however the script itself is wrong.
Scriptname CorridorToggle extends ObjectReference

ObjectReference Property CorridorLightMarker Auto

Event OnActivate(ObjectReference akActionRef)
	If (MasterLightMarkerTEST.IsEnabled())
		CorridorLightMarker.enable()
		If (CorridorLightMarker.IsEnabled())
			CorridorLightMarker.disable()
		Else
			CorridorLightMarker.enable()
		EndIf
	EndIf
EndEvent


ObjectReference Property MasterLightMarkerTEST Auto Const

This is an example of the code I am using on each lightswitch.

 

How would I edit this so that the script first checks if the MasterLightMarkerTEST is enabled, then passes the event OnActivate?

Edited by HuzzahBritain
Link to comment
Share on other sites

I'm not really sure if I understand your problem, but

Scriptname CorridorToggle extends ObjectReference

ObjectReference Property CorridorLightMarker Auto

Event OnActivate(ObjectReference akActionRef)
    If (CorridorLightMarker.IsEnabled())
        CorridorLightMarker.disable()
    Else
        CorridorLightMarker.enable()
    EndIf
EndEvent

This should be enough.

CorridorLightMarker should be the enable parent of all your lights.

 

I don't know if you even can use an XMarker for enable parent. There is a special type of object for that, it looks like the recycle symbol, with two arrows in a circle. It should be called something like "EnableParent", too.

Link to comment
Share on other sites

Not 100% certain but you can use pretty much anything as an enable parent. The fusion generator script for example uses a LGHT object for its flickering animation, which is done by enabling/disabling the light. That LGHT (a spotlight-type that points to the ground) is used as an enable parent for an omnilight-type LGHT object positioned below the spotlight.

 

I haven't tried all types but the script accepts any ObjectReference and I've seen literally all kinds of objects used as enable parents while poking through Fallout4.esm.

Link to comment
Share on other sites

I'm not really sure if I understand your problem, but

 

Scriptname CorridorToggle extends ObjectReference

ObjectReference Property CorridorLightMarker Auto

Event OnActivate(ObjectReference akActionRef)
    If (CorridorLightMarker.IsEnabled())
        CorridorLightMarker.disable()
    Else
        CorridorLightMarker.enable()
    EndIf
EndEvent

This should be enough.

 

CorridorLightMarker should be the enable parent of all your lights.

 

I don't know if you even can use an XMarker for enable parent. There is a special type of object for that, it looks like the recycle symbol, with two arrows in a circle. It should be called something like "EnableParent", too.

The script there is the original one which allows the lightswitch to function without interuption, I'm trying to make it so when the MasterLightMarkerTEST is enabled it will allow function of the lightswitch, and when it is disabled you won't be able to use it.

Link to comment
Share on other sites

Ooh!

 

Hm, in that case, the original script looks almost correctly to me, just remove the CorridorLightMarker.enable() before the if. There is no point in checking whenever it's enabled if you are enabling it right before that. With this, toggling the light will only work if MasterLightMarkerTEST is enabled.

However, if the lights are on and you disable MasterLightMarkerTEST, they will be stuck in the on state. You would have to add some extra logic to whatever controls the enable state of MasterLightMarkerTEST in this case.

Link to comment
Share on other sites

Scriptname CorridorToggle extends ObjectReference

ObjectReference Property CorridorLightMarker Auto

Event OnActivate(ObjectReference akActionRef)
	If (MasterLightMarkerTEST.IsEnabled())
		If (CorridorLightMarker.IsDisabled())
			CorridorLightMarker.enable()
		Else
			CorridorLightMarker.disable()
		EndIf
	EndIf
	If (MasterLightMarkerTEST.IsDisabled())
		CorridorLightMarker.disable()
	EndIf
EndEvent


ObjectReference Property MasterLightMarkerTEST Auto Const

I've made several edits and each edit I make doesn't do the trick aha. Lights simply won't switch on even when the MasterLightMarkerTEST is enabled; I can't get my head around why :laugh:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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