Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by

Frequia

Uploaded by

frequiaaa

Virus scan

Safe to use

Tags for this mod

About this mod

Track how much time a player spends with your follower, and reward them with new features and dialogue.

Permissions and credits
I developed this script/system for use with my follower, Lucina, and I thought I'd share it.


What Is This?

This script tracks the time players have spent with your follower by increasing a global variable every 24 hours, which you can then check the value of in your quests, dialogue, spells, combat packages, other scripts, etc. to "unlock" more content the more the player spends time with your follower.

It's customizable. You can set the "cap" at 500, or you can set it at 1,000 and make it a grind. You can also add "hooks" with events or dialogue options that, in their fragments, call the increase or decrease functions to simulate a more nuanced affection system. The provided script is very simple, though, only increasing the variable every 24 hours if the follower is in the player's employ.

Like with Better Follower Catchup Script for Custom Framework Followers, this script doesn't start out polling, and should only be working when your follower is in the player's employ. Thus, you need to call the "Register" and "Unregister" functions in your framework's follow, wait, dismiss, etc. functions to toggle the script on and off.


Instructions

  1. Create two new global variables: one to represent the affection amount (LDevotion) and one to dictate how much it increases and decreases by (LDevotionAmount). Make sure that they're both zero, and constant is not checked.
  2. Import the script onto your follower framework quest, or create a new script and copy and paste from the code block below.
  3. Right click on the script and fill the properties.
  4. Add the script ("Frequia_LucinaDevotion") as a property to your follower framework script. You do this by going into the properties window, adding a new property, and typing the script name into both the type and name boxes, then choosing the object it's attached to under "Pick Object."
  5. Call the functions in your follower framework script, like in the screenshot (2).
  6. When creating dialogue, spells, and other conditions, use "GetGlobalVariable" to gate it beneath or above a certain value.


The Script Itself



Scriptname Frequia_LucinaDevotion extends Quest 


; - - - - - - - - - - - -
; PROPERTIES
; - - - - - - - - - - - -


Actor Property PlayerREF Auto
Actor Property Lucina Auto
GlobalVariable Property LDevotion Auto
GlobalVariable Property LDevotionAmount Auto
Faction Property CurrentFollowerFaction Auto


; - - - - - - - - - - - -
; SCRIPT BEGINS
; - - - - - - - - - - - -


; call this when you want to start the script
; 24.0 = 24 in-game hours
Function Register()

RegisterForSingleUpdateGameTime(24.0)

EndFunction


; call this when you want to stop the script
Function Unregister()

UnregisterForUpdateGameTime()

EndFunction


; on update, do the following
Event OnUpdateGameTime()

; check every 24h
RegisterForSingleUpdateGameTime(24.0)

; if she's not dead
If Lucina.IsDead() == False

; begin increase if applicable

; if she's a follower
If (Lucina.IsInFaction(CurrentFollowerFaction))

Increase()

EndIf

Balance()

EndIf

EndEvent


; increase devotion
Function Increase()

float Devotion = LDevotion.GetValue() 
float Devotijavascript-event-stripped LDevotionAmount.GetValue()
float NewDevotion = (Devotion + DevotionAmount)
LDevotion.SetValue(NewDevotion)

EndFunction


; decrease devotion
Function Decrease()

float Devotion = LDevotion.GetValue() 
float Devotijavascript-event-stripped LDevotionAmount.GetValue()
float NewDevotion = (Devotion - DevotionAmount)
LDevotion.SetValue(NewDevotion)

EndFunction


; keep devotion within range
Function Balance()

float Devotion = LDevotion.GetValue()

; if devotion less than zero
If Devotion < 0

LDevotion.SetValue(0)

; if devotion more than cap
; change the numbers (500) to change the cap
ElseIf Devotion > 500

LDevotion.SetValue(500)

EndIf

EndFunction