SevenBlue Posted February 11, 2019 Share Posted February 11, 2019 Question. I'm attempting to start a state when the player enters a custom crafting menu by clicking a misc item I scripted. I am fairly certain I know how to start the state, but how would I end it upon the player leaving the menu? I'm not even sure if that is possible without using OnSit and OnGetUp. Any assistance anyone could provide would be most appreciated. Link to comment Share on other sites More sharing options...
Reneer Posted February 11, 2019 Share Posted February 11, 2019 Why not simply use the OnGetUp event on a player alias? I'm pretty sure that would fire when you exit from your crafting menu. You could also try fooling around with RegisterForAnimationEvent and look for the resulting OnAnimationEvent. Link to comment Share on other sites More sharing options...
SevenBlue Posted February 11, 2019 Author Share Posted February 11, 2019 Does OnGetUp fire when you close a crafting menu even if the player isn't physically in the same cell as the crafting furniture? Link to comment Share on other sites More sharing options...
Reneer Posted February 11, 2019 Share Posted February 11, 2019 Does OnGetUp fire when you close a crafting menu even if the player isn't physically in the same cell as the crafting furniture?I'm not sure, you'll have to test that out. Link to comment Share on other sites More sharing options...
SevenBlue Posted February 11, 2019 Author Share Posted February 11, 2019 I'm not sure, you'll have to test that out. Doesn't look like it, ah well that's fine I can work around this using other methods. Just figured I'd try to make my crafting portable but it looks like tying it to furniture will have to do. Thank you anyway! Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 12, 2019 Share Posted February 12, 2019 If you are using SKSE, you can use OnMenuClose to catch when the crafting menu is, well, closed. You'd need to use something like a Bool or GlobalVariable to indicate that your custom crafting menu was triggered so that the OnMenuClose block can stop running when other crafting menus are closed. Link to comment Share on other sites More sharing options...
cdcooley Posted February 12, 2019 Share Posted February 12, 2019 Here's a section of code I use in one of my personal mods to detect the crafting menu. I originally wrote it for Skyrim using the SKSE events but had to rewrite it without SKSE when Skyrim Special Edition first came out, then merged the two methods this way after SKSE64 was stable. It's not as light a script as I would normally write because it uses a while loop, but the loop is only active while you're in the crafting menu so it's light enough. The non-SKSE trick I used was to simply wait for the player to turn. The player can't turn while in the crafting menu, but certainly will fairly quickly after it closes. PlayerAlias.GoToState("CraftingRequest") CraftingStation.Activate(PlayerRef, false) Utility.Wait(0.1) ; give game time to get into the menu (use more if animations are involved) if Game.GetModCount() > 0 ; SKSE support available while UI.IsMenuOpen("Crafting Menu") ; directly check for menu close Utility.Wait(0.1) endwhile else ; no SKSE, so register the menu closed the first time the player turns even a little float angle = PlayerRef.GetAngleZ() while angle == PlayerRef.GetAngleZ() Utility.Wait(0.1) endwhile endif PlayerAlias.GoToState("") Link to comment Share on other sites More sharing options...
Recommended Posts