Skip to content

Instantly share code, notes, and snippets.

@oddlittleturtle
Created February 3, 2023 02:36
Show Gist options
  • Save oddlittleturtle/66a2436e17d107a344dcad0ae1742ddb to your computer and use it in GitHub Desktop.
Save oddlittleturtle/66a2436e17d107a344dcad0ae1742ddb to your computer and use it in GitHub Desktop.
Start Me Up Redux Spawn Trigger script
ScriptName StartMeUp:SMU_SpawnTriggerScript extends ObjectReference
{Script attached to trigger that moves to place where player will spawn.}
Import StartMeUp:SMU_Debugger
;SMUR Variables
UserLog Log
Actor PlayerREF
;/SMUR updates
+ Script pauses for 20 seconds before setting stage 10 on MQ102
+ QoL properties updates for mod authors working on script
+ Debug logging added to time script for future updates
+ Player variable stored
/;
Group StartMeUp_Properties
GlobalVariable Property pSMU_FollowedVanillaPath Auto
GlobalVariable Property pSMU_VaultStart Auto
GlobalVariable Property pSMU_Triggered Auto
GlobalVariable Property pSMU_StartLevel Auto
Quest Property pSMUQuest Auto Const
;StartMeUp:StartMeUpManagerScript property SMU_Manager auto const
GlobalVariable Property pSMU_StartPoint Auto
Quest Property pSMU_Tenpines Auto Const
Quest Property pSMU_RangerCabin Auto Const
Quest Property pSMU_Quincy Auto Const
Quest Property pSMU_Raiders Auto Const
Quest Property pSMU_Raiders2 Auto Const
EndGroup
Group Quest_Properties
Keyword Property pAnimArchetypePlayer Auto Const mandatory
GlobalVariable Property pTimeScale Auto Const mandatory
{20=default starting timescale}
GlobalVariable Property pGameHour Auto Const
{9=default starting gamehour}
mq101questscript Property pMQ101questscript Auto Const
Quest Property pRadioDiamondCity Auto Const
Quest Property pRadioInstituteQuest Auto Const
Quest Property pMQ102 Auto Const
Quest Property pBoSM01 Auto Const
Quest Property pMQ101 Auto mandatory
Quest Property pDialogueVault111 Auto Const
EndGroup
Group Triggers_and_markers
ObjectReference Property pVault111MapMarker Auto Const
ObjectReference Property pMQ101HillSoldiersEnableMarker Auto Const
soundcategorysnapshot Property CSMQ101PlayerHouseInt Auto Const
ObjectReference Property pV111ElevatorCollisionPlatformEnableMarker Auto Const
vault111elevatorhandlerscript Property pVault111ElevatorHandler Auto Const
ObjectReference Property pVault111AlwaysEnableControlsTriggerREF Auto Const
ObjectReference Property pRespecTriggerREF Auto Const
ObjectReference Property pV111EnableRaiseElevatorTriggerEnableMarker Auto Const
ObjectReference Property pMQ102PipboyTakeFurnitureREF Auto Const
ObjectReference Property Vault111_OverseerDoor Auto Const
ObjectReference Property MQPlayerCryopodREF Auto Const
ObjectReference Property pVault111BlockedDoorEnableParent Auto Const
ReferenceAlias Property pAlias_Vault111QT00 Auto Const
;ObjectReference Property MQ102SetStage0Trigger Auto Const
;ObjectReference Property pVault111SetStage70TriggerREF Auto Const
;ObjectReference Property pVault111SetStage72TriggerREF Auto Const
;ObjectReference Property pVault111SetStage74TriggerREF Auto Const
;ObjectReference Property pVault111SetStage80TriggerREF Auto Const
;ObjectReference Property pTutorialSetStage100Trigger Auto Const
;ObjectReference Property pTutorialSetStage200Trigger Auto Const
;ObjectReference Property pTutorialSetStage850Trigger Auto Const
;ObjectReference Property pDialogueVault111SetStage97Trigger Auto Const
;ObjectReference Property pMQ102GearDoorConsoleREF Auto Const
;ObjectReference Property pVault111PipboySkeletonREF Auto Const
EndGroup
Group Abernathy_Properties
GlobalVariable Property pPlayerKnowsBrahmin Auto Const
GlobalVariable Property pPlayerKnowsCaps Auto Const
GlobalVariable Property pPlayerKnowsRaiders Auto Const
GlobalVariable Property pPlayerKnowsTatos Auto Const
dialogueabernathyfarmlucy Property pDialogueAbernathyFarmLucy Auto Const
EndGroup
Group CharItems
Armor Property pArmor_WeddingRing Auto Const
Armor Property pArmor_SpouseWeddingRing Auto Const
Armor Property pClothesPrewarWomensCasual Auto Const
Armor Property pChargenPlayerClothes Auto Const
EndGroup
Auto State waitingForPlayer
Event onTriggerEnter(ObjectReference akActionRef)
;debugger
Log = new UserLog
Log.Caller = self
Log.FileName = "StartMeUp"
PlayerREF = Game.GetPlayer()
If (akActionRef == PlayerREF && pSMU_FollowedVanillaPath.GetValueInt() == 0 && pSMU_VaultStart.GetValueInt() == 0 && pSMU_Triggered.GetValueInt() == 0)
;start the appropriate quest to clean up the site where the player started, using the global we set in the bathroom door script
if pSMU_StartPoint.GetValueInt() == 1 ;rangercabin
WriteLine(Log, "Starting point: Ranger Cabin.")
pSMU_RangerCabin.Start()
elseif pSMU_StartPoint.GetValueInt() == 2 ;tenpines
WriteLine(Log, "Starting Point: Tenpines.")
pSMU_Tenpines.Start()
elseif pSMU_StartPoint.GetValueInt() == 3 ;quincy
WriteLine(Log, "Starting Point: Quincy.")
pSMU_Quincy.Start()
elseif pSMU_StartPoint.GetValueInt() == 4 ;raiders
WriteLine(Log, "Starting Point: Raiders near Abernathy.")
pSMU_Raiders.Start()
;SMUR - this does not appear to be working as intended...
;handled from the quest now, but leaving for now
(Game.GetFormFromFile(0x246D12, "Fallout4.ESM") as Actor).StopCombat()
(Game.GetFormFromFile(0x246D10, "Fallout4.ESM") as Actor).StopCombat()
(Game.GetFormFromFile(0x246D0F, "Fallout4.ESM") as Actor).StopCombat()
(Game.GetFormFromFile(0x246D11, "Fallout4.ESM") as Actor).StopCombat()
(Game.GetFormFromFile(0x246D13, "Fallout4.ESM") as Actor).StopCombat()
elseif pSMU_StartPoint.GetValueInt() == 5 ;raiders2
WriteLine(Log, "Starting Point: Raiders at Roadside Pines Motel.")
pSMU_Raiders2.Start()
;SMUR - this does not appear to be working as intended...
;handled from the quest now, but leaving for now
(Game.GetFormFromFile(0x04E933, "Fallout4.ESM") as Actor).StopCombat()
(Game.GetFormFromFile(0x1CCBB8, "Fallout4.ESM") as Actor).StopCombat()
(Game.GetFormFromFile(0x1CCBF5, "Fallout4.ESM") as Actor).StopCombat()
(Game.GetFormFromFile(0x1CCBF8, "Fallout4.ESM") as Actor).StopCombat()
EndIf
;Let's Go play outside...
WriteLine(Log, "beginning phase 2")
SMUstartOutsideVault()
;old leftover global, better leave it in
pSMU_Triggered.SetValueInt(1)
;set up dialogue for abernathy farm so you don't sound like an idiot
WriteLine(Log, "Fixing up dialogue values.")
pPlayerKnowsBrahmin.SetValueInt(1)
;pDialogueAbernathyFarmLucy.LucyFarmBranch = 1
pPlayerKnowsCaps.SetValueInt(1)
pDialogueAbernathyFarmLucy.LucyCapsBranch = 2
pPlayerKnowsRaiders.SetValueInt(1) ;safe
pPlayerKnowsTatos.SetValueInt(1) ;safe
WriteLine(Log, "Player will no longer be a derp when speaking with Lucy Abernathy.")
;start the radios
;/SMUR fix
pRadioDiamondCity.Start()
pRadioInstituteQuest.Start()
pBoSM01.Start()
/;
;start the mod's main quest that gets you connected to the game's main quest
pSMUQuest.SetStage(10)
WriteLine(Log, "SMUQuest stage 10 set.")
;disable v111 map marker, player can see it but not fast travel, gotta do it twice
pVault111MapMarker.EnableFastTravel(false)
;pVault111MapMarker.EnableFastTravel(false)
;SMUR fix - no we don't.
WriteLine(Log, "Beginning wait...")
;SMUR fix - Let's wait twenty seconds before starting Out of Time quest
;this is pausing everything til we get outside the vault
Utility.Wait(20.0)
WriteLine(Log, "done waiting. Finish the trigger script.")
;start "Out of Time" quest
pMQ102.SetStage(10)
;pMQ102.SetObjectiveCompleted(1)
;save the game
Game.RequestSave()
WriteLine(Log, "OnEnterTrigger complete.")
;only run once
gotostate("hasbeentriggered")
ElseIf (akActionRef == PlayerREF)
WriteLine(Log, "Player is starting inside the vault. Shutdown any quests.")
gotostate("hasbeentriggered")
EndIf
EndEvent
EndState
STATE hasbeentriggered
event OnBeginState(string asOldState)
WriteLine(Log, "Spawn point Triggered...")
if pSMU_StartPoint.GetValueInt() == 1 ;rangercabin
WriteLine(Log, "Stopping Ranger Cabin Quest")
pSMU_RangerCabin.Stop()
elseif pSMU_StartPoint.GetValueInt() == 2 ;tenpines
WriteLine(Log, "Stopping Tenpines quest")
pSMU_Tenpines.Stop()
elseif pSMU_StartPoint.GetValueInt() == 3 ;quincy
WriteLine(Log, "Stopping Quincy quest...")
pSMU_Quincy.Stop()
endif
endevent
EndState
Function SMUstartOutsideVault()
WriteLine(Log, "We are going outside the vault...")
;Actor PlayerREF = Game.GetPlayer()
;give the player full anims
PlayerREF.ChangeAnimArchetype(None)
PlayerREF.ChangeAnimArchetype(pAnimArchetypePlayer)
WriteLine(Log, "Running through Vault111 start debug of MQ101/MQ102.")
;stuff from the Vault111 start debug of mq101/mq102
;this is reset if player chooses to play survival mode...
pGameHour.SetValueInt(9)
pTimeScale.SetValueInt(20)
WriteLine(Log, "Fixing up values...")
WriteLine(Log, "Player controls from MQ101")
pMQ101questscript.MQ101EnableLayer = inputenablelayer.Create()
;enable all player controls
pMQ101questscript.MQ101EnableLayer.EnablePlayerControls(True, True, True, True, True, True, True, True, True, True, True)
WriteLine(Log, "doing other stuff...")
;stage 230?
pMQ101HillSoldiersEnableMarker.Disable(False)
;enable that vertibird sound
CSMQ101PlayerHouseInt.Remove()
WriteLine(Log, "Moving trigger.")
;disable the outermost trigger OUTSIDE THE VAULT that simply sets a quest stage, runs once
(Game.GetFormFromFile(0x01D15D, "Fallout4.ESM") as objectreference).DisableNoWait()
;LET"S MOVE THESE TO SMU CELL AS WELL AS DISABLE THEM!.
(Game.GetFormFromFile(0x01D15D, "Fallout4.ESM") as objectreference).MoveTo(Game.GetFormFromFile(0x041525, "StartMeUp.esp") as objectreference)
WriteLine(Log, "Outermost trigger outside of Vault moved.")
;==================================================
; NEED TO CREATE ALISASES FOR THESE TWO BOXES
;==================================================
;these could be grabbed by inter-mod communcation scripting and aliases avoided? ~oddlittleturtle
WriteLine(Log, "2nd trigger moving.")
;second trigger in, applies Vault111AlwaysEnableControlsScript, runs once
pVault111AlwaysEnableControlsTriggerREF.Disable() ;disable the trigger, it is renabled when you Ascend Again
pV111ElevatorCollisionPlatformEnableMarker.Disable() ;obj ref, disable the platform you appear on when you first exit the vault, it is renabled when you Ascend Again
pVault111ElevatorHandler.EnableControlsForElevator() ;enables player controls at the top, probably unnecessary
WriteLine(Log, "2nd Trigger from vault moved.")
WriteLine(Log, "3rd trigger moving.")
;third trigger in, applies vaultExitCommonWealthSCRIPT, runs once, does the blinding light, force weather stuff
(Game.GetFormFromFile(0x051877, "Fallout4.ESM") as objectreference).DisableNoWait()
;LET"S MOVE THESE TO SMU CELL AS WELL AS DISABLE THEM!
(Game.GetFormFromFile(0x051877, "Fallout4.ESM") as objectreference).MoveTo(Game.GetFormFromFile(0x041525, "StartMeUp.esp") as objectreference)
;disable the trigger to respec your character when you leave the vault
pRespecTriggerREF.Disable()
WriteLine(Log, "3rd trigger moved.")
;turn on a trigger that's used to allow the player to use the elevator again, once they exit the vault - from vaultExitElevatorSCRIPT
pV111EnableRaiseElevatorTriggerEnableMarker.Enable()
WriteLine(Log, "Elevator enabled.")
;clean up the inside of the vault
pMQ102PipboyTakeFurnitureREF.SetDestroyed() ;doesn't need a change
WriteLine(Log, "Pipboy furniture destroyed.")
;open overseer door
;Vault111_OverseerDoor.Lock(false) ;unlock the door
;Vault111_OverseerDoor.SetOpen(true) ;open the door
;ok to leave as is, doesn't create a cell record
MQPlayerCryopodREF.SetDestroyed()
WriteLine(Log, "Player Cryopod destroyed.")
;from mq102 stage 3
pVault111BlockedDoorEnableParent.Disable()
pAlias_Vault111QT00.GetRef().Lock(False)
pAlias_Vault111QT00.GetRef().SetOpen()
WriteLine(Log, "Doors opening.")
;set any quest stages
pMQ101.CompleteAllObjectives()
pMQ101.CompleteQuest()
pDialogueVault111.CompleteAllObjectives()
pDialogueVault111.CompleteQuest()
pDialogueVault111.SetStage(100)
pDialogueVault111.SetStage(110)
WriteLine(Log, "Vault111 stages set.")
Game.SetCharGenHUDMode(0)
Game.SetInCharGen(False, False, False)
WriteLine(Log, "CharGen stuff done..")
;remove items
PlayerREF.removeItem(pArmor_WeddingRing, 1, True)
PlayerREF.removeItem(pArmor_SpouseWeddingRing, 1, True)
PlayerREF.removeItem(pClothesPrewarWomensCasual, 1, True)
PlayerREF.removeItem(pChargenPlayerClothes, 1, True)
WriteLine(Log, "Player in the buff...")
WriteLine(Log, "phase 2 complete.")
EndFunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment