antstubell Posted December 2, 2019 Share Posted December 2, 2019 (edited) Made myself a chemical crafting station/workbench... whatever. Looks nice with beakers, mortar and pestle and works as a crafting bench. I thought would be nice if the bunsen burner lit up when player uses the bench. Editted a flame in Nifskope and place it over the burner. I am using a simple OnActivate toggle script to enable/disable the flame. Issue is as you can guess is that the flame turns on/off when the player starts crafting but when player exits the crafting menu the flame stays to its enable/disable state. So what I need is that when player starts crafting > flame turns on + sfx and other stuff and when player exits the crafting menu > flame turns off.Here's my simple script - nothing special, just to show what I am using. ObjectReference myLinkedRefbool property fade = False AutoEvent OnActivate(ObjectReference triggerRef)myLinkedRef = GetLinkedRef() as ObjectReferenceif (myLinkedRef.IsEnabled())myLinkedRef.Disable(fade)ElsemyLinkedRef.Enable(fade)EndIfEndEvent Edited December 2, 2019 by antstubell Link to comment Share on other sites More sharing options...
ReDragon2013 Posted December 2, 2019 Share Posted December 2, 2019 (edited) Hmm.. you are asking for so many things here.. maybe next script is helpful.. tested not yet. antFlameCraftingScript Scriptname antFlameCraftingScript extends ObjectReference ; https://forums.nexusmods.com/index.php?/topic/8192258-enabledisable-objects-when-using-a-workbench-help/ Bool PROPERTY bFade auto ; [default=False] ; -- EVENT -- ; https://www.creationkit.com/index.php?title=WaitMenuMode_-_Utility ; https://www.creationkit.com/index.php?title=IsFurnitureInUse_-_ObjectReference EVENT OnActivate(ObjectReference akActionRef) IF (akActionRef == Game.GetPlayer() as ObjectReference) ELSE RETURN ; - STOP - crafting table not player activated ENDIF ;===================== objectReference oRef = self.GetLinkedRef() ; the flame IF ( oRef ) ELSE RETURN ; - STOP - missing the linked Ref ENDIF ;--------------------- gotoState("Done") ; ### STATE ### oRef.Enable(bFade) Utility.WaitMenuMode(0.1) ; wait while player is in crafing (menu action) ;;; WHILE Utility.IsInMenuMode() ;;; Utility.Wait(0.5) ; player is still in a menu ;;; ENDWHILE WHILE self.IsFurnitureInUse() Utility.Wait(0.1) ENDWHILE Utility.Wait(0.25) ; just wait a bit more while leaving crafting menu oRef.Disable(bFade) gotoState("") ; ### STATE ### ENDEVENT ;================================ state Done ; do not activate more than once ;========= EVENT OnActivate(ObjectReference akActionRef) ENDEVENT ;======= endState Edited December 2, 2019 by ReDragon2013 Link to comment Share on other sites More sharing options...
antstubell Posted December 2, 2019 Author Share Posted December 2, 2019 I see where you're going with the script. Couple of new things I didn't know about and will experiment with such as IsInMenuMode and IsFurnitureInuse.As for your script as it is - when player starts crafting - flame turns on for a split second then turns off. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 3, 2019 Share Posted December 3, 2019 (edited) If your workbench is just an activator rather than a furniture activator or it is an activator linking to a furniture, then the above script as-is would yield the results that you are seeing. Without knowing the specific setup, cannot speculate on a solution. However, if you remove the comment markers from the IsInMenuMode, it should wait for the crafting session to complete. If you are already using SKSE, you can enable the flame as you have, register for the crafting menu, then use the OnMenuClose event to catch when crafting is complete. Then turn off the flame and unregister for the menu. Edited December 3, 2019 by IsharaMeradin Link to comment Share on other sites More sharing options...
antstubell Posted December 3, 2019 Author Share Posted December 3, 2019 (edited) I did delete the comments that you mentioned and it still is the same.https://onedrive.live.com/?cid=B60C11D037429D8E&id=B60C11D037429D8E%2151748&parId=B60C11D037429D8E%21191&o=OneUp I run the game from SKSE.exe but don't use it in CK. OMG why can't I upload a tiny file to this site!?https://onedrive.live.com/?cid=B60C11D037429D8E&id=B60C11D037429D8E%2151749&parId=B60C11D037429D8E%21191&o=OneUp Edited December 3, 2019 by antstubell Link to comment Share on other sites More sharing options...
maxarturo Posted December 3, 2019 Share Posted December 3, 2019 IsharaMeradin already post a way how to do this. Attach it to the crafting station, this requires SKSE, this is just an example: Event OnInit() RegisterForMenu("NAME OF THE MENU") EndEvent Event OnMenuOpen(String MenuName) If ( MenuName == "NAME OF THE MENU" ) ; Do Stuff EndIf EndEvent Event OnMenuClose(String MenuName) If ( MenuName == "NAME OF THE MENU" ) ; Do Stuff EndIf EndEvent Valid Menu Names https://www.creationkit.com/index.php?title=UI_Script#Valid_Menu_Names Link to comment Share on other sites More sharing options...
antstubell Posted December 4, 2019 Author Share Posted December 4, 2019 Watched 3 tutorials on installing SKSE and still SKSE commands won;t compile in CK. Simple script fails. Event OnActivate(ObjectReference triggerRef)Game.SaveGame("TestSave")Endevent Link to comment Share on other sites More sharing options...
maxarturo Posted December 4, 2019 Share Posted December 4, 2019 Place all the SKSE scripts pex + psc that are located in the SKSE rar file, in your corresponding Skyrim data > scripts directory. Link to comment Share on other sites More sharing options...
antstubell Posted December 4, 2019 Author Share Posted December 4, 2019 I've done that several times. Still won't compile. ObjectReference Property Flame AutoEvent OnInit()RegisterForMenu("Crafting Menu ")EndEventEvent OnMenuOpen(String MenuName)If ( MenuName == "Crafting Menu" )debug.notification("Menu Opened")Flame.enable(); Do StuffEndIfEndEventEvent OnMenuClose(String MenuName)If ( MenuName == " Crafting Menu " )debug.notification("Menu Closed")Flame.disable(); Do StuffEndIfEndEvent (6,14): RegisterForMenu is not a function or does not exist Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 4, 2019 Share Posted December 4, 2019 You are on SSE. If you have not changed the source folder location in the Creation Kit ini file, then your source folder is different from original Skyrim.Default SSE PEX files -- Data > ScriptsDefault SSE PSC files -- Data > Source > Scripts Some mod authors elect to change the INI entry and keep the same layout as original Skyrim. Others adapted to work the way the SSE shipped. This discrepancy can be problematic when wanting to work with scripts from other sources. Always check where the source scripts you want to work with or need to access are located and move them if necessary. An alternative would be to setup a 3rd party text editor (Sublime Text, Notepad++, etc) that is capable of using multiple source file locations and doing as much script compiling as possible in that utility rather than in the Creation Kit. Link to comment Share on other sites More sharing options...
Recommended Posts