Detecting Fast Travel

Post » Wed Mar 03, 2010 2:13 am

I'm trying to think of a way of detecting when the player fast travels, and how long the journey time is, as part of the weather system for All Natural. Here's the current code:

set travelTime to ((GetCurrentTime + (GameDaysPassed * 24) - currentTime)/TimeScaleif travelTime >= 0.01				set flag to 1				set weatherShouldForce to 1				set fastTraveled to 1			elseif travelTime >= 0.0002				set flag to 3				set weatherShouldForce to 1				set fastTraveled to 1endifset currentTime to GetCurrentTime + (GameDaysPassed * 24)

Basically, it's supposed to force a new weather if you fast travel a distance that results in a large travelTime, and set the old weather on a small travelTime. The check is carried out for every cell change, though currentTime is updated every time the script is run.

However, I'd like it to change the weather if the travel time is greater than the predetermined time for the current weather to last. The time set for the next natural weather change is given by timeForCheck, which is the currentTime at the time of the weather being set plus the weather length.

I have that sort of system set up for the sleep/wait menu:
begin menumode 1012;Sleep/Wait Menuif IsTimePassing == 1	if (GetCurrentTime + (GameDaysPassed * 24)) < timeForCheck		set flag to 3		set weatherShouldForce to 1	elseif (GetCurrentTime + (GameDaysPassed * 24)) >= timeForCheck		set flag to 1		set weatherShouldForce to 1	endifendifend


So I was wondering if there was any way of doing the same thing for Fast Travel, without triggering it for normal cell transitions (as if I put similar checks into the GameMode cell change checks, one of the options would be true for every check, regardless of Fast Travel or not, and would lead to screwy weather.

Any help would be greatly appreciated. :)
User avatar
Facebook me
 
Posts: 3442
Joined: Wed Nov 08, 2006 8:05 am

Post » Wed Mar 03, 2010 1:21 am

begin menuMode
if onKeyDown LMB
if getMapMenuMarkerRef
if aboveRef.canTravelToMapMarker
set sentinel to 1
end(Ifs)

begin menuMode 1001
if sentinel
you might want to disable the lmb and simulate the clicks yerself
if onKeyDown LMB
if getActiveUIComponentName == "button_1" ; - Yes
Get the Delorean
elseIf == "button_2" ; - No
cleanup
end(Ifs)

User avatar
Heather Dawson
 
Posts: 3348
Joined: Sun Oct 15, 2006 4:14 pm

Post » Wed Mar 03, 2010 11:52 am

Right, so I've got to check for when people click yes to the 'do you want to fast travel to this location' messagebox?

The problem with that would be with stuff like Map Marker Overhaul, which does the same thing, but with a modifier key to bring up a different menu, so would I be able to prevent that from giving a false positive?

EDIT: Nevermind that, I think I'll do it as before, but with proper timings instead.
User avatar
John N
 
Posts: 3458
Joined: Sun Aug 26, 2007 5:11 pm

Post » Wed Mar 03, 2010 6:03 am

A very simple way to detect fast travel is to set a variable to game hour when the map menu is opened, then back in gamemode check if that variable == gamehour. If not then the player fast traveled. Using istimepassing doesn't seem to work for fast travel.
User avatar
Claire Lynham
 
Posts: 3432
Joined: Mon Feb 12, 2007 9:42 am

Post » Wed Mar 03, 2010 2:40 pm

Right, so I've got to check for when people click yes to the 'do you want to fast travel to this location' messagebox?

The problem with that would be with stuff like Map Marker Overhaul, which does the same thing, but with a modifier key to bring up a different menu, so would I be able to prevent that from giving a false positive?
Yup. The issue you've brought up can be mitigated ( to some extent ) by loading your mod before MMO, thereby getting your script to run before MMO's.
User avatar
lolli
 
Posts: 3485
Joined: Mon Jan 01, 2007 10:42 am

Post » Wed Mar 03, 2010 10:06 am

Oh, I didn't know that load order affected script running order. :huh:

I think I've got a solution anyway, b3w4r3's suggestion seems to work fine, hopefully I'll get confirmation of that by tommorrow morning, but thanks for the help anyway. :)
User avatar
JD FROM HELL
 
Posts: 3473
Joined: Thu Aug 24, 2006 1:54 am

Post » Wed Mar 03, 2010 6:26 am

Oh, I didn't know that load order affected script running order. :huh:

I think I've got a solution anyway, b3w4r3's suggestion seems to work fine, hopefully I'll get confirmation of that by tommorrow morning, but thanks for the help anyway. :)
Only found out recently. I added more info about it to the script processing article http://cs.elderscrolls.com/constwiki/index.php/Script_Processing.
User avatar
Jerry Cox
 
Posts: 3409
Joined: Wed Oct 10, 2007 1:21 pm

Post » Wed Mar 03, 2010 9:21 am

Yup. The issue you've brought up can be mitigated ( to some extent ) by loading your mod before MMO, thereby getting your script to run before MMO's.
Wait... what? Script processing is dictated / modified by mod load order? Seriously? Geez... the things you learn after 3 years... :P
User avatar
Lady Shocka
 
Posts: 3452
Joined: Mon Aug 21, 2006 10:59 pm

Post » Wed Mar 03, 2010 4:17 pm

Wait... what? Script processing is dictated / modified by mod load order? Seriously? Geez... the things you learn after 3 years... :P
I spent a good 30 minutes on testing the process queue and that was the pattern that I saw. But I do recall a particular instance ( or two ) when it didn't follow the predicted order.
User avatar
Noely Ulloa
 
Posts: 3596
Joined: Tue Jul 04, 2006 1:33 am


Return to IV - Oblivion