Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scriptname DLC1_NPCMentalModelScript extends Quest conditional
- Bool Property PlayerInsultedFamily Auto
- Int Property MentionedLoneliness Auto
- Bool Property IsWillingToWait Auto
- faction Property WIFollowerCommentFaction Auto
- Bool Property PlayerTalkedAboutParents Auto
- referencealias Property RNPC Auto
- Quest Property DialogueFollower Auto
- Bool Property SimpleFollow Auto
- Bool Property TalkedPostQuest Auto
- referencealias Property CentralFollowerAlias Auto
- actor Property Serana Auto
- Int Property DebugGuardedToOpen
- Function Set(Int val)
- __axisGuardedToOpen = val
- EndFunction
- endProperty
- objectreference Property PreChoiceMarker Auto
- Bool Property TurnOffComeWithMe Auto
- Bool Property CutOffCureDiscussion Auto
- Bool Property IsWaiting Auto
- idle Property RF_MoodChangeGuarded Auto
- Bool Property HadMarriageTalk Auto
- Bool Property DTR Auto
- Int Property AxisGuardedToOpen
- Int Function Get()
- return __axisGuardedToOpen
- EndFunction
- Function Set(Int newValue)
- Int oldValue
- oldValue = __axisGuardedToOpen
- __axisGuardedToOpen = ClampInt(newValue, __axisMin, __axisMax)
- if ((oldValue < 0) as Bool) && ((__axisGuardedToOpen >= 0) as Bool)
- AxisCrossedOver()
- endif
- if ((oldValue >= 0) as Bool) && ((__axisGuardedToOpen < 0) as Bool)
- AxisCrossedOver()
- endif
- EndFunction
- endProperty
- Bool Property SpouseIsMale Auto
- Bool Property UnhappyHomeLife Auto
- Float Property PlayerAssessmentIndependence
- Float Function Get()
- return __playerAssessmentIndependence
- EndFunction
- Function Set(Float newValue)
- __playerAssessmentIndependence = ClampFloat(newValue, __assessmentMin, __assessmentMax)
- EndFunction
- endProperty
- Bool Property HappyHomeLife Auto
- Float Property PlayerAssessmentIntelligence
- Float Function Get()
- return __playerAssessmentIntelligence
- EndFunction
- Function Set(Float newValue)
- __playerAssessmentIntelligence = ClampFloat(newValue, __assessmentMin, __assessmentMax)
- EndFunction
- endProperty
- idle Property RF_MoodChangePlayful Auto
- Bool Property IsDismissed Auto
- Bool Property LockedIn Auto
- Bool Property BelievesPlayerIsMarried Auto
- dlc1npcmonitoringplayerscript Property MonitoringQuest Auto
- armor Property Hoodie Auto
- Bool Property FollowDistanceFar Auto
- Int Property SecondsBetweenPeriodicUpdates Auto
- Bool Property TalkedAboutKillingHarkon Auto
- Bool Property PlayerOrphan Auto
- Int Property AxisSeriousToPlayful
- Int Function Get()
- return __axisSeriousToPlayful
- EndFunction
- Function Set(Int newValue)
- Int oldValue
- oldValue = __axisSeriousToPlayful
- __axisSeriousToPlayful = ClampInt(newValue, __axisMin, __axisMax)
- if ((oldValue < 0) as Bool) && ((__axisSeriousToPlayful >= 0) as Bool)
- AxisCrossedOver()
- endif
- if ((oldValue >= 0) as Bool) && ((__axisSeriousToPlayful < 0) as Bool)
- AxisCrossedOver()
- endif
- EndFunction
- endProperty
- Bool Property WillingToTradeItemsWithPlayer Auto
- Bool Property LikesPlayerPostQuest Auto
- globalvariable Property FollowerCount Auto
- Bool Property PlayerLikedParents Auto
- Bool Property FollowDistanceMedium Auto
- objectreference Property HunterHomeMarker Auto
- Bool Property FollowDistanceClose Auto
- Bool Property ToldPlayerSheDidntWantCure Auto
- Bool Property QuestLineCompleted Auto
- Bool Property TalkedAboutKillingHarkonForReal Auto
- armor Property VampArmor Auto
- formlist Property SunDamageExceptionList Auto
- Bool Property PlayerNaive Auto
- idle Property RF_MoodChangeSerious Auto
- Bool Property PlayerParentsAlive Auto
- Bool Property IsFollowing Auto
- objectreference Property VampHomeMarker Auto
- Int Property DebugSeriousToPlayful
- Function Set(Int val)
- __axisSeriousToPlayful = val
- EndFunction
- endProperty
- referencealias Property HomeMarker Auto
- Bool Property CanFollow Auto
- Bool Property PlayerSettled Auto
- referencealias Property RNPC_Essential Auto
- idle Property RF_MoodChangeOpen Auto
- Bool Property CanBeDismissed Auto
- referencealias Property RNPC_Keywords Auto
- Int __historySize = 10
- Float __assessmentMax = 10.00000
- Int[] __axisHistoryGuardedToOpen = None
- Float __minorAssessment = 0.25000
- Int __axisAnchorGuardedToOpen = -1
- Float __majorAssessment = 1.00000
- Float __assessmentAnchorIndependence = 6.50000
- Int __axisAnchorSeriousToPlayful = -2
- Int __axisSeriousToPlayful = 0
- Int __axisMax = 3
- Float __playerAssessmentIntelligence = 0.00000
- Float __moderateAssessment = 0.50000
- Float __playerAssessmentIndependence = 0.00000
- Float __assessmentAnchorIntelligence = 5.00000
- Int[] __axisHistorySeriousToPlayful = None
- Int __axisMin = -3
- Bool __axisCrossingTimeout = false
- Float __assessmentMin = 0.00000
- Float[] __assessmentHistoryIndependence = None
- Bool __isSetup = false
- Int __axisGuardedToOpen = 0
- Float[] __assessmentHistoryIntelligence = None
- Float Function ClampFloat(Float value, Float min, Float max)
- if (value > max)
- value = max
- endif
- if (value < min)
- value = min
- endif
- return value
- EndFunction
- Function Wait()
- debug.Trace("RNPC: Being told to wait...", 0)
- if !(IsWillingToWait)
- debug.Trace("RNPC: ... but not listening.", 0)
- IsWaiting = true
- endif
- debug.Trace("RNPC: ... and obeying.", 0)
- IsWaiting = true
- RNPC.GetActorReference()
- RNPC.GetActorReference().SetAV("WaitingForPlayer", (1 as Float))
- RNPC.GetActorReference()
- RNPC.GetActorReference().EvaluatePackage()
- (RNPC as dlc1rnpcaliasscript).RegisterForUpdateGameTime((72 as Float))
- EndFunction
- Int Function ClampInt(Int value, Int min, Int max)
- if (value > max)
- value = max
- endif
- if (value < min)
- value = min
- endif
- return value
- EndFunction
- Function FinishWaiting()
- IsWaiting = false
- RNPC.GetActorReference()
- RNPC.GetActorReference().SetAV("WaitingForPlayer", (0 as Float))
- if CanBeDismissed
- DisengageFollowBehavior()
- Dismiss()
- endif
- RNPC.GetActorReference()
- RNPC.GetActorReference().EvaluatePackage()
- EndFunction
- Function Dismiss()
- if CanBeDismissed
- DisengageFollowBehavior()
- IsDismissed = true
- if (CentralFollowerAlias.GetReference() == RNPC.GetReference())
- (DialogueFollower as dialoguefollowerscript).DismissFollower(0, 1)
- endif
- RNPC.GetActorReference()
- RNPC.GetActorReference().SetPlayerTeammate(false, true)
- endif
- EndFunction
- Function IncreaseSerious(Int amount)
- ModAxis(1, amount)
- EndFunction
- Function IncreasePlayful(Int amount)
- ModAxis(1, amount)
- EndFunction
- Function DebugOutput()
- debug.OpenUserLog("RNPC_MentalModel")
- debug.TraceUser("RNPC_MentalModel", ((((((((" " + (__axisGuardedToOpen as String)) + " ") + (__axisSeriousToPlayful as String)) + " ") + (__playerAssessmentIntelligence as String)) + " ") + (__playerAssessmentIndependence as String)) + " "), 0)
- EndFunction
- Function IncreaseGuarded(Int amount)
- ModAxis(2, amount)
- EndFunction
- Function ModAxis(Int axisIndex, Int amount)
- if (axisIndex == 1)
- AxisSeriousToPlayful = (AxisSeriousToPlayful + amount)
- endif
- if (axisIndex == 2)
- AxisGuardedToOpen = (AxisGuardedToOpen + amount)
- endif
- EndFunction
- Function Unlock()
- debug.Trace("RNPC: Unlocking.", 0)
- LockedIn = false
- DisengageFollowBehavior()
- FollowerCount.SetValue((0 as Float))
- EndFunction
- Function QuestLineFinish()
- EndFunction
- Function SlamToPlayful()
- debug.Trace("RNPC: Forcing to 'playful' animation base.", 0)
- __axisSeriousToPlayful = 3
- __axisGuardedToOpen = 3
- AxisCrossedOver()
- EndFunction
- Function LockIn()
- debug.Trace("RNPC: Locking.", 0)
- LockedIn = true
- EngageFollowBehavior(false)
- FollowerCount.SetValue((1 as Float))
- EndFunction
- Function DisengageFollowBehavior()
- debug.Trace("RNPC: Disengaging follow.", 0)
- IsFollowing = false
- IsWaiting = false
- CanBeDismissed = true
- RNPC.GetActorReference()
- RNPC.GetActorReference().SetPlayerTeammate(false, true)
- RNPC.GetActorReference()
- RNPC.GetActorReference().EvaluatePackage()
- RNPC.GetActorReference()
- RNPC.GetActorReference().RemoveFromFaction(WIFollowerCommentFaction)
- if ((CentralFollowerAlias.GetReference() == None) as Bool) && ((FollowerCount.GetValue() == (1 as Float)) as Bool)
- FollowerCount.SetValue((0 as Float))
- endif
- MonitoringQuest.Stop()
- EndFunction
- Function SlamToSerious()
- debug.Trace("RNPC: Forcing to 'serious' animation base.", 0)
- __axisSeriousToPlayful = 3
- __axisGuardedToOpen = -3
- AxisCrossedOver()
- EndFunction
- Function DecreaseIndependenceModerate()
- ModAssessment(3, __moderateAssessment)
- EndFunction
- {Function that switches this object to the specified state}
- Function GotoState(String newState)
- onEndState()
- ::State = newState
- onBeginState()
- EndFunction
- Function IncreaseIntelligenceModerate()
- ModAssessment(2, __moderateAssessment)
- EndFunction
- Function DecreaseSerious(Int amount)
- ModAxis(1, amount)
- EndFunction
- Function IncreaseIndependenceModerate()
- ModAssessment(3, __moderateAssessment)
- EndFunction
- Function DumpHistory()
- Int count
- count = 0
- while (count < __historySize)
- debug.TraceUser("RNPC_HistoryDump", (((((((("" + (__axisHistoryGuardedToOpen[count] as String)) + " ") + (__axisHistorySeriousToPlayful[count] as String)) + " ") + (__assessmentHistoryIntelligence[count] as String)) + " ") + (__assessmentHistoryIndependence[count] as String)) + " "), 0)
- count = (count + 1)
- endWhile
- EndFunction
- {Function that returns the current state}
- String Function GetState()
- return ::State
- EndFunction
- Function OnUpdate()
- Int count
- debug.Trace("RNPC: Periodic update check.", 0)
- DebugOutput()
- count = 0
- while (count < (__historySize - 1))
- __axisHistoryGuardedToOpen[count] = __axisHistoryGuardedToOpen[(count + 1)]
- __axisHistorySeriousToPlayful[count] = __axisHistorySeriousToPlayful[(count + 1)]
- __assessmentHistoryIntelligence[count] = __assessmentHistoryIntelligence[(count + 1)]
- __assessmentHistoryIndependence[count] = __assessmentHistoryIndependence[(count + 1)]
- count = (count + 1)
- endWhile
- __axisHistoryGuardedToOpen[(__historySize - 1)] = __axisGuardedToOpen
- __axisHistorySeriousToPlayful[(__historySize - 1)] = __axisSeriousToPlayful
- __assessmentHistoryIntelligence[(__historySize - 1)] = __playerAssessmentIntelligence
- __assessmentHistoryIndependence[(__historySize - 1)] = __playerAssessmentIndependence
- if FollowDistanceFar FollowDistanceFar = true
- FollowDistanceMedium = false
- FollowDistanceClose = false
- endif
- && FollowDistanceMediumFollowDistanceFar = false
- FollowDistanceMedium = true
- FollowDistanceClose = false
- endif
- && FollowDistanceClose
- FollowDistanceFar = false
- FollowDistanceMedium = false
- FollowDistanceClose = true
- endif
- FollowDistanceFar = false
- FollowDistanceMedium = false
- FollowDistanceClose = false
- if QuestLineCompleted
- CanFollow = true
- IsWillingToWait = true
- CanBeDismissed = true
- endif
- CheckOutfit()
- RegisterForSingleUpdate((SecondsBetweenPeriodicUpdates as Float))
- EndFunction
- Function IncreaseIntelligenceMinor()
- ModAssessment(2, __minorAssessment)
- EndFunction
- Function SetHomeMarker(Int choiceSet, objectreference newHomeMarker)
- if !((newHomeMarker == None))
- HomeMarker.ForceRefTo(newHomeMarker)
- endif
- if (choiceSet == 1)
- HomeMarker.ForceRefTo(HunterHomeMarker)
- endif
- if (choiceSet == 2)
- HomeMarker.ForceRefTo(VampHomeMarker)
- endif
- EndFunction
- Function ModAssessment(Int assessmentIndex, Float amount)
- if (assessmentIndex == 1)
- endif
- if (assessmentIndex == 2)
- PlayerAssessmentIndependence = (PlayerAssessmentIndependence + amount)
- endif
- if (assessmentIndex == 3)
- PlayerAssessmentIndependence = (PlayerAssessmentIndependence + amount)
- endif
- EndFunction
- Function IncreaseIntelligenceMajor()
- ModAssessment(2, __majorAssessment)
- EndFunction
- Function Setup(Int forceNPC)
- Int count
- if __isSetup
- return
- endif
- __isSetup = true
- debug.Trace("RNPC: Initiating NPC mental model.", 0)
- __axisHistoryGuardedToOpen = new Int[10]
- __axisHistorySeriousToPlayful = new Int[10]
- __assessmentHistoryIntelligence = new Float[10]
- __assessmentHistoryIndependence = new Float[10]
- count = 0
- while (count < __historySize)
- __axisHistoryGuardedToOpen[count] = __axisAnchorGuardedToOpen
- __axisHistorySeriousToPlayful[count] = __axisAnchorSeriousToPlayful
- __assessmentHistoryIntelligence[count] = __assessmentAnchorIntelligence
- __assessmentHistoryIndependence[count] = __assessmentAnchorIndependence
- count = (count + 1)
- endWhile
- __axisGuardedToOpen = __axisAnchorGuardedToOpen
- __axisSeriousToPlayful = __axisAnchorSeriousToPlayful
- RNPC.GetReference()
- RNPC_Keywords.ForceRefTo(RNPC.GetReference())
- RegisterForSingleUpdate((SecondsBetweenPeriodicUpdates as Float))
- EndFunction
- Function DecreaseIntelligenceMinor()
- ModAssessment(2, __minorAssessment)
- EndFunction
- Function EngageFollowBehavior(Bool allowDismiss)
- debug.Trace("RNPC: Engaging follow.", 0)
- if ((CentralFollowerAlias.GetReference() == None) as Bool) && ((FollowerCount.GetValue() == (0 as Float)) as Bool)FollowerCount.SetValue((1 as Float))
- endif
- && QuestLineCompleted
- allowDismiss = true
- endif
- IsFollowing = true
- IsWaiting = false
- SimpleFollow = false
- CanFollow = true
- IsDismissed = false
- CanBeDismissed = allowDismiss
- RNPC.GetActorReference()
- RNPC.GetActorReference().SetPlayerTeammate(true, true)
- RNPC.GetActorReference()
- RNPC.GetActorReference().EvaluatePackage()
- RNPC.GetActorReference()
- RNPC.GetActorReference().AddToFaction(WIFollowerCommentFaction)
- MonitoringQuest.Start()
- EndFunction
- Function StopWaiting()
- if IsDismissed
- EngageFollowBehavior(CanBeDismissed)
- endif
- IsWaiting = false
- (RNPC as dlc1rnpcaliasscript).UnregisterForUpdateGameTime()
- RNPC.GetActorReference()
- RNPC.GetActorReference().SetAV("WaitingForPlayer", (0 as Float))
- RNPC.GetActorReference()
- RNPC.GetActorReference().EvaluatePackage()
- EndFunction
- Function DecreaseOpen(Int amount)
- ModAxis(2, amount)
- EndFunction
- Function SlamToGuarded()
- debug.Trace("RNPC: Forcing to 'guarded' animation base.", 0)
- __axisSeriousToPlayful = -3
- __axisGuardedToOpen = -3
- AxisCrossedOver()
- EndFunction
- Function DecreaseIntelligenceMajor()
- ModAssessment(2, __majorAssessment)
- EndFunction
- Function DecreaseIndependenceMinor()
- ModAssessment(3, __minorAssessment)
- EndFunction
- Function IncreaseIndependenceMinor()
- ModAssessment(3, __minorAssessment)
- EndFunction
- Function CheckOutfit()
- actor rnpcActor
- Bool shouldWearHood
- worldspace currentSpace
- rnpcActor = RNPC.GetActorReference()
- shouldWearHood = false
- if rnpcActor.IsInInterior()
- shouldWearHood = false
- endif
- RNPC.GetReference()
- currentSpace = RNPC.GetReference().GetWorldSpace()
- if (SunDamageExceptionList.Find((currentSpace as form)) < 0)
- shouldWearHood = true
- endif
- shouldWearHood = false
- if !(shouldWearHood)
- if (rnpcActor.IsEquipped((VampArmor as form)) as Bool) && (rnpcActor.IsEquipped((Hoodie as form)) as Bool)
- debug.Trace("RNPC: Inside, taking off hood.", 0)
- rnpcActor.RemoveItem((Hoodie as form), 1, false, None)
- endif
- endif
- if (rnpcActor.IsEquipped((VampArmor as form)) as Bool) && (!(rnpcActor.IsEquipped((Hoodie as form))) as Bool)
- debug.Trace("RNPC: Outside, putting on hood.", 0)
- rnpcActor.AddItem((Hoodie as form), 1, false)
- rnpcActor.EquipItem((Hoodie as form), false, false)
- endif
- EndFunction
- Function DecreaseGuarded(Int amount)
- ModAxis(2, amount)
- EndFunction
- Function DecreaseIntelligenceModerate()
- ModAssessment(2, __moderateAssessment)
- EndFunction
- Function DecreasePlayful(Int amount)
- ModAxis(1, amount)
- EndFunction
- Function SlamToOpen()
- debug.Trace("RNPC: Forcing to 'open' animation base.", 0)
- __axisSeriousToPlayful = -3
- __axisGuardedToOpen = 3
- AxisCrossedOver()
- EndFunction
- Function IncreaseIndependenceMajor()
- ModAssessment(3, __majorAssessment)
- EndFunction
- Function DecreaseIndependenceMajor()
- ModAssessment(3, __majorAssessment)
- EndFunction
- Function AxisCrossedOver()
- if __axisCrossingTimeout
- return
- endif
- debug.Trace("RNPC: Axis crossed.", 0)
- __axisCrossingTimeout = true
- if ((__axisGuardedToOpen < 0) as Bool) && ((__axisSeriousToPlayful < 0) as Bool)
- RNPC.GetActorReference()
- endif
- if ((__axisGuardedToOpen >= 0) as Bool) && ((__axisSeriousToPlayful < 0) as Bool)
- RNPC.GetActorReference()
- endif
- if ((__axisGuardedToOpen < 0) as Bool) && ((__axisSeriousToPlayful >= 0) as Bool)
- RNPC.GetActorReference()
- endif
- if ((__axisGuardedToOpen >= 0) as Bool) && ((__axisSeriousToPlayful >= 0) as Bool)
- RNPC.GetActorReference()
- RNPC.GetActorReference().PlayIdle(RF_MoodChangePlayful)
- endif
- utility.Wait(0.10000)
- __axisCrossingTimeout = false
- EndFunction
- Function IncreaseOpen(Int amount)
- ModAxis(2, amount)
- EndFunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement