Scriptname LALLSkyrimUnboundScript extends Quest conditional
{Repurposed to handle both unbound and LAL}

;Unbound forms that we need
Formlist Property Markers_Other Auto hidden

;Live Another life
ObjectReference Property MaraStatue Auto hidden
ObjectReference Property FakeBed Auto hidden
Quest Property SecondChance Auto hidden
Quest Property LiveAnotherLifeQuest Auto hidden
Int Property MaraStatueFormID Auto conditional
TalkingActivator Property MaraStatueTact Auto hidden

;Useless vars
Int Property IsLAL Auto conditional hidden
Int Property IsUnbound Auto conditional hidden



;LALL stuff
ObjectReference Property PlayerInsertionMarker Auto
Quest Property FirstQuest Auto
Formlist Property MaraStatueFlist Auto

Event OnInit()
CheckLALUnbound()
EndEvent

Int Property LoadOnce Auto hidden

Function OnLoad()
if LoadOnce > 2
CheckLALUnbound()
LoadOnce += 1
endif
EndFunction




Function CheckLALUnbound()
Markers_Other = Game.GetFormFromFile(0x004476F5,"Skyrim Unbound.esp") as FormList
MaraStatueTact = Game.GetFormFromFile(0x0000C179,"Alternate Start - Live Another Life.esp") as TalkingActivator

if Markers_other != none
UnboundInit()
IsUnbound = 1
IsLAL = 0
elseif MaraStatueTact != none
LALInit()
IsLAL = 1
IsUnbound = 0
endif
EndFunction




Function UnboundInit()
Markers_Other.AddForm(PlayerInsertionMarker)
StorageUtil.SetStringValue(PlayerInsertionMarker, "SkyrimUnboundName", "Live Another Loli Shota Life")
StorageUtil.SetFormValue(PlayerInsertionMarker, "SkyrimUnboundQuest", FirstQuest)

;Everything is good and set up here!

EndFunction


Function LALInit()
FakeBed = Game.GetFormFromFile(0x000386DC,"Alternate Start - Live Another Life.esp") as ObjectReference
SecondChance = Game.GetFormFromFile(0x00000DAF,"Alternate Start - Live Another Life.esp") as Quest
LiveAnotherLifeQuest = Game.GetFormFromFile(0x0007A334,"Alternate Start - Live Another Life.esp") as Quest

;We need to give the dialogue to the Mara statue
MaraStatueFlist.AddForm(MaraStatueTact)



EndFunction

;To tell the player to lay in the LAL bed
Function SleepInBedLAL()
(SecondChance as arth_lal_startQuest).SetAddonQuestStage(10,FirstQuest)
EndFunction