antstubell Posted October 5, 2020 Share Posted October 5, 2020 So as some of you who have been following my threads have noticed, I am doing a lot of 'scripted' (story based)... things. With your guys help things are coming along nicely. I'm at a point where for certain quests to continue objects have to be disabled/enabled, actors moved, items oved around, etc. Of course all of this is done through script. However I want these things to happen when player cannot witness the nuts and bolts of the game working - immersion breaking things. Similar to when the civil war begins in the game. Player is nowhere near any city where houses have to be disabled and houses on fire/destruction has to be enabled. So with this in mind, in this particular case I have 2 NPCs who have just loaded a dead body onto a cart and are standing next to the cart. The NPCs have to be moved to their new locations, dead body and cart disabled and a different cart in a different place enabled. I don't want this to happen while player is standing and watching. What would be a good event to run on player (I'm guessing this would be the easiest as player is always moving) or on anything so that all the game mechanics are not seen?Thanks for your advice. Link to comment Share on other sites More sharing options...
dylbill Posted October 5, 2020 Share Posted October 5, 2020 Some conditions you can use are get LOS == false (get line of sight) and/or get Distance > someBumber (like 5000) Link to comment Share on other sites More sharing options...
antstubell Posted October 5, 2020 Author Share Posted October 5, 2020 What would I run these conditions on? A very big trigger box with on TriggerLeave event? I guess I also have to consider that these 'scenarios' will progress whiter player sees them or not but that is really complicating things. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 5, 2020 Share Posted October 5, 2020 You could use OnCellAttach. If it is an outdoor cell, it will take place whenever the cell is next called up due to being within the uGrid range. If it is an interior cell, at the latest it will take place during the loading screen as the player enters (tho some things can take longer). You could use the story manager's OnLocationChange event. This would keep everything in place until the player actually changes location. Say your stuff was in the middle of a town, the player will see the NPCs with the cart until such time as they trigger the OnLocationChange event. You can use the line of sight stuff that dylbill mentioned. You can also use AI packages to send the NPCs walking to their destination. Depending upon the cart type you might even be able to get it moving with them. There have been several mods which have gotten functional carts in the game (LE) as well as moving wagons. Might require a bit of digging around to learn how to do it but would be the most "immersive" as the player could see them or follow them on their trek to the destination. You could also do a combination of any or all of the above as desired. Link to comment Share on other sites More sharing options...
antstubell Posted October 5, 2020 Author Share Posted October 5, 2020 It's an exterior cell, so player needs to be quite some distance away or as you say enter an interior cell. Could you help me to understand OnLocationChange and how I would use this for example I want all the stuff to happen if player has walked way off into the distance and can no longer observe what it happening.I understand OnCellAttach and how this is used but not knowing which interior the player will enter next would mean putting an OnCellAttach on every door of every building to catch the event. I'm not seeing how LOS would work effectively, what if player just turns around? Or if you mean LOS for the NPCs what's to make them look at the player, what if player moves behind a rock right next to them?Does OnCellDetach work for exterior cells? But again the cell border could be right next to where the player is standing, player moves slightly and 'poof' stuff and NPCs gone. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 5, 2020 Share Posted October 5, 2020 OnCellAttach and OnCellDetach work with exterior cells. They run as cells are called into or dropped out of the uGrid surrounding the player. Default uGrid is 5. This means a 5x5 group of cells surrounding the player is loaded at any one time. The cell the player is in along with two cells in any direction. Using OnCellAttach will run stuff in the cell when it gets called up into the uGrid. OnCellDetach will run when the cell gets dropped from the uGrid. You're probably wanting OnCellDetach at the first location, and OnCellAttach at the destination as a fail safe to ensure everything is setup properly. Personally, I never quite grasped the LOS stuff. You'd need to ask others how to make any of that work. Link to comment Share on other sites More sharing options...
antstubell Posted October 6, 2020 Author Share Posted October 6, 2020 (edited) @Ishara. Thanks for that explanation. I didn't know about uGrid and it's good to know. EDIT: Light bulb moment. I guess that's why CK loads 5x5 cells into the render window at start up. EDIT, EDIT: What would I run an OnCellDetach event on? The player? Make the player an alias in a quest and have a stage with a papyrus fragment that calls the ObCellDetach event? Edited October 6, 2020 by antstubell Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 6, 2020 Share Posted October 6, 2020 Not the player. The player never unloads and will never remain in a cell that gets attached or detached. You can use OnCellDetach in a script on each object or alias pointing to it. Or you can use it on an xMarker and have it move each reference where you want it. An alternative is to have a separate reference of each already pre-placed and just disable the first group and enable the second group. Link to comment Share on other sites More sharing options...
antstubell Posted October 7, 2020 Author Share Posted October 7, 2020 Wait, wait, wait. Am I understanding this correctly or am I being dumb. Let's say I place an xmarker near the objects I want disabled. Do I then on the xmarker place an OnCellDetach script > disable object X, object Y, object Z and enable object X... etc? Then Self.Delete() the xmarker to stop it firing again (or a state)? Is this effectivelt saying 'when this cell is dropped from memory do my stuff'? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 7, 2020 Share Posted October 7, 2020 I wouldn't say "dropped from memory". More like "not actively in use". Cells are not dropped from memory completely until after the full reset period (default 30 in-game days). But yeah, it should work that way. It is always worth testing out at the very least. You could even try linking each object to the xMarker with the xMarker as an enable state parent and just disable / enable the xMarker as needed. Link to comment Share on other sites More sharing options...
Recommended Posts