pra Posted December 10, 2018 Share Posted December 10, 2018 What I want to do is extend Immersive Teleportation in such a way, that if you stand on a teleporter, you can select the target via pip-boy. My first idea was Journey. It works by just enabling fast travel for certain map markers by putting them into the "fast travel allowed" formlist, everything else is vanilla. I guess I could try using that, but I'd really rather not* The second idea was the Vertibird. Yesterday, I went through various scripts, quests, and whatever else sounded even remotely related to vertibirds and vertibird fast travel, trying to figure out why selecting the map marker there makes the vertibird travel, instead of teleporting the player. The quest seems to have a gap between "player mounts the vertibird" and "the vertibird is in-flight". Couldn't figure out what takes care of the piece in-between... Ideally, I would like something like subscribing to the onPlayerTeleported event, but then cancel it, and do my own stuff instead. Can this be done, or is this impossible, because hardcoded? ___* In this case, I would put all markers of workshops with reachable teleporters onto the list, then for each workshop, move it's fast travel marker to the teleporter. This I would have to do each time when I suspect the player could decide to teleport. Then, after the player teleported, or decided not to, I'd have to move the travel markers back to where they were.And, I don't even know if I could reduce the time the fasttravel took to 0... Link to comment Share on other sites More sharing options...
SKKmods Posted December 10, 2018 Share Posted December 10, 2018 (edited) I have various mods that intercept fast travel to roll it back, its nasty because the action can not be stopped. If your logic is automatic, you can hide the guts behind the same load screen. The player translates to the new location, then you do stuff to them and potentially bounce them back to the start location. A couple of the ideas, like charging caps to fast travel, was just to klunky on rollback (if not enough cash or didn't want to pay) as the question UI doesn't show until the load screen clears with the new location loaded, then a second load screen and wait as the old location loads. Edited December 10, 2018 by SKK50 Link to comment Share on other sites More sharing options...
Wolfmark Posted December 10, 2018 Share Posted December 10, 2018 (edited) The VTF quest is advanced to stage 30 (Player Boarded) to stage 40 (In Flight) from VTFScene when player.GetFlyingState() >= 1. But this doesn't help you. Probably one solution to intercept the fast travel event is to modify the Pipboy_MapPage.swf file. It may be possible to modify it at runtime using a F4SE extension (to avoid compatibility problems with other mods that change the same file), but is not something that can be done quickly. What I would try using JPEXS (or another dissassembler): 0. Load the Pipboy_MapPage.swf file and go to Pipboy_MapPage class.1. Replace the default handler for MapHolder.ACTIVATE_MARKER event (PipBoy_MapPage.onMarkerActivated) with a new one. You can rename the original handler and create a new one with the old name or you can create a new handler and update the addEventListener lines from Pipboy_MapPage.onPipboyChangeEvent() function.2. From the new handler use SendExternalEvent to send an event to Papyrus script. This is a function added by F4SE to all menus. You can send data, but can't wait for a response. I don't know if you have enough data to identify the selected marker (there are few properties, like x, y, arrayIndex and undiscovered).3. From Papyrus script use UI.Invoke to call the original handler if you want the default behavior. UI.Invoke can call functions from PipboyMenu, so I don't know if you can easily reach the map page (using the pageA array), maybe you'll have to modify PipboyMenu class too... Edited December 10, 2018 by Wolfmark Link to comment Share on other sites More sharing options...
pra Posted December 10, 2018 Author Share Posted December 10, 2018 You seem to be quite knowledgeable with all that SWF dark magic (at least compared to me) Tried to looking at the Pipboy_MapPage in jpexs, still trying to figure out where the distrinction between regular FT and vertibirt FT happens. Tracked it to Pipboy_MapPage.onFTConfirmPress: BGSExternalInterface.call(this.codeObj,"FastTravel",this.currMapObj.selectedMarkerInfo.arrayIndex); So... what is codeObj? it seems to be of type BGSCodeObj, which seems to be this here, and hardcoded?https://gist.github.com/reg2k/b525212d7992fcab0b2220194d7e58c8Seems like this is a dead end once again... I might try to do what you described. However, actually modifying an swf seems terrifying to me. If I actually do this, I'd probably try making it into a library of sorts Link to comment Share on other sites More sharing options...
Wolfmark Posted December 11, 2018 Share Posted December 11, 2018 codeObj is a proxy object between Action Script and native code. When you invoke a method on this Action Script object you actually call a native function provided by game's executable. So is "hardcoded", you can't add new methods or change the existing ones, except if you patch the executable. There's another such object created by F4SE that is accessible from all menus (which means PipboyMenu, not Pipboy_MapPage) using "root.f4se". This provides few methods: GetMembers, AllowTextInput, SendExternalEvent, CallFunctionNoWait, CallGlobalFunctionNoWait, GetDirectoryListing, MountImage and UnmountImage (see Hooks_Scaleform.cpp from F4SE source code). The ones useful for you are SendExternalEvent, CallFunctionNoWait and CallGlobalFunctionNoWait, that can be used to invoke Papyrus code from Action Script (but I only used the first one, for which some help can be found at the end of UI.psc script file). You can create such proxy objects from F4SE extensions. Link to comment Share on other sites More sharing options...
Wolfmark Posted December 11, 2018 Share Posted December 11, 2018 I was curious if the idea works:https://drive.google.com/file/d/1hsmheWsxu6lsnrpQZfu3skm8GkopjxMv/view Changed only Pipboy_MapPage to add wmkOnMarkerActivated and wmkCallOriginalOnMarkerActivated functions. Also updated onPipboyChangeEvent to replace the original handler with the new one.The new handler is called => it sends an event that is received by Papyrus script => the Papyrus script can optionally call the original handler. I have the impression that is not too reliable and sometimes the events are lost. Maybe CallFunctionNoWait can be used instead SendExternalEvent.Also the code should call the original handler as quick as possible, otherwise the player may move the mouse... Link to comment Share on other sites More sharing options...
pra Posted December 21, 2018 Author Share Posted December 21, 2018 Looked at it. TBH, I'm not so sure I still want to do this anymore You wouldn't happen to know how to actually pass the actual marker ObjectReference to the quest from the swf? There seems to be an array, and that array's index seems to be important for doing stuff to the marker, but, I have no idea what's even in that marker data struct (or class?), since there doesn't seem to be any declaration of that thing. And even if I knew, I have no idea how to even pass such things from SWF to PEX... Link to comment Share on other sites More sharing options...
Wolfmark Posted December 22, 2018 Share Posted December 22, 2018 (edited) There's an array, but is in the native code and you don't know what it contains. So is not possible to use the index to identify the marker. You should be able to identify it using the X & Y coordinates. Or the name (but I don't know what happens if the language is not English). After all you're interested only in settlements, so you'll have to iterate a list with only 30+ items... The problem is that you also have to display a list with teleporters after a settlement is selected (if multiple teleporters per settlement are allowed). If you really want to get rid of the terminal (why?) then maybe a better solution is to create your own list menu. After all even the game doesn't use the PipBoy when the player has to select a settlement. Edited December 22, 2018 by Wolfmark Link to comment Share on other sites More sharing options...
pra Posted December 22, 2018 Author Share Posted December 22, 2018 I don't want to get rid of the terminals, I just considered adding this as a bonus feature. However, by now, I'm pretty much dissuaded from it. IMO, it's just not worth the effort. And yes, I do allow multiple teleporters per settlement, so yes, that would have been an extra issue allright... Link to comment Share on other sites More sharing options...
Recommended Posts