Jump to content

[LE] Filling Quest Alias With Horse Player Is Riding?


Cheyron

Recommended Posts

So I am trying to fill a quest alias with the horse that the player is riding. I have a script added to my player's reference alias to look for when i am mounted and at that point to stop and start a quest that fills my reference alias for my horse. So I am telling it to match conditions in the loaded area and i am checking closest. The condition is to check if HasKeyword == ActorTypeHorse and it seems to work if I do it when I am not on a horse but on foot, then it finds the horse near me but if i choose to stop and start the quest once i am mounted... the reference does not get filled... anyone have any ideas?? I am able to find the horse via script by getting the player's parent cell and checking for object's that are npcs (type 43) and then i check the keyword and i can easily find the horse i am riding... i may just stick with looping the references in the parent cell but any idea how to setup a quest to fill a reference alias with the horse the player is riding??



Fails:



Actor Function FindHorse()
FindMountQuest.Stop()
While FindMountQuest.IsRunning()
Utility.Wait(0.1)
EndWhile
FindMountQuest.Start()
Utility.Wait(0.1)
Return MountRef.GetActorReference() ;//ALWAYS EMPTY AND I CALL THIS CODE WHILE THE PLAYER IS MOUNTED ON A HORSE
;//IN CREATION KIT QUEST ALIAS CONDITIONS I AM SIMPLY CHECKING FOR HasKeyword == ActorTypeHorse… I AM MATCHING CLOSEST IN LOADED AREA
EndFunction

Works:



Actor Function FindHorsey()
Cell c = PlayerRef.GetParentCell()
ObjectReference closestHorse = None
Float closestDistance = 9999.0
Int i = c.GetNumRefs(43)
While i
i -= 1
ObjectReference h = c.GetNthRef(i, 43)
If h && h.HasKeyword(ActorTypeHorse)
float dist = PlayerRef.GetDistance(h)
If dist < closestDistance
closestHorse = h
closestDistance = dist
EndIf
EndIf
EndWhile
If closestHorse
Debug.Notification("Horse Found, Distance = " + closestDistance)
Return closestHorse as Actor
EndIf
Return None
EndFunction

Link to comment
Share on other sites

"get last ridden horse" or something like that, I cant be bother going to wikki but that what you need, it will return the horse that player is currently riding.

 

Edit

 

I had nothing to do

 

https://www.creationkit.com/index.php?title=GetPlayersLastRiddenHorse_-_Game

 

 

Edit 2

 

I like your Method/Function :) but the above should simplify things for you. I am encouraging you keep coding, try using this page on the wikki to search for codes that set or returns things

 

https://www.creationkit.com/index.php?title=Category:Papyrus

Link to comment
Share on other sites

"get last ridden horse" or something like that, I cant be bother going to wikki but that what you need, it will return the horse that player is currently riding.

Edit

I had nothing to do

https://www.creationkit.com/index.php?title=GetPlayersLastRiddenHorse_-_Game

Edit 2

I like your Method/Function :smile: but the above should simplify things for you. I am encouraging you keep coding, try using this page on the wikki to search for codes that set or returns things

https://www.creationkit.com/index.php?title=Category:Papyrus

 

oh ok, yeah that makes sense... I saw that when i was looking for functions to use but it didn't click in my head to use that... i was looking for something like... GetCreaturePlayerIsRiding... etc... i was just thinking of the wrong stuff when i was looking for functions to use. And you better believe I will keep coding! :laugh: And I am on that wiki site all the time looking stuff up, just that function eldued my radar scanners! Must be this old soviet junk im working with. No matter I have heros like you to come to my rescue. thank you kind sir! I will give that a test sometime but for now because i am already using the horsey function and it works pretty well, I will just stick with looping references in the current cell. Thanks again!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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