DieFeM Posted October 20, 2018 Share Posted October 20, 2018 Activate light when using the mirror to light up the player face (by ticking initially disabled on the lights, the lights still light up in game) That's pretty easy actually, you need to add an ObjectReference property, after the scripname line, for example: ObjectReference Property LightRef AutoThen inside of the If statement of the OnAnimationEvent event enable the light, and inside of the If statement of the OnGetUp event disable the light, it would look like that: ObjectReference Property LightRef Auto InputEnableLayer ControllerEnableLayer Event OnActivate(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() RegisterForAnimationEvent(akActionRef As Actor, "idleChairSitting") EndIf EndEvent Event OnAnimationEvent(ObjectReference akSource, string asEventName) If(akSource == Game.GetPlayer() && asEventName == "idleChairSitting") LightRef.Enable() UnregisterForAnimationEvent(akSource As Actor, "idleChairSitting") RegisterForRemoteEvent(akSource As Actor, "OnGetUp") ; Precache the face gen data Game.PrecacheCharGen() ; Give the load a couple of seconds to get the player in the furniture Utility.Wait(2.0) ; Make sure the player can not move ControllerEnableLayer = InputEnableLayer.Create() ControllerEnableLayer.DisablePlayerControls(abLooking=True, abCamSwitch=True, abSneaking = True) ControllerEnableLayer.EnableSprinting(False) ; Disable Z-Key (Pointer) ControllerEnableLayer.EnableZKey(False) ; Do not show compass Game.SetCharGenHUDMode(1) ; No saving or waiting Game.SetInCharGen(True, True, False) ; Make sure player has CharGen Skeleton for editing (akSource As Actor).SetHasCharGenSkeleton() Game.ShowRaceMenu(uimode = 1) EndIf EndEvent Event Actor.OnGetUp(Actor akSender, ObjectReference akFurniture) If (akFurniture == Self && akSender == Game.GetPlayer()) LightRef.Disable() UnregisterForRemoteEvent(akSender As Actor, "OnGetUp") ; Reset the surgery Game.SetCharGenHUDMode(0) Game.SetInCharGen(False, False, False) (akSender As Actor).SetHasCharGenSkeleton(False) Game.PrecacheCharGenClear() ; Make sure the player can move again ControllerEnableLayer.EnablePlayerControls() ControllerEnableLayer.EnableSprinting(True) ;Enable Z-Key ControllerEnableLayer.EnableZKey(True) EndIf EndEvent Then put a light for the mirror, edit the light reference, the one you placed, and mark the option "Initially Disabled", then edit the mirror reference, go to the Scripts tab, edit the properties of the script, click on LightRef, then click the button "Edit Value", and click on "Pick Reference On Render Window", and pick the light that you placed. Additionally, if you want to use more than one light for a mirror, you DON'T need to add more light properties, just edit the properties of the other light(s), in the Enable Parent tab, click on "Select Reference in Render Window" and pick the main light, the one you selected in the mirror properties, so the other lights will mimic the enabled/disabled state of the main light. Link to comment Share on other sites More sharing options...
Frostbite10 Posted October 20, 2018 Author Share Posted October 20, 2018 Does the name have to be “Lightref” ? And what does the auto at the end do ?If i give the light a custom name, will lightref still work ? Link to comment Share on other sites More sharing options...
DieFeM Posted October 20, 2018 Share Posted October 20, 2018 (edited) Does the name have to be “Lightref” ? No, you can name it whatever you want, but you must use the same name when calling the disable/enable function And what does the auto at the end do ? You can declare set and get functions for each property, auto uses hidden get and set functions for this property. https://www.creationkit.com/fallout4/index.php?title=Property_Reference If i give the light a custom name, will lightref still work ? If you give the same name to the light reference than the property of the script then the auto-fill button of the script properties will automatically fill the property with your light, other than that, it doesn't matter. Edited October 20, 2018 by DieFeM Link to comment Share on other sites More sharing options...
Frostbite10 Posted October 20, 2018 Author Share Posted October 20, 2018 Thank you, worked like a charm. Would you mind if I asked you any more script related problems I encounter in the future ? Link to comment Share on other sites More sharing options...
ZeroAndOne Posted October 20, 2018 Share Posted October 20, 2018 This has the original vanilla use of that Looks Menu idea. I was looking at it, but it might show some info. There are about 20 or so lights that are enabled when the character goes into looks respec, and you can see in the script kind of how Bethesda is setting up a bunch of stuff in there. I thought it was cool that to provide perfect lighting for the looks menu, it required like 20 or more lights, LOL. Makes me want to go look at the Pre-War area to see how they light it up. I'm working in lighting right now if you couldn't guess. Scriptname vaultExitElevatorSCRIPT extends ObjectReference {Handle the RESPEC options and then the one-time elevator on the interior-side. Separate trigger for exterior animations.} IMAGESPACEMODIFIER PROPERTY VaultExitISFX AUTO OBJECTREFERENCE PROPERTY elevator AUTO ARMOR PROPERTY FXVault111ExitIdleLookUpInElevatorArmor AUTO IDLE PROPERTY elevatorLook AUTO FLOAT PROPERTY blindWait AUTO FLOAT PROPERTY elevatorWait AUTO FLOAT PROPERTY animWait AUTO BOOL DOONCE=TRUE QUEST PROPERTY MQ102 Auto Message Property CharGenFinalChangesMenu Auto int ButtonPressed = 0 Quest Property DialogueVault111 Auto ObjectReference Property RespecMoveMarker Auto Idle Property ElevatorFaceCamera Auto Idle Property ElevatorBodyCamera Auto Int MovedPlayer = 0 InputEnableLayer Property RespecEnableLayer Auto Hidden ObjectReference Property RespecLightingEnableMarker Auto OBJECTREFERENCE Property V111EnableRaiseElevatorTriggerEnableMarker Auto Keyword Property AnimFaceArchetypePlayer Auto Const {Store Player Face Archetype. We need to switch player to Neutral while in the menu.} ObjectReference Property V111ExitLightingEnableMarker Auto Const EVENT ONTRIGGERENTER(OBJECTREFERENCE obj) IF(obj == game.getPlayer() && DOONCE) DOONCE = FALSE ;update QT (MQ102 as MQ03QuestScript).ReSpecDone=1 ;WJS - Disable Pipboy Controls (MQ102 as MQ03QuestScript).DisablePipboy() RegisterForMenuOpenCloseEvent("SPECIALMenu") RegisterForMenuOpenCloseEvent("LooksMenu") RegisterForLooksMenuEvent() ;disable controls RespecEnableLayer = InputEnableLayer.Create() RespecEnableLayer.DisablePlayerControls(abCamSwitch = True) ;disable exit vault lighting V111ExitLightingEnableMarker.Disable() ; pop character menu DialogueVault111.SetStage(98) Utility.Wait(1.0) ShowCharacterMenus() ENDIF ENDEVENT Function ShowCharacterMenus() Actor PlayerREF = Game.GetPlayer() ButtonPressed = CharGenFinalChangesMenu.Show() If ButtonPressed == 0 Game.ShowSPECIALMenu() ElseIf ButtonPressed == 1 Game.FadeOutGame(True, True, 0.0, 1.0, True) ;make sure player has CharGen Skeleton for editing PlayerREF.SetHasCharGenSkeleton() ;make sure player face is neutral PlayerREF.ChangeAnimFaceArchetype(None) ;enable lighting RespecLightingEnableMarker.Enable() Utility.Wait(2.0) If MovedPlayer == 0 MovedPlayer == 1 PlayerREF.Moveto(RespecMoveMarker) EndIf Game.ForceThirdPerson() Utility.Wait(1.0) PlayerREF.PlayIdle(ElevatorFaceCamera) Utility.Wait(3.0) Game.FadeOutGame(False, True, 0.0, 1.0) Game.ShowRaceMenu(uimode = 1) ElseIf ButtonPressed == 2 UnRegisterForMenuOpenCloseEvent("SPECIALMenu") UnRegisterForMenuOpenCloseEvent("LooksMenu") MenusDone() ENDIF EndFunction Function MenusDone() Actor PlayerREF = Game.GetPlayer() RespecLightingEnableMarker.Disable() ;Game.RequestSave() Game.ForceFirstPerson() ; Vault tec message DialogueVault111.SetStage(100) ; start the elevator elevator.PlayAnimation("stage3") ;utility.wait(blindWait) ; play the blind FX ;VaultExitISFX.apply(1) ;emergency lights in the vault turn off (MQ102 as MQ03QuestScript).ResetVaultLights() ;turn on a trigger that's used to allow the player to use the elevator again V111EnableRaiseElevatorTriggerEnableMarker.Enable() ;clear out cached facegen data PlayerREF.SetHasCharGenSkeleton(False) ;set player face back PlayerREF.ChangeAnimFaceArchetype(AnimFaceArchetypePlayer) ;Game.PrecacheCharGenClear() Utility.wait(5.0) Game.FadeOutGame(true, true, 0.5, 1.0, true) EndFunction ;when menus close, re-pop the main menu Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening) if (asMenuName == "SpecialMenu") && (abOpening == False) ShowCharacterMenus() ElseIf (asMenuName == "LooksMenu") && (abOpening == False) ShowCharacterMenus() EndIf EndEvent ;handle player transitioning between body and face Event OnLooksMenuEvent(int aiFlavor) ;player edits body If aiFlavor == 10 Game.GetPlayer().PlayIdle(ElevatorBodyCamera) ;player edits face ElseIf aiFlavor == 11 Game.GetPlayer().PlayIdle(ElevatorFaceCamera) EndIf EndEvent Function DeleteMyInputLayer() RespecEnableLayer = none Self.Disable() EndFunction Link to comment Share on other sites More sharing options...
DieFeM Posted October 20, 2018 Share Posted October 20, 2018 Thank you, worked like a charm. Would you mind if I asked you any more script related problems I encounter in the future ? If I can help, I'll do. Link to comment Share on other sites More sharing options...
Recommended Posts