Scriptname __BeginningQuest01Script extends Quest conditional

Actor Property PlayerRef Auto
Actor Property Feria Auto

;Unbound. Do not use for LAL version
SkyrimUnboundQuestScript Property Unbound Auto hidden


Faction Property PlayerFamilyFaction Auto

ObjectReference Property MoveToMarker Auto
ObjectReference Property HomeMapMarker Auto
ObjectReference Property WhiterunDoor Auto

Ingredient Property Blisterwort  Auto  
Potion Property MushroomSoup  Auto  
Idle Property SleepNod Auto
Quest Property ActivatorQuest Auto
Quest Property ThisQuest Auto
Outfit Property PlayerOutfit Auto
Quest Property xxsQuest Auto
Quest Property MaintenanceQuest Auto

ObjectReference Property HouseExitDoor Auto

GlobalVariable Property BjornSexGLB Auto
GlobalVariable Property NicoletteSexGLB Auto

Weather Property NiceWeather  Auto  
Weapon Property IronDagger Auto

sslSystemAlias Property sexLab Auto

;People to make essential
ActorBase Property Haelga Auto
ActorBase Property Oengul Auto
ActorBase Property Hillevi Auto
ActorBase Property Niranye Auto
ActorBase Property Elda Auto
ActorBase Property Ambarys Auto
ActorBase Property Braith Auto
ActorBase Property Mila Auto
ActorBase Property Dagny Auto
ActorBase Property Sofie Auto
ActorBase Property Lucia Auto

;Varying Actors stuff
Formlist Property BjornActorsFL Auto
Formlist Property NicoletteActorsFL Auto
Message Property VaryActorsRoot Auto
Message Property VaryBeastRoot Auto
Int Property BjornSex Auto Conditional
Int Property NicoletteSex Auto Conditional
Quest Property ActorHolderQST Auto

ActorBase[] Property BjornActors Auto
ActorBase[] Property NicoletteActors Auto

ReferenceAlias Property BjornRA Auto
ReferenceAlias Property NicoletteRA Auto

ObjectReference Property BjornSpawn Auto
ObjectReference Property NicoletteSpawn Auto

;0 human 1 khajiit 2 orsimer 3 argonian
Int Property ParentsRace Auto Conditional

;0 balanced 1 yuri 2 yaoi
GlobalVariable Property YuriYaoiMode Auto

Function UnboundAllowTeleport()
Quest UB = Game.GetFormFromFile(0x00000D62,"Skyrim Unbound.esp") as Quest
(UB as SkyrimUnboundFramework).AllowTeleportation()
EndFunction

Function SetSexes(float Bjorn, float Nicolette)
BjornSexGLB.SetValue(Bjorn)
NicoletteSexGLB.SetValue(Nicolette)
EndFunction

Function ShowVaryActorsRoot(int aiButton = 9)
aiButton = VaryActorsRoot.Show()
if aiButton == 0
	;Mom and dad
	BjornSex = 0
	NicoletteSex = 1
SetSexes(0,1)
YuriYaoiMode.SetValue(0)
elseif aiButton == 1
	;mom and mom
	BjornSex = 1
	NicoletteSex = 1
SetSexes(1,1)
YuriYaoiMode.SetValue(1)
elseif aiButton == 2
	;dad and dad
	BjornSex = 0
	NicoletteSex = 0
SetSexes(0,0)
YuriYaoiMode.SetValue(2)
endif
ShowVaryBeastRoot()
EndFunction

Function ArthLALRumorsOfWar()
Quest Rumors = Game.GetFormFromFile(0x0007A334,"Alternate Start - Live Another Life.esp") as Quest
Rumors.RegisterForSingleUpdate(0.25)
EndFunction




Function ShowVaryBeastRoot(int aiButton = 9)
aiButton = VaryBeastRoot.Show()
if aiButton == 0
;human
ParentsRace = 0
elseif aiButton == 1
;Khajiit
ParentsRace = 1
elseif aiButton == 2
;Orsimer
ParentsRace = 2
elseif aiButton == 3
;Argonian
ParentsRace = 3
endif
EndFunction


Function CreateNicolette()
int sex = NicoletteSex
int selRace = ParentsRace


if sex == 1 && selRace == 0
;human femme
ForceNicoletteRef(NicoletteActors[0])
elseif sex == 0 && selrace == 0
;human male
ForceNicoletteRef(NicoletteActors[1])
elseif sex == 1 && selrace == 1
;khajiit femme
ForceNicoletteRef(NicoletteActors[2])
elseif sex == 0 && selrace == 1
;khajiit male
ForceNicoletteRef(NicoletteActors[3])
elseif sex == 1 && selrace == 2
;orc femme
ForceNicoletteRef(NicoletteActors[4])
elseif sex == 0 && selrace == 2
;orc male
ForceNicoletteRef(NicoletteActors[5])
elseif sex == 1 && selrace == 3
;argonian femme
ForceNicoletteRef(NicoletteActors[6])
elseif sex == 0 && selrace == 3
;argonian male
ForceNicoletteRef(NicoletteActors[7])
endif
EndFunction

Function CreateBjorn()
int sex = BjornSex
int selRace = ParentsRace
if sex == 0 && selRace == 0
	;Male human
	ForceBjornRef(BjornActors[0])
elseif sex == 1 && selRace == 0
	;Female human
	ForceBjornRef(BjornActors[1])
elseif sex == 0 && selRace == 1
	;Khajiit male
	ForceBjornRef(BjornActors[2])
elseif sex == 1 && selRace == 1
	;KhajiitFemale
	ForceBjornRef(BjornActors[3])
elseif sex == 0 && selrace == 2
	;Orc male
	ForceBjornRef(BjornActors[4])
elseif sex == 1 && selrace == 2
	;orc femme
	ForceBjornRef(BjornActors[5])
elseif sex == 0 && selrace == 3
	;argonian male
	ForceBjornRef(BjornActors[6])
elseif sex == 1 && selrace == 3
	;argonian femme
	ForceBjornRef(BjornActors[7])
endif
EndFunction

ReferenceAlias Property BjornThisQuestRA Auto

Function ForceBjornRef(ActorBase toForce)
BjornRA.ForceRefTo(BjornSpawn.PlaceAtMe(toForce))
BjornThisQuestRA.ForceRefTo(BjornRA.GetActorReference())
EndFunction

ReferenceAlias Property NicoletteThisQuestRA Auto

Function ForceNicoletteRef(ActorBase toForce)
NicoletteRA.ForceRefTo(NicoletteSpawn.PlaceAtMe(toForce))
NicoletteThisQuestRA.ForceRefTo(NicoletteRA.GetActorReference())
EndFunction





Function MakeEssential()
Haelga.SetEssential(true)
Oengul.SetEssential(true)
Hillevi.SetEssential(true)
Niranye.SetEssential(true)
Elda.SetEssential(true)
Ambarys.SetEssential(true)
Braith.SetEssential(true)
Mila.SetEssential(true)
Dagny.SetEssential(true)
Sofie.SetEssential(true)
Lucia.SetEssential(true)
EndFunction










Function FeriaActivation(bool tf)
Feria.BlockActivation(tf)
EndFunction

;Unlocks whiterun in case the game locks it
Function WhiterunLockFix()
Whiterundoor.Lock(false)
EndFunction

Function EquipStarterClothing()
Form Tors = PlayerOutfit.GetNthPart(0)
Form Shoes = PlayerOutfit.GetNthPart(1)

PlayerRef.EquipItem(Tors,false,true)
PlayerRef.EquipItem(Shoes,false,true)
EndFunction

Function AddToFactions()
PlayerRef.AddToFaction(PlayerFamilyFaction)
EndFunction

Function InstallSexlab()
if sexlab.IsInstalled != true
sexLab.InstallSystem()
endif
EndFunction

Function InitPlayerEntry()
Game.FadeOutGame(false,true,0,5)
Game.DisablePlayerControls(true,true,true,false,true,false,true,false)
Game.ForceThirdPerson()
EquipStarterClothing()
AddToFactions()
PlayerRef.MoveTo(MoveToMarker)
debug.sendAnimationEvent(PlayerRef,"IdleLaydown")
Utility.Wait(2.0)
debug.messagebox("What a wonderful dream... Dragons, giants, and adventure. I wonder what kind of adventures await me today?")
Utility.Wait(5.0)
debug.sendAnimationEvent(PlayerRef,"IdleLaydown_Exit")
;this one unsticks player if stuck
PlayerRef.PlayIdle(SleepNod)
;ActivatorQuest.Start()
PlayerRef.AddItem(IronDagger,1)
ThisQuest.SetActive(true)
Game.EnablePlayerControls()
HomeMapMarker.AddToMap(true)
MakeEssential()
xxsQuest.SetStage(20)
ActorHolderQST.Start()
MaintenanceQuest.Start()
RegisterForSingleUpdateGameTime(1)
EndFunction

Function ToggleDoorBlock(bool abTrue)
if abTrue == True
HouseExitDoor.BlockActivation()
elseif abTrue == False
HouseExitDoor.BlockActivation(false)
endif
EndFunction

Message Property Message1 Auto
Message Property Message2 Auto
Message Property Message3 Auto
Message Property Message4 Auto
Message Property Message5 Auto
Message Property Message6 Auto
Message Property Message7 Auto
Message Property Message8 Auto

Function SetNiceWeather()
;Sets weather to nice condition in anticipation of next quest stage so game has time to do it
NiceWeather.ForceActive()
EndFunction

Function Stage20Thoughts()
Message1.Show()
;debug.messagebox("Hmm... I guess nobody's home right now. Maybe I can go outside to play?")
EndFunction

Function Stage30Thoughts()
;when player enters triggerbox outside
Message2.Show()
;debug.messagebox("Ahh... the air outside is so nice right now.")
Utility.Wait(2.0)
Message3.Show()
;debug.messagebox("Oh! Maybe I can ride my Foal? I haven't gotten a chance to ride him very much yet.")
EndFunction

Function Stage40Thoughts()
;When player mounts foal
;debug.messagebox("Hehe! Just as I imagined it would be. My very own foal!")
Message4.Show()
;debug.messagebox("I'm a bit hungry. Since mom and dad aren't home, maybe I can collect some stuff to make food?")
Message5.Show()
;debug.messagebox("I saw a patch of mushrooms growing the other day. Maybe I can find it again and try those.")
Message6.Show()
EndFunction

Function Stage50Thoughts()
;Player has all the mushrooms
;debug.messagebox("Yay! I think I have enough mushrooms. Now I can take these inside and cook them up!")
Message7.Show()
endFunction

Function Stage60Thoughts()
;player has just cooked mushroom soup
;debug.messagebox("Woo! Mushroom soup! And I did it all without mom or dad's help!")
Message8.Show()
endFunction

Function TogglePolling(bool isTrue)
if isTrue == true
RegisterForUpdate(5.0)
elseif isTrue == false
UnregisterForUpdate()
endif
EndFunction

Event OnUpdate()
;When update is registered
if ThisQuest.GetStage() == 40 && PlayerRef.GetItemCount(Blisterwort) >= 3
ThisQuest.SetStage(50)
endif
if ThisQuest.GetStage() == 50 && PlayerRef.GetItemCount(MushroomSoup) >= 1
ThisQuest.SetStage(60)
endif
if ThisQuest.GetStage() == 80
Feria.EvaluatePackage()
endif
EndEvent

Event OnUpdateGameTime()
if ThisQuest.GetStage() == 10
ThisQuest.SetStage(20)
endif
EndEvent

