Jump to content

Struggling with Implementing Follower Horse Mounting Feature


Recommended Posts

Hello Skyrim Modding Community,

I've been working on a Skyrim mod that involves a follower named Henry, who is supposed to mount his own horse when the player mounts theirs. However, despite numerous attempts, I haven't been able to implement this feature successfully.

I've made several script attempts, with my best one being as follows:

 

 

Scriptname HenryRidingScript extends ObjectReference

Actor Property HenryFollowerRef Auto
Actor Property HenryFollowerHorse Auto
ObjectReference Property SFHHenryRiding Auto ; Change to ObjectReference property

Function OnInit()
    SFHHenryRiding = None ; Initialize the global variable
    RegisterForUpdateGameTime(0.0245)
EndFunction

Function OnUpdateGameTime()
    If (HenryFollowerRef != None)
        If (Game.GetPlayer().IsOnMount())
            SFHHenryRiding = Game.GetPlayer() ; Set the global variable to indicate the player is riding
            ; Teleport the horse to Henry
            HenryFollowerHorse.MoveTo(HenryFollowerRef)
        ElseIf (HenryFollowerRef.IsOnMount() && SFHHenryRiding == HenryFollowerRef)
            SFHHenryRiding = None ; Player has dismounted, so clear the global variable
            ; Don't teleport the horse if Henry is still riding
        ElseIf (!Game.GetPlayer().IsOnMount() && HenryFollowerRef.IsOnMount() && SFHHenryRiding != None)
            ; Player is mounting their horse, so teleport Henry's horse to him
            HenryFollowerHorse.MoveTo(HenryFollowerRef)
        EndIf
    ElseIf (SFHHenryRiding != None)
        SFHHenryRiding = None ; Henry follower reference is not valid, clear the global variable
    EndIf
EndFunction

 

 

While the teleporting of the horse works fine, Henry doesn't mount the horse as intended. I think AI packages are needed, but Henry works with scripts rather than Ai packages.

If anyone has experience with implementing follower horse mounting features or has insights into how to resolve the issues we're facing, particularly with getting Henry to mount his horse, I would greatly appreciate your help and guidance.

 

Thank you in advance for any assistance you can provide!

 

Link to comment
Share on other sites

You can use scripts to lead them to the horse and even use it for a moment, but you cant make them stay on with scripts

Definitely need "Ride horse when possible" set to true in their ai package. If you use the vanilla follower system, you just edit that one component in PlayerFollowerPackage I think it is

Link to comment
Share on other sites

Basically, my thought would be to have a perma-running quest where both player and Henry are aliases.   You likely already have one for the dialogue.   Henry alias  would have a stack of packages, with horse riding one being a higher priority, but having a condition that player is also mounted.    However, you also need some sort of script attached to player that will detect when player mounts/dismounts and will call  TryToEvaluatePackage()  on Henry alias.

; Global
Bool PlayerIsRiding
ReferenceAlias Property HenryAlias Auto
Actor Property PlayerRef Auto

; somewhere at game load 
	RegisterForAnimationEvent(PlayerRef, "MTState")
	PlayerIsRiding = PlayerRef.GetAnimationVariableBool("bIsRiding")

Event OnAnimationEvent(ObjectReference akSource, String asEventName)
	If(akSource == PlayerRef && asEventName == "MTState")
		Bool NewPlayerIsRiding = PlayerRef.GetAnimationVariableBool("bIsRiding")
		If(NewPlayerIsRiding != PlayerIsRiding)
			If(NewPlayerIsRiding)
				; Teleport horse to Henry
			EndIf
			HenryAlias.TryToEvaluatePackage()
			PlayerIsRiding = NewPlayerIsRiding
		EndIf
	EndIf
EndEvent

 

  • Like 1
Link to comment
Share on other sites

why do the scripts in this thread have Full Auto Properties to Self as an Object? What I am missing OR what do I see that everyone else is missing??

HINT: Papyrus is an Object Oriented Language..

use it like one, just sayin.

Link to comment
Share on other sites

i will try to set up an alias with the necessary ai packages, however how do I make sure that the scripts of my follower dont overwrite the ai packages responsible for riding? 

Link to comment
Share on other sites

I'm not much of a scripter myself.  But I know some follower-control/multiple-follower mods* already get followers to ride their own horses with the player.  Maybe digging through them a bit can show how it's done.

* like Extensible Follower Framework, Amazing Follower Tweaks, Nether's Follower Framework, and a few others.

Link to comment
Share on other sites

You only get so much control with AIs.
For a quest alias package, you just set the priority on the quest to 100, or whatever number you think is right. For a "perma-AI" on a follower NPC, the usual range is 50-60, so maybe 75 or 80 will suffice. You do want to leave the highest numbers (90+) for quests that are meant to change the behavior short-term.
Whatever priority you assign, it will still be overridden by: override packages, scene packages, and Papyrus' MiscUtil packages. There are also other SKSE plugins around that can override those.
In any case, it's a good thing to let scenes and other short-term AI packages run, so keep the priority at a median-ish value.
Link to comment
Share on other sites

17 hours ago, ChrisKley said:

i will try to set up an alias with the necessary ai packages, however how do I make sure that the scripts of my follower dont overwrite the ai packages responsible for riding? 

Make your follower scripts work with that package?     I.e. add a check for the follower being mounted?

Link to comment
Share on other sites

In case this is an issue

A mount being usable by you, does not mean usable by your follower. Do make sure your follower has a usable mount, as in ownership applied either at the faction or actorbase level

RefForOurMount.SetActorOwner(YourFollowerActorBase)

Or

RefForOurMount.SetFactionOwner(AFactionYourFollowerIsIn)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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