Scriptname __LALLPunishBraithScript extends Quest  Conditional


;Essentials
Actor Property PlayerRef Auto
SexlabFramework Property Sexlab Auto
zbfslot Property zSlot Auto Hidden
zbfBondageShell Property ZaZ Auto
zbfSexlab Property ZSL Auto
Quest Property ThisQuest Auto
Spell Property ThrowTomatoReal Auto

;RefA's
ReferenceAlias Property Pillory Auto


;Actors
Actor Property Braith Auto



;Other
Int Property BraithArousal Auto Hidden Conditional
Int Property BraithBound Auto Hidden Conditional
ObjectReference Property BraithSafeholdingChest Auto
Potion Property Tomato Auto

Form[] Property BraithArmor Auto


;Spells
Perk Property TomatoPerk Auto
Spell Property ThrowTomato Auto

;Reward stuff
MiscObject Property Gold001 Auto


Function BraithUnEquip(bool tf)
if tf == true
BraithArmor[0] = Braith.GetWornForm(0x00000004)
BraithArmor[1] = Braith.GetWornForm(0x00000008)
BraithArmor[2] = Braith.GetWornForm(0x00000080)
Braith.UnequipItem(BraithArmor[0],false,true)
Braith.UnequipItem(BraithArmor[1],false,true)
Braith.UnequipItem(BraithArmor[2],false,true)
elseif tf == false
Braith.EquipItem(BraithArmor[0],false,true)
Braith.EquipItem(BraithArmor[1],false,true)
Braith.EquipItem(BraithArmor[2],false,true)
endif
EndFunction



Function SetupScene()
Pillory.TryToEnable()
;Makes sure her 3d is loaded before trying to slot her
Braith.MoveTo(Pillory.GetReference())
utility.wait(0.7)
Zaz.SlotActor(Braith)
zSlot = zaz.FindSlot(Braith)
zSlot.SetFurniture(Pillory.GetReference())
zSlot.PinActor()
BraithBound = 1
BraithUnequip(true)
EndFunction

Function ResetBraith()
zSlot = zaz.FindSlot(Braith)
zSlot.SetFurniture(none)
zSlot.UnpinActor(true)
Zaz.UnslotActor(Braith)
BraithBound = 0
BraithUnequip(false)
EndFunction



Function ArouseBraith(int by)
BraithArousal += by
if BraithArousal >= 15
ThisQuest.SetObjectiveCompleted(20)
ThisQuest.SetObjectiveDisplayed(40)
endif
EndFunction

Message Property ThrowTomatoMSG Auto

Function AddSpells()
PlayerRef.AddPerk(TomatoPerk)
PlayerRef.AddSpell(ThrowTomato)
PlayerRef.AddItem(Tomato,100)
ThrowTomatoMSG.Show()
;debug.messagebox("Throw tomatoes by selecting the throw tomato spell in the illusion magic page")
EndFunction

Function RemoveSpells()
PlayerRef.RemoveSpell(ThrowTomato)
PlayerRef.AddSpell(ThrowTomatoReal)
EndFunction


Function BraithPillorySex()
zbfSexLab zbfSL = zbfSexLab.GetApi()  
Actor[] actors = zbfUtil.ActorList(Braith,PlayerRef)  
zbfSexLabBaseEntry[] list = zbfSL.GetEntriesByTags(actors, "Vaginal", aiMinActorCount = 2)  
Int success = zbfSL.StartSex(actors, list, Victim = Braith, Hook = "MyHook")
RegisterForModEvent("AnimationEnding_MyHook","BraithSexEnd")



EndFunction



Event  BraithSexEnd(string eventName, string argString, float argNum, form sender)
ThisQuest.SetStage(40)
UnregisterForModEvent("BraithSexEnd")
EndEvent

Function QuestReward()
PlayerRef.AddItem(Gold001,500)
EndFunction
