MarethRavenlocke Posted March 15, 2012 Share Posted March 15, 2012 I have a quest reference alias which adds a script to the PlayerRef. In that script's OnCellAttach event, I disable fast travel. The idea is to disable it again when the player goes through a load screen, after the game re-enables it automatically. I've included Debug.Notification() calls to see what is and isn't actually firing, and it seems I have two problems. First, the quest script itself's OnInit event doesn't seem to fire on game load like it's supposed to - it only fires when thequest is stopped and then restarted via the console. Second, the script attached to the PlayerRef (Form ID 00000014), doesn't seem to fire its OnCellAttach event when theplayer enters a new cell like it's supposed to - in fact, it never fires even after the quest is restarted. I've even tried saving the game with my mod deactivated, then reactivating it to try it from a clean slate. I think the culpritmight be that I used showracemenu to change my character's hairstyle, since I didn't have this problem until then. I amcurrently going about testing with a new save file, and exploring how the Mark&Recall mod I use is implemented, just incase there's a conflict that's causing my issue. Any help on this would be appreciated. Link to comment Share on other sites More sharing options...
SinderionsBones Posted March 15, 2012 Share Posted March 15, 2012 There are existing disable fast travel triggers if that is at all applicable to your situation. You can probably use the same script and edit some properties if that's all you need. There are huge ones encompassing any area where fast travel is disabled during certain quests. Whiterun has one for civil war related stuff, so do most cities probably. What specifically are you trying to do? Is this for a specific cell? or generally whenever you "Change Location" see where I'm going here? Story manager event fires whenever you change location at all. Add a condtion limiting it to your location, or any other relevant prerequisites, and it'll be reliable. Tbh, I don't think the player reference is as reliable for scripting as other actors. There are a lot of game elements messing around with it at the same time you are trying to. I don't think it's intended to be reliably used like that, if those events are coded to fire at all for the player actor... Doesn't onInit() fire when you hit the startup stage? I may be completely wrong on that one though, I usually only use the startup stage fragment as my entry point. Link to comment Share on other sites More sharing options...
MarethRavenlocke Posted March 16, 2012 Author Share Posted March 16, 2012 (edited) The OnInit event fires once when the game starts or is loaded while the quest is active. It also fires when the quest itself is initialized, which happens directly after that. So basically, OnInit fires twice when the game is loaded, and once each time the quest is Reset() or Stop()'d and Start()'d again. As for what I'm trying to do... Skyrim automatically re-enables fast travel whenever you go through a load screen. Most fast travel modscounteract this with a heartbeat script - something that runs every X frames and disables fast travel again.Those are very expensive scripts as far as overhead goes, and as such, they lead to bad framerate stutterand eventual CTDs. I'm trying to make a fast travel mod that only disables fast travel when one of two things happens: either a game is started/loaded, or the player crosses a load screen. The individual cells are irrelevant. This Story Manager event for changing locations is particularly interesting. Might you be willing to elaboratefurther? Edited March 16, 2012 by MarethRavenlocke Link to comment Share on other sites More sharing options...
GomuGomu64 Posted March 16, 2012 Share Posted March 16, 2012 The OnInit event fires once when the game starts or is loaded while the quest is active. It also fires when the quest itself is initialized, which happens directly after that. So basically, OnInit fires twice when the game is loaded, and once each time the quest is Reset() or Stop()'d and Start()'d again. As for what I'm trying to do... Skyrim automatically re-enables fast travel whenever you go through a load screen. Most fast travel modscounteract this with a heartbeat script - something that runs every X frames and disables fast travel again.Those are very expensive scripts as far as overhead goes, and as such, they lead to bad framerate stutterand eventual CTDs. I'm trying to make a fast travel mod that only disables fast travel when one of two things happens: either a game is started/loaded, or the player crosses a load screen. The individual cells are irrelevant. This Story Manager event for changing locations is particularly interesting. Might you be willing to elaboratefurther? Ain't there a function like "OnCellLoad()"? Link to comment Share on other sites More sharing options...
MarethRavenlocke Posted March 16, 2012 Author Share Posted March 16, 2012 (edited) Yes, unfortunately, that one fires when the cell is loaded into memory - it won't work for my purpose becausecells stay in memory for quite a while after the first time you visit them in a session. If you're running back and forth between shops in Whiterun, for example, each shop fires OnLoad() once, maybe twice if you happento go up to Dragonsreach in between to see the wizard. There's OnCellAttach() which fires from an object when it becomes attached to a cell, but that has been as yetunreliable when used on the player reference. I wonder if it might be more reliable to track the cell attachment of an item in the player's inventory...? I wish Bethesda would just take a hint and put the option in the next patch ~_~ There have been countless"no fast travel" mods for every Bethesda game since Oblivion first introduced it in its current form. It was finein Daggerfall, because its implementation made sense from a roleplay standpoint, it cost gold for the trip(stays at the inn, etc), you could choose to stop at night or keep travelling, stick to the roads or cut through the wilderness, etc., and there was a chance for random encounters if you took the cheaper or faster options. I don't foresee Bethesda ever going back to that system, as much as I would like them to, but it can't be very hard for them to just stick a line in SkyrimPrefs.ini to the effect of bFastTravel=x (0 for disabled, 1 for enabled). I'm about ready to abandon this mod idea entirely and just keep using the ScriptDragon mod for my own game,since that one doesn't have the slowdown associated with heartbeat scripts, being run externally. Edited March 16, 2012 by MarethRavenlocke Link to comment Share on other sites More sharing options...
SinderionsBones Posted March 17, 2012 Share Posted March 17, 2012 http://www.creationkit.com/Change_Location_Event Basically, anytime a change location event occurs, the story manager checks to see if it should start any quests in response. It's really a nice centralized OnCellChange() event function with all the if/then stuff neatly packed up into a nested node tree with conditions for you. In the editor Object window, go to Character - > SM Event Node. in the list, double click on Change Location Event. This is the nested node interface for the change location event. You can then, after you get comfortable with it, throw in a branch of your own up top, that starts a tiny custom quest who's only job is to disable fast travel. Read up on it, it's a cool system. The following is what I would do for a first attempt at seeing if this works: The quest: Named whatever, a few boxes down from ID, is Event. In that put Change Location Event. Go to quest stages. Make a Stage 10 or something like that, click the 'Startup Stage' checkbox. Now put in your code to disable fast travel in the script fragment box. This box will execute as soon as the quest starts. I haven't experimented with quests that would be repeated so much, so you probably want to also click 'shutdown stage' so it doesn't hang out in memory. Also, on the quest data tab, where ID is, select "Allow repeat stages" so it can happen all the time. In the Change Location Event node: Create a new quest branch at the top. No need for conditions as it should fire at every location change. Add your quest from above. Select "Shares Event" on the quest node. This makes sure, even if your quest is executed, the rest of the branches below will still get notified of the event. You almost always want to have that checked. See if that does the job. Obviously you may want to put a debug.notificatoin("Still working") in there in a few places to make sure the quest is firing multiple times. That's all you though. Good luck! Link to comment Share on other sites More sharing options...
Recommended Posts