-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #752 from tiltedphoques/dev
V1.7.1
- Loading branch information
Showing
12 changed files
with
384 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
101 changes: 101 additions & 0 deletions
101
GameFiles/Skyrim/scripts/source/PetFramework_ParentQuestScript.psc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
Scriptname PetFramework_ParentQuestScript extends Quest | ||
{Get/Set functions for pet count and limit checks. All other shared controls are in PetFramework_PetScript.} | ||
;rvogel 9/2017 | ||
|
||
GlobalVariable Property PetFramework_MaxPets Auto ;Max number of pets who can follow at once, default is 2 | ||
|
||
;RefAliases to fill from DLC at runtime | ||
|
||
ReferenceAlias Property DLC2SeverinManorEnableMarker Auto | ||
ReferenceAlias Property HomeMarkerDLC2SeverinManor Auto | ||
|
||
ReferenceAlias Property BYOH01DoorLakeviewManor Auto | ||
ReferenceAlias Property BYOH02DoorWindstadManor Auto | ||
ReferenceAlias Property BYOH03DoorHeljarchenHall Auto | ||
|
||
ReferenceAlias Property HomeMarkerLakeviewManor Auto | ||
ReferenceAlias Property HomeMarkerWindstadManor Auto | ||
ReferenceAlias Property HomeMarkerHeljarchenHall Auto | ||
|
||
Faction Property PetFramework_PetFaction Auto | ||
Faction Property PlayerFaction Auto | ||
|
||
Faction Property CWSonsFaction Auto | ||
Faction Property CWImperialFaction Auto | ||
|
||
; Setting start CurrentPetCount over the Max so the player cannot dismiss 2 pets and recruit new ones while online. Hypothetically. | ||
Int Property CurrentPetCount = 4 Auto Hidden ;Current count of pets, this is manipulated by pet ESPs/ESLs using the functions below | ||
|
||
Event OnInit() | ||
debug.trace("Setting pet and player relationship to ally") | ||
PetFramework_PetFaction.SetAlly(PlayerFaction) | ||
|
||
;Prevent CW actors from becoming hostile to pets | ||
PetFramework_PetFaction.SetAlly(CWSonsFaction) | ||
PetFramework_PetFaction.SetAlly(CWImperialFaction) | ||
EndEvent | ||
|
||
Int Function GetCurrentPetCount() | ||
{Called by 'child' pet ESPs/ESLs to get current count and limit} | ||
Return CurrentPetCount | ||
EndFunction | ||
|
||
Int Function GetMaxPets() | ||
{Called by 'child' pet ESPs/ESLs to get max pets} | ||
Return PetFramework_MaxPets.GetValue() as Int | ||
EndFunction | ||
|
||
Function IncrementPetCount() | ||
{Called by 'child' pet ESPs/ESLs to update active pet count} | ||
CurrentPetCount += 1 | ||
EndFunction | ||
|
||
Function DecrementPetCount() | ||
{Called by 'child' pet ESPs/ESLs to update active pet count} | ||
If(CurrentPetCount > 0) | ||
CurrentPetCount -= 1 | ||
EndIf | ||
EndFunction | ||
|
||
Bool Function HasMaxPets() | ||
{Called to check if the player has the maximum pets allowed} | ||
|
||
If(GetCurrentPetCount() == GetMaxPets()) | ||
Return True | ||
Else | ||
Return False | ||
EndIf | ||
|
||
EndFunction | ||
|
||
|
||
Function FillRefAliasesFromDLC() | ||
{Called from first stage of quest to fill aliases from DLC that are unreachable by Update.esm} | ||
|
||
;Dragonborn Refs (Marker and Chest used to check ownership) | ||
ObjectReference DLC2SeverinManorEnableRef = (Game.GetFormFromFile(0x040396D0, "dragonborn.esm") as ObjectReference) | ||
ObjectReference DLC2SeverinManorMarkerRef = (Game.GetFormFromFile(0x0403BD35, "dragonborn.esm") as ObjectReference) | ||
|
||
;Hearthfire Refs (Doors) | ||
ObjectReference DoorLakeviewManorRef = (Game.GetFormFromFile(0x03003221, "hearthfires.esm") as ObjectReference) | ||
ObjectReference DoorWindstadManorRef = (Game.GetFormFromFile(0x0300B852, "hearthfires.esm") as ObjectReference) | ||
ObjectReference DoorHeljarchenHallRef = (Game.GetFormFromFile(0x03010DDF, "hearthfires.esm") as ObjectReference) | ||
|
||
;Hearthfire Refs (Markers) | ||
ObjectReference MarkerLakeviewManorRef = (Game.GetFormFromFile(0x0300309B, "hearthfires.esm") as ObjectReference) | ||
ObjectReference MarkerWindstadManorRef = (Game.GetFormFromFile(0x0301205C, "hearthfires.esm") as ObjectReference) | ||
ObjectReference MarkerHeljarchenHallRef = (Game.GetFormFromFile(0x03016E05, "hearthfires.esm") as ObjectReference) | ||
|
||
;Fill the refs | ||
DLC2SeverinManorEnableMarker.ForceRefTo(DLC2SeverinManorEnableRef) | ||
HomeMarkerDLC2SeverinManor.ForceRefTo(DLC2SeverinManorMarkerRef) | ||
|
||
BYOH01DoorLakeviewManor.ForceRefTo(DoorLakeviewManorRef) | ||
BYOH02DoorWindstadManor.ForceRefTo(DoorWindstadManorRef) | ||
BYOH03DoorHeljarchenHall.ForceRefTo(DoorHeljarchenHallRef) | ||
|
||
HomeMarkerLakeviewManor.ForceRefTo(MarkerLakeviewManorRef) | ||
HomeMarkerWindstadManor.ForceRefTo(MarkerWindstadManorRef) | ||
HomeMarkerHeljarchenHall.ForceRefTo(MarkerHeljarchenHallRef) | ||
|
||
EndFunction |
129 changes: 129 additions & 0 deletions
129
GameFiles/Skyrim/scripts/source/PetFramework_PetQuest.psc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
Scriptname PetFramework_PetQuest extends Quest Conditional | ||
{Manages the pet's home location, commands, etc. Some functions are called from the pet actor script.} | ||
|
||
PetFramework_ParentQuestScript Property PetFramework_ParentQuest Auto | ||
Message Property PetFramework_PetDismissMessage Auto | ||
Message Property PetFramework_PetMaxReachedMessage Auto | ||
Faction Property PetFramework_PetFollowingFaction Auto | ||
Faction Property PlayerFaction Auto | ||
Faction Property PetFramework_PetFaction Auto | ||
ReferenceAlias Property PetHomeMarker Auto | ||
ReferenceAlias Property PetRefAlias Auto | ||
ReferenceAlias Property PetDynamicHomeMarker Auto | ||
Bool Property MovingTogglePackageOn = False Auto Conditional Hidden ;Hearthfire adoption/move trick - turn on a temporary package | ||
|
||
Function MakePetAvailableToPlayer() | ||
{Called when the quest meets the criteria for the pet to be available, i.e. purchase, rescue, whatever scenario. Without this the pet cannot be talked to or recruited.} | ||
PetRefAlias.GetActorReference().SetFactionRank(PetFramework_PetFaction, 1) | ||
;PetRefAlias.GetActorReference().AddToFaction(PlayerFaction) | ||
EndFunction | ||
|
||
Function MakePetUnavailableToPlayer() | ||
{If for some reason we want to make the pet unavailable to player, i.e. sell it someone else, etc. this function will do that} | ||
PetRefAlias.GetActorReference().SetFactionRank(PetFramework_PetFaction, 0) | ||
;PetRefAlias.GetActorReference().RemoveFromFaction(PlayerFaction) | ||
EndFunction | ||
|
||
Function FollowPlayer(Bool snapIntoInteraction = False) | ||
{Called when the player recruits the pet via dialogue.} | ||
|
||
If(PetFramework_ParentQuest.HasMaxPets()) | ||
PetFramework_PetMaxReachedMessage.Show() | ||
Else | ||
PetFramework_PetDismissMessage.Show() | ||
return ; STR players ignore the pets. | ||
debug.trace("Pet Framework: " + PetRefAlias.GetActorReference() + " setting to following player") | ||
debug.trace("Pet Framework: " + PetRefAlias.GetActorReference() + " PetFollowingFactionRank: " + PetRefAlias.GetActorReference().GetFactionRank(PetFramework_PetFollowingFaction)) | ||
|
||
;If the pet was waiting for the player, clear the actor value (no need to check just run it) | ||
WaitForPlayer(False) | ||
|
||
;Set the rank to 1, which will enable dialogue commands, etc. (used by shared pet framework) | ||
PetRefAlias.GetActorReference().SetFactionRank(PetFramework_PetFollowingFaction, 1) | ||
|
||
debug.trace("Pet Framework: " + PetRefAlias.GetActorReference() + " PetFollowingFactionRank: " + PetRefAlias.GetActorReference().GetFactionRank(PetFramework_PetFollowingFaction)) | ||
|
||
;Some animals have very long idles they get 'stuck' which feels like recruiting them didn't do anything | ||
If(snapIntoInteraction) | ||
PetRefAlias.GetReference().Disable() | ||
PetRefAlias.GetReference().Enable() | ||
EndIf | ||
|
||
PetFramework_ParentQuest.IncrementPetCount() | ||
debug.trace("Pet Count: " + PetFramework_ParentQuest.GetCurrentPetCount()) | ||
|
||
;Re-evaluate the package stack based on our new conditions | ||
PetRefAlias.GetActorReference().EvaluatePackage() | ||
|
||
EndIf | ||
|
||
EndFunction | ||
|
||
Function WaitForPlayer(Bool doWait = True) | ||
{True/False: Pet will wait for the player or continue to follow.} | ||
|
||
DEBUG.TRACE("WaitForPlayer called with value: " + doWait) | ||
|
||
If(doWait == True) | ||
debug.trace("PetFramework Setting pet to wait for player") | ||
PetRefAlias.GetActorReference().SetAV("WaitingForPlayer", 1) | ||
Else | ||
debug.trace("PetFramework Setting pet to stop waiting for player") | ||
PetRefAlias.GetActorReference().SetAV("WaitingForPlayer", 0) | ||
EndIf | ||
|
||
;Re-evaluate the package stack based on our new conditions | ||
PetRefAlias.GetActorReference().EvaluatePackage() | ||
|
||
EndFunction | ||
|
||
Function SetHomeToCurrentLocation() | ||
{Makes the "Home" of the pet right where they stand, so they will dismiss and sandbox the area (house mods, camping, etc.)} | ||
|
||
;Move the xmarker to where the pet is standing | ||
PetDynamicHomeMarker.GetReference().MoveTo(PetRefAlias.GetReference()) | ||
PetDynamicHomeMarker.GetReference().SetAngle(0,0,0) | ||
|
||
;Set the home idle marker to the dynamic marker | ||
SetNewHome(PetDynamicHomeMarker, True) | ||
|
||
EndFunction | ||
|
||
Function SetNewHome(ReferenceAlias newLocation, Bool dismiss = True, Bool doWarp = False) | ||
|
||
debug.trace("Set New Home called from actor proxy") | ||
|
||
;Clear the waiting flag | ||
WaitForPlayer(False) | ||
|
||
;Turn on the temporary package while we change the ref alias data for their idle package - trick from Hearthfire adoption | ||
MovingTogglePackageOn = True ;"Hold"AI package looks at this quest var | ||
PetRefAlias.GetActorReference().EvaluatePackage() | ||
|
||
;Set the ref alias to be the pet's new home | ||
PetHomeMarker.ForceRefTo(newLocation.GetReference()) | ||
|
||
;Remove them from current following faction so they actually go to their new home | ||
If(dismiss) | ||
PetRefAlias.GetActorReference().SetFactionRank(PetFramework_PetFollowingFaction, 0) | ||
EndIf | ||
|
||
Utility.Wait(0.1) | ||
|
||
MovingTogglePackageOn = False | ||
PetRefAlias.GetActorReference().EvaluatePackage() | ||
|
||
If(doWarp) | ||
Utility.Wait(0.01) | ||
PetRefAlias.GetReference().MoveTo(newLocation.GetReference(), 0,0,0,False) | ||
EndIf | ||
|
||
PetFramework_PetDismissMessage.Show() | ||
PetFramework_ParentQuest.DecrementPetCount() | ||
|
||
debug.trace("Pet Count: " + PetFramework_ParentQuest.GetCurrentPetCount()) | ||
|
||
EndFunction | ||
|
||
|
||
|
Oops, something went wrong.