ExoArchivist Posted February 21, 2020 Share Posted February 21, 2020 I'm working on at least the beginnings of a mod that I think should be pretty straightforward. There is, however, one perhaps... not-so-straightforward feature I'd like to add and I'm a bit out of my depth. In essence, however, I'd like to be able to write a script that uses the time passed fast traveling as a value or variable of sorts. I'm just not sure how fast traveling is calculated or if such a thing is even possible. To provide better context for what I'm trying to do, I'm working on a minor gameplay + immersion stamina overhaul and I'd like to take hours spent fast traveling and use that as a modifier to deplete the player's stamina. For example purposes, let's just say for every hour passed fast traveling, the player takes a 10 point hit to stamina. I've never poked around with this level of inner-workings of the game, however, so I'm not sure if this is even really feasible, but if anyone's got suggestions or anything that might help me I'm all ears. Cheers,Exo Link to comment Share on other sites More sharing options...
dylbill Posted February 22, 2020 Share Posted February 22, 2020 (edited) Hey, I don't think there's an OnFastTravel script event. But to detect fast travel you could use gametime polling and time stamps. Here's an example script that would detect fast travel, and time spent traveling: ScriptName DetectFastTravel Extends Quest Actor Property pPlayerRef Auto Float GameTimeStamp Cell CurrentCell Event OnInit() CurrentCell = pPlayerRef.GetParentCell() GameTimeStamp = Utility.GetCurrentGameTime() RegisterForSingleUpdateGameTime(1) ;updates in 1 hour game time EndEvent Event OnUpdateGameTime() Float TimePassed = (Utility.GetCurrentGameTime() - GameTimeStamp) If (TimePassed > 0.042) && (CurrentCell != pPlayerRef.GetParentCell()) ;if we have fast travelled ;do stuff, based on TimePassed. Endif Utility.Wait(1) CurrentCell = pPlayerRef.GetParentCell() GameTimeStamp = Utility.GetCurrentGameTime() RegisterForSingleUpdateGameTime(1) EndEventA game time difference of 0.042 is about 1 hour, so you can calculate based on that. Edit, you might also want to change If (TimePassed > 0.042) to a larger number, like 0.05, to really detect fast travel. Edited February 22, 2020 by dylbill Link to comment Share on other sites More sharing options...
dylbill Posted February 22, 2020 Share Posted February 22, 2020 I also found the condition IsPlayerMovingIntoNewSpace: https://www.creationkit.com/index.php?title=IsPlayerMovingIntoNewSpace which might help, still using the timestamp method. Link to comment Share on other sites More sharing options...
SurfsideNaturals Posted February 22, 2020 Share Posted February 22, 2020 https://www.creationkit.com/index.php?title=OnPlayerFastTravelEnd_-_Actor Link to comment Share on other sites More sharing options...
dylbill Posted February 23, 2020 Share Posted February 23, 2020 I stand corrected. There is a fast travel event. That's good to know. Link to comment Share on other sites More sharing options...
Evangela Posted February 23, 2020 Share Posted February 23, 2020 (edited) I have the calculations for fast traveling. it's an estimation and it requires that you know the distance between the player and the map marker of the location they are traveling to... Fast Travel works by just shipping you to the location of a map marker, and if there isn't one, then an XmarkerHeader that functions as one, AND if an XmarkerHeading is linked to a map marker, that's where you will end up. For walled cities like Whiterun, I think uses XmarkerHeadings..my notes don't specify this(oops..). I got ALL of the cities XYZ positions for their fast travel markers if you need them. Float Function GetEstimatedFastTravelTime(Float afDistance, Float afFastTravelMulti) ; Calculates the number of hours it will take to fast travel from the current ; position to the destination. ; estimated time(in hours) = total estimated distance / estimated speed value return ((afDistance / 10.0) / afFastTravelMulti) / 60.0 / 24.0 EndFunction afFastTravelMulti = the GameSetting fFastTravelSpeedMultAccording to my notes, it's about 1hr 30min off. I never got around to optimizing it because all the hardcoding positions was wearing me out. That fast travel event might help A LOT though. Edited February 23, 2020 by Rasikko Link to comment Share on other sites More sharing options...
ExoArchivist Posted February 24, 2020 Author Share Posted February 24, 2020 Oh wow, thanks a ton you all, this is all super helpful and interesting and I'm very very grateful. Link to comment Share on other sites More sharing options...
Recommended Posts