Jump to content

[LE] Sanity Check with Code


ThatGuyYeah

Recommended Posts

I just wanted to make sure that my code seems valid. I have ran several test and it seems fine, but I wanted to make sure it will be fine with a person's game (i.e. no save bloat issues or anything like that). Pretty much this code is my second brain for Serana, which keeps my variables and the relationship mechanic. I will make calls to these functions based on dialogue choices, which will use a fragment script which calls a function in the main script here.

 

I am 95% sure it should be fine, but I just want some external input as a sanity check.

 

 

 

Scriptname SDECustomMentalModel extends Quest  Conditional
{Serana Dialogue Edit Custom Mental Model Script}

Bool Property SDEElderScrollFlirt = False Auto  Conditional
{DLC1VQ03 Flirted With Player During Scroll Talk - Default = False}

Bool Property SDEFirstAdmire = False Auto  Conditional
{First Time Admiring Player - Default = False}

Bool Property SDEFirstIdolize = False Auto  Conditional
{First Time Idolizing Player - Default = False}

Bool Property SDEFirstDespise = False Auto  Conditional
{First Time Despising Player - Default = False}

Bool Property SDEFirstCondemn = False Auto  Conditional
{First Time Condemning Player - Default = False}

Bool Property SDEFirstTolerate = False Auto  Conditional
{First Time Condemning Player - Default = False}

Bool Property SDEMentionedInsectPriest = False Auto  Conditional
{DLC1VQ03 Talked About Themed Insects - Default = False}

Float Property SDEVersion = 0.33 autoReadOnly
{Mod Version - Default = Current Version}

Int Property SDECMMRelVar = 0 Auto  Conditional
{Relationship Mechanic - Default = 0}

Int Property SDECMMRelVarPre = 0 Auto  Conditional
{Relationship Mechanic Previously Before Update - Default = 0}

Quest Property DLC1VQ02 Auto
{Bloodline Quest Requirement}

;Some Initialization for the Mod - Comment Out When not in Beta Except for Initial Evaluator
Event OnInit()
	Debug.Notification("Serana Dialogue Edit Active! Version: " + SDEVersion)
	
	Utility.Wait(1.0)
	
	Debug.Notification("Serana Relationship Value: " + SDECMMRelVar)
	
	Utility.Wait(1.0)
	
	if (DLC1VQ02.GetStage() >= 5) ;If Mod was Loaded After Releasing Serana
		RelationshipEvaluator(SDECMMRelVarPre, SDECMMRelVar)
	endif
EndEvent

;Serana Liking Player Action
Function SeranaLikes()
	Debug.Notification("Serana Likes That")
	
	SDECMMRelVarPre = SDECMMRelVar
	
	SDECMMRelVar += 1
	
	RelationshipEvaluator(SDECMMRelVarPre, SDECMMRelVar)
EndFunction

;Serana Loving Player Action
Function SeranaLoves()
	Debug.Notification("Serana Loves That")
	
	SDECMMRelVarPre = SDECMMRelVar
	
	SDECMMRelVar += 3
	
	RelationshipEvaluator(SDECMMRelVarPre, SDECMMRelVar)
EndFunction

;Serana Disliking Player Action
Function SeranaDislikes()
	Debug.Notification("Serana Dislikes That")
	
	SDECMMRelVarPre = SDECMMRelVar
	
	SDECMMRelVar -= 1
	
	RelationshipEvaluator(SDECMMRelVarPre, SDECMMRelVar)
EndFunction

;Serana Hating Player Action
Function SeranaHates()
	Debug.Notification("Serana Hates That")
	
	SDECMMRelVarPre = SDECMMRelVar
	
	SDECMMRelVar -= 3
	
	RelationshipEvaluator(SDECMMRelVarPre, SDECMMRelVar)
EndFunction

;Auto-Set to Admire - Debug Only
Function AutoAdmire()
	Debug.Notification("Auto Admire Engage")
	
	SDECMMRelVarPre = SDECMMRelVar
	
	SDECMMRelVar = 50
	
	RelationshipEvaluator(SDECMMRelVarPre, SDECMMRelVar)
EndFunction

;Auto-Set to Idolize - Debug Only
Function AutoIdolize()
	Debug.Notification("Auto Idolize Engage")
	
	SDECMMRelVarPre = SDECMMRelVar
	
	SDECMMRelVar = 100
	
	RelationshipEvaluator(SDECMMRelVarPre, SDECMMRelVar)
EndFunction

;Auto-Set to Despise - Debug Only
Function AutoDespise()
	Debug.Notification("Auto Despise Engage")
	
	SDECMMRelVarPre = SDECMMRelVar
	
	SDECMMRelVar = -50
	
	RelationshipEvaluator(SDECMMRelVarPre, SDECMMRelVar)
EndFunction

;Auto-Set to Condemn - Debug Only
Function AutoCondemn()
	Debug.Notification("Auto Condemn Engage")
	
	SDECMMRelVarPre = SDECMMRelVar
	
	SDECMMRelVar = -100
	
	RelationshipEvaluator(SDECMMRelVarPre, SDECMMRelVar)
EndFunction

;Auto-Set to Tolerate - Debug Only
Function AutoZero()
	Debug.Notification("Auto Zero Engage")
	
	SDECMMRelVarPre = SDECMMRelVar
	
	SDECMMRelVar = 0
	
	RelationshipEvaluator(SDECMMRelVarPre, SDECMMRelVar)
EndFunction

;Evaluates the Relationship of Serana - Checks Relationship Value for Overflow & Let's Player Know if Serana Hit Relationship Status for the First Time
Function RelationshipEvaluator(int PastValue, int CurrentValue)
	;Checks Current and Previous Value, if Player Reaches Status Threshold for First Time, Player get Notification
	if ((CurrentValue > 49) && (PastValue <= 49) && (SDEFirstAdmire == false))
		Debug.Notification("Serana Admires You")
		SDEFirstAdmire = true
	elseif ((CurrentValue > 99) && (PastValue <= 99) && (SDEFirstIdolize == false))
		Debug.Notification("Serana Idolizes You")
		SDEFirstAdmire = true
	elseif ((CurrentValue < -49) && (PastValue >= -49) && (SDEFirstDespise == false))
		Debug.Notification("Serana Despises You")
		SDEFirstDespise = true
	elseif ((CurrentValue < -99) && (PastValue >= -99) && (SDEFirstCondemn == false))
		Debug.Notification("Serana Condemns You")
		SDEFirstCondemn = true
	elseif ((CurrentValue == 0) && (PastValue == 0))
		Debug.Notification("Serana Tolerates You")
	endif
	
	;Checks Current and Previous Value, if Player Drops Below Threshold for the First Time, Player get Notification - Some Degree of Tolerance Allowed
	if ((CurrentValue < 30) && (PastValue >= 30) && (SDEFirstAdmire == true))
		Debug.Notification("Serana Tolerates You")
		SDEFirstAdmire = false
	elseif ((CurrentValue < 70) && (PastValue >= 70) && (SDEFirstIdolize == true))
		Debug.Notification("Serana Admires You")
		SDEFirstAdmire = false
	elseif ((CurrentValue > -30) && (PastValue <= -30) && (SDEFirstDespise == true))
		Debug.Notification("Serana Tolerates You")
		SDEFirstDespise = false
	elseif ((CurrentValue > -70) && (PastValue <= -70) && (SDEFirstCondemn == true))
		Debug.Notification("Serana Despises You")
		SDEFirstCondemn = false
	endif
	
	;Checks Value of Relationship Variable - if Variable is Over -200 or +200, Set Variable Back to -200/+200
	if (CurrentValue > 200)
		SDECMMRelVar = 200
	elseif (CurrentValue < -200)
		SDECMMRelVar = -200
	endif
	
	;Send Notification About CurrentValue - Debug Only
	Debug.Notification("Serana Relationship Value: " + CurrentValue)
EndFunction

 

 

 

And here is a sample fragment code:

 

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 1
Scriptname SDE_DEB__00000001 Extends TopicInfo Hidden

;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
SDECMMRel.SeranaLikes()
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

SDECustomMentalModel Property SDECMMRel Auto 

 

 

Edited by ThatGuyYeah
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...