Jump to content

Input Layer enabling script not working?


Recommended Posts

The script compiles fine and I'm seeing the Debug Notification messages to tell me things are disabling, but they aren't disabling. Do I need to do InputLayer.Create for each one or something?

Scriptname SynthPlayer:Synth6Control extends ReferenceAlias

{Deals with output systems based on system health and lubricant levels}

Group Misc
	Quest Property qMQ101 Auto Const
	GlobalVariable Property gBootup Auto
	GlobalVariable Property gDebugSetting Auto
	GlobalVariable Property gSynthAbilityLevel Auto Const
	GlobalVariable Property gLubriCoolPerc Auto Const
	GlobalVariable Property gPowerPerc Auto Const
	GlobalVariable Property gCoreTempPerc Auto Const
EndGroup

Group SystemConditions
	ActorValue Property BrainConditionAV Auto
	ActorValue Property PerceptionConditionAV Auto
	ActorValue Property EnduranceConditionAV Auto
	ActorValue Property LeftAttackConditionAV Auto
	ActorValue Property LeftMobilityConditionAV Auto
	ActorValue Property RightAttackConditionAV Auto
	ActorValue Property RightMobilityConditionAV Auto
	GlobalVariable Property gSystemsServosLower Auto
	GlobalVariable Property gSystemsServosUpper Auto
	GlobalVariable Property gSystemsTorso Auto
	GlobalVariable Property gSystemsSensors Auto
	GlobalVariable Property gSystemsCPU Auto
EndGroup

;-----------------------------------------------------------------------------------------------------------------------------

Actor rActor
Int iBootup
Int iDebugSetting
InputEnableLayer ielInputLayer
Float fCurrAbilityLevel
Float fConditionHead
Float fConditionPerception
Float fConditionTorso
Float fConditionLeftArm
Float fConditionRightArm
Float fConditionLeftLeg
Float fConditionRightLeg
Float fSystemsServosLower
Float fSystemsServosUpper
Float fSystemsTorso
Float fSystemsSensors
Float fSystemsCPU
Float fSystemsServosLowerMax = 50.0
Float fSystemsServosUpperMax = 50.0
Float fSystemsTorsoMax = 50.0
Float fSystemsSensorsMax = 50.0
Float fSystemsCPUMax = 50.0
Int iSystemsMovementDisable = 5
Int iSystemsRunningDisable = 10
Int iSystemsJumpingDisable = 20
Int iSystemsSprintingDisable = 30
Int iSystemsFastTravelDisable = 40
Int iSystemsActivateDisable = 5
Int iSystemsJournalDisable = 10
Int iSystemsFightingDisable = 20
Int iSystemsLookingDisable = 10
Int iSystemsCamSwitchDisable = 5
Int iSystemsSneakingDisable = 25
Int iSystemsVATSDisable = 20
Float fFrequencyTimer = 1.5
Int iTimerID = 32
Int iIsSwimming

;-----------------------------------------------------------------------------------------------------------------------------

Event OnInit()
	rActor = Game.GetPlayer()
	RegisterForRemoteEvent(rActor, "OnDeath")
	StartTimer(fFrequencyTimer, iTimerID)
	ielInputLayer = InputEnableLayer.Create() 
EndEvent

;-----------------------------------------------------------------------------------------------------------------------------

Event OnTimer(int aiTimerID)
	iDebugSetting = (gDebugSetting.GetValue()) as Int
	iBootup =  (gBootup.GetValue()) as Int
	If (aiTimerID >= iTimerID) && (iBootup > 10) && (qMQ101.IsCompleted() == True)
		Int iTempSysValue
		Float fLubriCoolPerc = gLubriCoolPerc.GetValue()
		Float fCoreTempPerc = gCoreTempPerc.GetValue()
		Float fPowerPerc = gPowerPerc.GetValue()
		fConditionHead = rActor.GetValue(BrainConditionAV) as Float
		fConditionPerception = rActor.GetValue(PerceptionConditionAV) as Float
		fConditionTorso = rActor.GetValue(EnduranceConditionAV) as Float
		fConditionLeftArm = rActor.GetValue(LeftAttackConditionAV) as Float
		fConditionRightArm = rActor.GetValue(RightAttackConditionAV) as Float
		fConditionLeftLeg = rActor.GetValue(LeftMobilityConditionAV) as Float
		fConditionRightLeg = rActor.GetValue(RightMobilityConditionAV) as Float
		fSystemsServosLower = (fConditionLeftLeg + fConditionRightLeg) / 2
		fSystemsServosUpper = (fConditionLeftArm + fConditionRightArm) / 2
		fSystemsTorso = fConditionTorso
		fSystemsSensors = fConditionPerception
		fSystemsCPU = fConditionHead
		if (fSystemsServosLower < 1)
			fSystemsServosLower = 1
		endif
		if (fSystemsServosUpper < 1)
			fSystemsServosUpper = 1
		endif
		if (fSystemsTorso < 1)
			fSystemsTorso = 1
		endif
		if (fSystemsSensors < 1)
			fSystemsSensors = 1
		endif
		if (fSystemsCPU < 1)
			fSystemsCPU = 1
		endif

		if (fSystemsServosLower > fSystemsServosLowerMax)
			fSystemsServosLower = fSystemsServosLowerMax
		endif
		if (fSystemsServosLower > fLubriCoolPerc)
			fSystemsServosLower = fLubriCoolPerc
		endif

		if (fSystemsServosUpper > fSystemsServosUpperMax)
			fSystemsServosUpper = fSystemsServosUpperMax
		endif
		if (fSystemsServosUpper > fLubriCoolPerc)
			fSystemsServosUpper = fLubriCoolPerc
		endif

		if (fSystemsTorso > fSystemsTorsoMax)
			fSystemsTorso = fSystemsTorsoMax
		endif

		if (fSystemsSensors > fSystemsSensorsMax)
			fSystemsSensors = fSystemsSensorsMax
		endif

		if (fSystemsCPU > fSystemsCPUMax)
			fSystemsCPU = fSystemsCPUMax
		endif

; *** Disabling Systems
		iTempSysValue = fSystemsServosLower as Int
		if (iTempSysValue < iSystemsMovementDisable) && (ielInputLayer.IsMovementEnabled())
			ielInputLayer.EnableMovement(false)
			fnMessage("Lower Servos at " + iTempSysValue + "%, Basic Movement Disabled")
		endif
		if (iTempSysValue < iSystemsRunningDisable) && (ielInputLayer.IsRunningEnabled())
			ielInputLayer.EnableRunning(false)
			fnMessage("Lower Servos at " + iTempSysValue + "%, High Speed Movement Disabled")
		endif
		if (iTempSysValue < iSystemsJumpingDisable) && (ielInputLayer.IsJumpingEnabled())
			ielInputLayer.EnableJumping(false)
			fnMessage("Lower Servos at " + iTempSysValue + "%, Jumping Movement Disabled")
		endif
		if (iTempSysValue < iSystemsSprintingDisable) && (ielInputLayer.IsSprintingEnabled())
			ielInputLayer.EnableSprinting(false)
			fnMessage("Lower Servos at " + iTempSysValue + "%, Overboost Movement Disabled")
		endif
		if (iTempSysValue < iSystemsFastTravelDisable) && (ielInputLayer.IsFastTravelEnabled())
			ielInputLayer.EnableFastTravel(false)
			fnMessage("Lower Servos at " + iTempSysValue + "%, Long Distance Movement Disabled")
		endif

		iTempSysValue = fSystemsServosUpper as Int
		if (iTempSysValue < iSystemsJournalDisable) && (ielInputLayer.IsJournalEnabled())
			ielInputLayer.EnableJournal(false)
			fnMessage("Upper Servos at " + iTempSysValue + "%, PIPBoy Operation Disabled")
		endif
		if (iTempSysValue < iSystemsActivateDisable) && (ielInputLayer.IsActivateEnabled())
			ielInputLayer.EnableActivate(false)
			fnMessage("Upper Servos at " + iTempSysValue + "%, Arm Operation Reduced")
		endif
		if (iTempSysValue < iSystemsFightingDisable) && (ielInputLayer.IsFightingEnabled())
			ielInputLayer.EnableFighting(false)
			fnMessage("Upper Servos at " + iTempSysValue + "%, Combat Systems Disabled")
		endif

		iTempSysValue = fSystemsSensors as Int
		if (iTempSysValue < iSystemsLookingDisable) && (ielInputLayer.IsLookingEnabled())
			ielInputLayer.EnableLooking(false)
			fnMessage("Sensors at " + iTempSysValue + "%, Visual Systems Restricted")
		endif
		if (iTempSysValue < iSystemsCamSwitchDisable) && (ielInputLayer.IsCamSwitchEnabled())
			ielInputLayer.EnableCamSwitch(false)
			fnMessage("Sensors at " + iTempSysValue + "%, Visual Systems Restricted")
		endif

		iTempSysValue = fSystemsCPU as Int
		if (iTempSysValue < iSystemsVATSDisable) && (ielInputLayer.IsVATSEnabled())
			ielInputLayer.EnableVATS(false)
			fnMessage("CPU at " + iTempSysValue + "%, Targeting Systems Offline")
		endif
		if (iTempSysValue < iSystemsSneakingDisable) && (ielInputLayer.IsSneakingEnabled())
			ielInputLayer.EnableSneaking(false)
			fnMessage("CPU at " + iTempSysValue + "%, Stealth Functions Offline")
		endif

; *** Enabling Systems
		iTempSysValue = fSystemsServosLower as Int
		if (iTempSysValue >= (iSystemsMovementDisable * 2)) && (!ielInputLayer.IsMovementEnabled())
			ielInputLayer.EnableMovement(true)
			fnMessage("Lower Servos at " + iTempSysValue + "%, Basic Movement Restored")
		endif
		if (iTempSysValue >= (iSystemsRunningDisable * 2)) && (!ielInputLayer.IsRunningEnabled())
			ielInputLayer.EnableRunning(true)
			fnMessage("Lower Servos at " + iTempSysValue + "%, High Speed Movement Restored")
		endif
		if (iTempSysValue >= (iSystemsJumpingDisable * 2)) && (!ielInputLayer.IsJumpingEnabled())
			ielInputLayer.EnableJumping(true)
			fnMessage("Lower Servos at " + iTempSysValue + "%, Jumping Movement Restored")
		endif
		if (iTempSysValue >= (iSystemsSprintingDisable * 2)) && (!ielInputLayer.IsSprintingEnabled())
			ielInputLayer.EnableSprinting(true)
			fnMessage("Lower Servos at " + iTempSysValue + "%, Overboost Movement Restored")
		endif
		if (iTempSysValue >= (iSystemsFastTravelDisable * 2)) && (!ielInputLayer.IsFastTravelEnabled())
			ielInputLayer.EnableFastTravel(true)
			fnMessage("Lower Servos at " + iTempSysValue + "%, Long Distance Movement Restored")
		endif

		iTempSysValue = fSystemsServosUpper as Int
		if (iTempSysValue >= (iSystemsActivateDisable * 2)) && (!ielInputLayer.IsActivateEnabled())
			ielInputLayer.EnableActivate(true)
			fnMessage("Upper Servos at " + iTempSysValue + "%, Arm Operation Restored")
		endif
		if (iTempSysValue >= (iSystemsJournalDisable * 2)) && (!ielInputLayer.IsJournalEnabled())
			ielInputLayer.EnableJournal(true)
			fnMessage("Upper Servos at " + iTempSysValue + "%, PIPBoy Operation Restored")
		endif
		if (iTempSysValue >= (iSystemsFightingDisable * 2)) && (!ielInputLayer.IsFightingEnabled())
			ielInputLayer.EnableFighting(true)
			fnMessage("Upper Servos at " + iTempSysValue + "%, Combat Systems Restored")
		endif

		iTempSysValue = fSystemsSensors as Int
		if (iTempSysValue >= (iSystemsLookingDisable * 2)) && (!ielInputLayer.IsLookingEnabled())
			ielInputLayer.EnableLooking(true)
			fnMessage("Sensors at " + iTempSysValue + "%, Visual Systems Restored")
		endif
		if (iTempSysValue>= (iSystemsCamSwitchDisable * 2)) && (!ielInputLayer.IsCamSwitchEnabled())
			Game.ForceFirstPerson()
			ielInputLayer.EnableCamSwitch(true)
			fnMessage("Sensors at " + iTempSysValue + "%, Visual Systems Restored")
		endif

		iTempSysValue = fSystemsCPU as Int
		if (iTempSysValue >= (iSystemsVATSDisable * 2)) && (!ielInputLayer.IsVATSEnabled())
			ielInputLayer.EnableVATS(true)
			fnMessage("CPU at " + iTempSysValue + "%, Targeting Systems Restored")
		endif
		if (iTempSysValue >= (iSystemsSneakingDisable * 2)) && (!ielInputLayer.IsSneakingEnabled())
			ielInputLayer.EnableSneaking(true)
			fnMessage("CPU at " + iTempSysValue + "%, Stealth Functions Restored")
		endif

		gSystemsServosLower.SetValue(fSystemsServosLower)
		gSystemsServosUpper.SetValue(fSystemsServosUpper)
		gSystemsTorso.SetValue(fSystemsTorso)
		gSystemsSensors.SetValue(fSystemsSensors)
		gSystemsCPU.SetValue(fSystemsCPU)
		iIsSwimming = 0
	Endif ; (aiTimerID >= iTimerID)
	StartTimer(fFrequencyTimer, iTimerID)
EndEvent

;-----------------------------------------------------------------------------------------------------------------------------

Function fnMessage(String sMessage)
	Debug.Notification(sMessage)
	Debug.Trace(sMessage)
EndFunction

;-----------------------------------------------------------------------------------------------------------------------------

Event Actor.OnDeath(Actor akSender, Actor akKiller)
	CancelTimer(iTimerID)
	UnregisterForAllEvents()
EndEvent
Edited by Halstrom
Link to comment
Share on other sites

Just to double-test, have you tried running the various "is" functions on the inputlayer to see if the game thinks the change has been made?

 

No, I'm just assuming because of the message showing, but I'll give it a go, there must be something stupid wrong for all of them not to work.

​Damn can't test now because of FO4 update, got to wait for F4SE to catch up :P

Link to comment
Share on other sites

Whoops. I lucked out and had steam in offline mode.

 

Your code looks like it should work to me. But, I haven't used the individual functions like that before. I always used the long DisablePlayerControls version.

 

The only two things that I can think of here:

 

1) It is somehow out of available inputlayers. (There is a note in the wiki about running out.)

 

2) It doesn't work correctly being called in an Event. (Seems like a unique piece of code given its need for a custom constructor function.)

Link to comment
Share on other sites

Hmm trying to convert my script to use EnablePlayerControls I just realised there's some weirdness, some stuff seems to be available using EnablePlayerControls and some isn't, can anyone confirm if this is correct or is it some typo rerror when copied over from Skyrim Wiki? Do EnableJumping and Enable Sprinting work? As far as I know Z key doesn't do anything?

 

  • Function Delete()
    • Deletes this input enable layer and invalidates all script variables pointing at it.
  • Function DisablePlayerControls(bool abMovement, bool abFighting, bool abCamSwitch, bool abLooking, bool abSneaking, bool abMenu, bool abActivate, bool abJournalTabs, bool abVATS, bool abFavorites, bool abRunning)
    • Disables the specified player controls.
  • Function EnableActivate(bool abEnable)
    • Enables/disables activation.
  • Function EnableCamSwitch(bool abEnable)
    • Enables/disables camera switching (first to third person and vice-versa).
  • Function EnableFastTravel(bool abEnable)
    • Enables/disables fast travel.
  • Function EnableFavorites(bool abEnable)
    • Enables/disables favorites menu.
  • Function EnableFighting(bool abEnable)
    • Enables/disables the player's ability to fight.
  • Function EnableJournal(bool abEnable)
    • Enables/disables the journal.
  • Function EnableJumping(bool abEnable)
    • Enables/disables jumping.
  • Function EnableLooking(bool abEnable)
    • Enables/disables looking.
  • Function EnableMenu(bool abEnable)
    • Enables/disables menu access.
  • Function EnableMovement(bool abEnable)
    • Enables/disables player movement.
  • Function EnablePlayerControls(bool abMovement, bool abFighting, bool abCamSwitch, bool abLooking, bool abSneaking, bool abMenu, bool abActivate, bool abJournalTabs, bool abVATS, bool abFavorites, bool abRunning)
    • Enables the specified player controls.
  • Function EnableRunning(bool abEnable)
    • Enables/disables player running.
  • Function EnableSneaking(bool abEnable)
    • Enables/disables player sneaking.
  • Function EnableSprinting(bool abEnable)
    • Enables/disables player sprinting.
  • Function EnableVATS(bool abEnable)
    • Enables/disables vats.
  • Function EnableZKey(bool abEnable)
    • Enables/disables player z-key.
  • bool Function IsActivateEnabled()
    • Returns whether activation is enabled on this layer or not.
  • bool Function IsCamSwitchEnabled()
    • Returns whether camera switching is enabled on this layer or not.
  • bool Function IsFastTravelEnabled()
    • Returns whether fast travel is enabled on this layer or not.
  • bool Function IsFavoritesEnabled()
    • Returns whether the favorites menu is enabled on this layer or not.
  • bool Function IsFightingEnabled()
    • Returns whether player fighting is enabled on this layer or not.
  • bool Function IsJournalEnabled()
    • Returns whether journal access is enabled on this layer or not.
  • bool Function IsJumpingEnabled()
    • Returns whether jumping is enabled on this layer or not.
  • bool Function IsLookingEnabled()
    • Returns whether looking is enabled on this layer or not.
  • bool Function IsMenuEnabled()
    • Returns whether menu access is enabled on this layer or not.
  • bool Function IsMovementEnabled()
    • Returns whether movement is enabled on this layer or not.
  • bool Function IsRunningEnabled()
    • Returns whether running is enabled on this layer or not.
  • bool Function IsSneakingEnabled()
    • Returns whether sneaking is enabled on this layer or not.
  • bool Function IsSprintingEnabled()
    • Returns whether sprinting is enabled on this layer or not.
  • bool Function IsVATSEnabled()
    • Returns whether vats is enabled on this layer or not.
  • bool Function IsZKeyEnabled()
    • Returns whether z-key is enabled on this layer or not.

 

https://www.creationkit.com/fallout4/index.php?title=DisablePlayerControls_-_InputEnableLayer

Edited by Halstrom
Link to comment
Share on other sites

DisablePlayerControls() here is indeed different from Skyrim's. I tend to agree with @dagobaking, from my personal experience this function and InputEnableLayer works fine only when they are on something persistent. That being a running quest, can't find anything more suitable.

 

My advice here would be to use DisablePlayerControls(), attach your script on Quest, create a separate function dedicated to disabling control and call it in the event.

 

One thing I don't quite get right now is why do you register for a remote event a Ref Alias? Register your quest and work in its script.

Link to comment
Share on other sites

DisablePlayerControls() here is indeed different from Skyrim's. I tend to agree with @dagobaking, from my personal experience this function and InputEnableLayer works fine only when they are on something persistent. That being a running quest, can't find anything more suitable.

 

My advice here would be to use DisablePlayerControls(), attach your script on Quest, create a separate function dedicated to disabling control and call it in the event.

 

One thing I don't quite get right now is why do you register for a remote event a Ref Alias? Register your quest and work in its script.

Hmm well I don't actually have a quest script, I was doing everything in the Alias Scripts so far, as someone said there's nothing you can't do in a Quest that you can't do in a Alias. And I haven't worked out when I need to register which events in which script types and when I don't so I just been registering them all :smile:

 

And I really want the disable Jump and Sprint, and they aren't available on DisablePlayerControls. I just got F4SE updated so can test again, I've created a separate input layer for each one to see if that works.

Link to comment
Share on other sites

 

I've created a separate input layer for each one to see if that works.

Did that work?

 

If not, it should be pretty easy to make a quest utility script to call from your alias scripts.

 

Yes that seems to have done the trick, created a separate input layer for each, haven't tested all but its definitely disabling and re-enabling Sprint and fastTravel so far.

Scriptname SynthPlayer:Synth6Control extends ReferenceAlias

{Deals with output systems based on system health and lubricant levels}

Group Misc
	Quest Property qMQ101 Auto Const
	GlobalVariable Property gBootup Auto
	GlobalVariable Property gDebugSetting Auto
	GlobalVariable Property gSynthAbilityLevel Auto Const
	GlobalVariable Property gLubriCoolPerc Auto Const
	GlobalVariable Property gPowerPerc Auto Const
	GlobalVariable Property gCoreTempPerc Auto Const
	GlobalVariable Property gFPE_SexPregMonths Auto
EndGroup

Group SystemConditions
	ActorValue Property BrainConditionAV Auto
	ActorValue Property PerceptionConditionAV Auto
	ActorValue Property EnduranceConditionAV Auto
	ActorValue Property LeftAttackConditionAV Auto
	ActorValue Property LeftMobilityConditionAV Auto
	ActorValue Property RightAttackConditionAV Auto
	ActorValue Property RightMobilityConditionAV Auto
	GlobalVariable Property gSystemsServosLower Auto
	GlobalVariable Property gSystemsServosUpper Auto
	GlobalVariable Property gSystemsTorso Auto
	GlobalVariable Property gSystemsSensors Auto
	GlobalVariable Property gSystemsCPU Auto
EndGroup

;-----------------------------------------------------------------------------------------------------------------------------

Actor rActor
Int iBootup
Int iDebugSetting
Float fCurrAbilityLevel
Float fConditionHead
Float fConditionPerception
Float fConditionTorso
Float fConditionLeftArm
Float fConditionRightArm
Float fConditionLeftLeg
Float fConditionRightLeg
Float fSystemsServosLower
Float fSystemsServosUpper
Float fSystemsTorso
Float fSystemsSensors
Float fSystemsCPU
Int iSystemsMovementDisable = 5
Int iSystemsRunningDisable = 10
Int iSystemsJumpingDisable = 20
Int iSystemsSprintingDisable = 30
Int iSystemsFastTravelDisable = 40
Int iSystemsActivateDisable = 5
Int iSystemsJournalDisable = 10
Int iSystemsFightingDisable = 20
Int iSystemsLookingDisable = 10
Int iSystemsCamSwitchDisable = 5
Int iSystemsSneakingDisable = 25
Int iSystemsVATSDisable = 20
InputEnableLayer ielInputLayerMovement
InputEnableLayer ielInputLayerRunning
InputEnableLayer ielInputLayerSprinting
InputEnableLayer ielInputLayerJumping
InputEnableLayer ielInputLayerFastTravel
InputEnableLayer ielInputLayerFighting
InputEnableLayer ielInputLayerMenu
InputEnableLayer ielInputLayerJournal
InputEnableLayer ielInputLayerActivate
InputEnableLayer ielInputLayerCamSwitch
InputEnableLayer ielInputLayerLooking
InputEnableLayer ielInputLayerSneaking
InputEnableLayer ielInputLayerVATS
InputEnableLayer ielInputLayerFavorites
bool bCurrMovement = True
bool bPrevMovement = True
bool bCurrRunning = True
bool bPrevRunning = True
bool bCurrSprinting = True
bool bPrevSprinting = True
bool bCurrJumping = True
bool bPrevJumping = True
bool bCurrFastTravel = True
bool bPrevFastTravel = True
bool bCurrFighting = True
bool bPrevFighting = True
bool bCurrMenu = True
bool bPrevMenu = True
bool bCurrActivate = True
bool bPrevActivate = True
bool bCurrJournal = True
bool bPrevJournal = True
bool bCurrCamSwitch = True
bool bPrevCamSwitch = True
bool bCurrLooking = True
bool bPrevLooking = True
bool bCurrSneaking = True
bool bPrevSneaking = True
bool bCurrVATS = True
bool bPrevVATS = True
bool bCurrFavorites = True
bool bPrevFavorites = True

Float fFrequencyTimer = 1.5
Int iTimerID = 32
Int iIsSwimming

;-----------------------------------------------------------------------------------------------------------------------------

Event OnInit()
	rActor = Game.GetPlayer()
	RegisterForRemoteEvent(rActor, "OnDeath")
	StartTimer(fFrequencyTimer, iTimerID)
	ielInputLayerMovement = InputEnableLayer.Create() 
	ielInputLayerRunning = InputEnableLayer.Create()
	ielInputLayerSprinting = InputEnableLayer.Create()
	ielInputLayerJumping = InputEnableLayer.Create()
	ielInputLayerFastTravel = InputEnableLayer.Create()
	ielInputLayerFighting = InputEnableLayer.Create()
	ielInputLayerMenu = InputEnableLayer.Create()
	ielInputLayerJournal = InputEnableLayer.Create()
	ielInputLayerActivate = InputEnableLayer.Create()
	ielInputLayerCamSwitch = InputEnableLayer.Create()
	ielInputLayerLooking = InputEnableLayer.Create()
	ielInputLayerSneaking = InputEnableLayer.Create()
	ielInputLayerVATS = InputEnableLayer.Create()
	ielInputLayerFavorites = InputEnableLayer.Create()
EndEvent

;Game.SetPlayerAIDriven()
;Game.SetPlayerRadioFrequency(50.45)
;Game.TurnPlayerRadioOn(false)
;Game.ShakeCamera(afStrength = 0.1)
;Actor randomActor = Game.FindRandomActor(0.0, 0.0, 0.0, 5.0)
;Actor closest = Game.FindClosestActor(0.0, 0.0, 0.0, 5.0)
;Game.FastTravel(HomeMarker)
;Game.FadeOutGame(false, true, 2.0, 1.0)

;-----------------------------------------------------------------------------------------------------------------------------

Event OnTimer(int aiTimerID)
	iDebugSetting = (gDebugSetting.GetValue()) as Int
	iBootup =  (gBootup.GetValue()) as Int
	If (aiTimerID >= iTimerID) && (iBootup > 10) && (qMQ101.IsCompleted() == True)
		Int iTempSysValue
		Float fLubriCoolPerc = gLubriCoolPerc.GetValue()
		Float fCoreTempPerc = gCoreTempPerc.GetValue()
		Float fPowerPerc = gPowerPerc.GetValue()
		Float fSexPregPerc = ((gFPE_SexPregMonths.GetValue()) / 9) * 100
		fSystemsServosLower = gSystemsServosLower.GetValue()
		fSystemsServosUpper = gSystemsServosUpper.GetValue()
		fSystemsTorso = gSystemsTorso.GetValue()
		fSystemsSensors = gSystemsSensors.GetValue()
		fSystemsCPU = gSystemsCPU.GetValue()

		bCurrMovement = ielInputLayerMovement.IsMovementEnabled()
		bCurrRunning = ielInputLayerRunning.IsRunningEnabled()
		bCurrSprinting = ielInputLayerSprinting.IsSprintingEnabled()
		bCurrJumping = ielInputLayerJumping.IsJumpingEnabled()
		bCurrFastTravel = ielInputLayerFastTravel.IsFastTravelEnabled()
		bCurrJournal = ielInputLayerJournal.IsJournalEnabled()
		bCurrActivate = ielInputLayerActivate.IsActivateEnabled()
		bCurrFighting = ielInputLayerFighting.IsFightingEnabled()
		bCurrLooking = ielInputLayerLooking.IsLookingEnabled()
		bCurrCamSwitch = ielInputLayerCamSwitch.IsCamSwitchEnabled()
		bCurrVATS = ielInputLayerVATS.IsVATSEnabled()
		bCurrSneaking = ielInputLayerSneaking.IsSneakingEnabled()

; *** Disabling Systems
		iTempSysValue = fSystemsServosLower as Int
		if (iTempSysValue < iSystemsMovementDisable) && (bCurrMovement)
			ielInputLayerMovement.EnableMovement(false)
			Bool bTemp = ielInputLayerMovement.IsMovementEnabled()
			fnMessage("Lower Servos at " + iTempSysValue + "%, Basic Movement Disabled: " + bTemp)
		endif
		if (iTempSysValue < iSystemsRunningDisable) && (bCurrRunning)
			ielInputLayerRunning.EnableRunning(false)
			Bool bTemp = ielInputLayerRunning.IsRunningEnabled()
			fnMessage("Lower Servos at " + iTempSysValue + "%, High Speed Movement Disabled: " + bTemp)
		endif
		if (iTempSysValue < iSystemsJumpingDisable) && (bCurrJumping)
			ielInputLayerJumping.EnableJumping(false)
			Bool bTemp = ielInputLayerJumping.IsJumpingEnabled()
			fnMessage("Lower Servos at " + iTempSysValue + "%, Jumping Movement Disabled: " + bTemp)
		endif
		if (iTempSysValue < iSystemsSprintingDisable) && (bCurrSprinting)
			ielInputLayerSprinting.EnableSprinting(false)
			Bool bTemp = ielInputLayerSprinting.IsSprintingEnabled()
			fnMessage("Lower Servos at " + iTempSysValue + "%, Overboost Movement Disabled: " + bTemp)
		endif
		if (iTempSysValue < iSystemsFastTravelDisable) && (bCurrFastTravel)
			ielInputLayerFastTravel.EnableFastTravel(false)
			Bool bTemp = ielInputLayerFastTravel.IsFastTravelEnabled()
			fnMessage("Lower Servos at " + iTempSysValue + "%, Long Distance Movement Disabled: " + bTemp)
		endif

		iTempSysValue = fSystemsServosUpper as Int
		if (iTempSysValue < iSystemsJournalDisable) && (bCurrJournal)
			ielInputLayerJournal.EnableJournal(false)
			Bool bTemp = ielInputLayerJournal.IsJournalEnabled()
			fnMessage("Upper Servos at " + iTempSysValue + "%, PIPBoy Operation Disabled: " + bTemp)
		endif
		if (iTempSysValue < iSystemsActivateDisable) && (bCurrActivate)
			ielInputLayerActivate.EnableActivate(false)
			Bool bTemp = ielInputLayerActivate.IsActivateEnabled()
			fnMessage("Upper Servos at " + iTempSysValue + "%, Arm Operation Reduced: " + bTemp)
		endif
		if (iTempSysValue < iSystemsFightingDisable) && (bCurrFighting)
			ielInputLayerFighting.EnableFighting(false)
			Bool bTemp = ielInputLayerFighting.IsFightingEnabled()
			fnMessage("Upper Servos at " + iTempSysValue + "%, Combat Systems Disabled: " + bTemp)
		endif

		iTempSysValue = fSystemsSensors as Int
		if (iTempSysValue < iSystemsLookingDisable) && (bCurrLooking)
			ielInputLayerLooking.EnableLooking(false)
			Bool bTemp = ielInputLayerLooking.IsLookingEnabled()
			fnMessage("Sensors at " + iTempSysValue + "%, Visual Systems Restricted: " + bTemp)
		endif
		if (iTempSysValue < iSystemsCamSwitchDisable) && (bCurrCamSwitch)
			Game.ForceFirstPerson()
			ielInputLayerCamSwitch.EnableCamSwitch(false)
			Bool bTemp = ielInputLayerCamSwitch.IsCamSwitchEnabled()
			fnMessage("Sensors at " + iTempSysValue + "%, Visual Systems Restricted: " + bTemp)
		endif

		iTempSysValue = fSystemsCPU as Int
		if (iTempSysValue < iSystemsVATSDisable) && (bCurrVATS)
			ielInputLayerVATS.EnableVATS(false)
			Bool bTemp = ielInputLayerVATS.IsVATSEnabled()
			fnMessage("CPU at " + iTempSysValue + "%, Targeting Systems Offline: " + bTemp)
		endif
		if (iTempSysValue < iSystemsSneakingDisable) && (bCurrSneaking)
			ielInputLayerSneaking.EnableSneaking(false)
			Bool bTemp = ielInputLayerSneaking.IsSneakingEnabled()
			fnMessage("CPU at " + iTempSysValue + "%, Stealth Functions Offline: " + bTemp)
		endif

; *** Enabling Systems
		iTempSysValue = fSystemsServosLower as Int
		if (iTempSysValue >= (iSystemsMovementDisable * 2)) && (!bCurrMovement)
			ielInputLayerMovement.EnableMovement(true)
			Bool bTemp = ielInputLayerMovement.IsMovementEnabled()
			fnMessage("Lower Servos at " + iTempSysValue + "%, Basic Movement Restored: " + bTemp)
		endif
		if (iTempSysValue >= (iSystemsRunningDisable * 2)) && (!bCurrRunning)
			ielInputLayerRunning.EnableRunning(true)
			Bool bTemp = ielInputLayerRunning.IsRunningEnabled()
			fnMessage("Lower Servos at " + iTempSysValue + "%, High Speed Movement Restored: " + bTemp)
		endif
		if (iTempSysValue >= (iSystemsJumpingDisable * 2)) && (!bCurrJumping)
			ielInputLayerJumping.EnableJumping(true)
			Bool bTemp = ielInputLayerJumping.IsJumpingEnabled()
			fnMessage("Lower Servos at " + iTempSysValue + "%, Jumping Movement Restored: " + bTemp)
		endif
		if (iTempSysValue >= (iSystemsSprintingDisable * 2)) && (!bCurrSprinting)
			ielInputLayerSprinting.EnableSprinting(true)
			Bool bTemp = ielInputLayerSprinting.IsSprintingEnabled()
			fnMessage("Lower Servos at " + iTempSysValue + "%, Overboost Movement Restored: " + bTemp)
		endif
		if (iTempSysValue >= (iSystemsFastTravelDisable * 2)) && (!bCurrFastTravel)
			ielInputLayerFastTravel.EnableFastTravel(true)
			Bool bTemp = ielInputLayerFastTravel.IsFastTravelEnabled()
			fnMessage("Lower Servos at " + iTempSysValue + "%, Long Distance Movement Restored: " + bTemp)
		endif

		iTempSysValue = fSystemsServosUpper as Int
		if (iTempSysValue >= (iSystemsActivateDisable * 2)) && (!bCurrActivate)
			ielInputLayerActivate.EnableActivate(true)
			Bool bTemp = ielInputLayerActivate.IsActivateEnabled()
			fnMessage("Upper Servos at " + iTempSysValue + "%, Arm Operation Restored: " + bTemp)
		endif
		if (iTempSysValue >= (iSystemsJournalDisable * 2)) && (!bCurrJournal)
			ielInputLayerJournal.EnableJournal(true)
			Bool bTemp = ielInputLayerJournal.IsJournalEnabled()
			fnMessage("Upper Servos at " + iTempSysValue + "%, PIPBoy Operation Restored: " + bTemp)
		endif
		if (iTempSysValue >= (iSystemsFightingDisable * 2)) && (!bCurrFighting)
			ielInputLayerFighting.EnableFighting(true)
			Bool bTemp = ielInputLayerFighting.IsFightingEnabled()
			fnMessage("Upper Servos at " + iTempSysValue + "%, Combat Systems Restored: " + bTemp)
		endif

		iTempSysValue = fSystemsSensors as Int
		if (iTempSysValue >= (iSystemsLookingDisable * 2)) && (!bCurrLooking)
			ielInputLayerLooking.EnableLooking(true)
			Bool bTemp = ielInputLayerLooking.IsLookingEnabled()
			fnMessage("Sensors at " + iTempSysValue + "%, Visual Systems Restored: " + bTemp)
		endif
		if (iTempSysValue>= (iSystemsCamSwitchDisable * 2)) && (!bCurrCamSwitch)
			ielInputLayerCamSwitch.EnableCamSwitch(true)
			Bool bTemp = ielInputLayerCamSwitch.IsCamSwitchEnabled()
			fnMessage("Sensors at " + iTempSysValue + "%, Visual Systems Restored: " + bTemp)
		endif

		iTempSysValue = fSystemsCPU as Int
		if (iTempSysValue >= (iSystemsVATSDisable * 2)) && (!bCurrVATS)
			ielInputLayerVATS.EnableVATS(true)
			Bool bTemp = ielInputLayerVATS.IsVATSEnabled()
			fnMessage("CPU at " + iTempSysValue + "%, Targeting Systems Restored: " + bTemp)
		endif
		if (iTempSysValue >= (iSystemsSneakingDisable * 2)) && (!bCurrSneaking)
			ielInputLayerSneaking.EnableSneaking(true)
			Bool bTemp = ielInputLayerSneaking.IsSneakingEnabled()
			fnMessage("CPU at " + iTempSysValue + "%, Stealth Functions Restored: " + bTemp)
		endif

		iIsSwimming = 0
	Endif ; (aiTimerID >= iTimerID)
	StartTimer(fFrequencyTimer, iTimerID)
EndEvent

;-----------------------------------------------------------------------------------------------------------------------------

Function fnMessage(String sMessage)
	Debug.Notification(sMessage)
	Debug.Trace(sMessage)
EndFunction

;-----------------------------------------------------------------------------------------------------------------------------

Event Actor.OnDeath(Actor akSender, Actor akKiller)
	CancelTimer(iTimerID)
	UnregisterForAllEvents()
EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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