Jazwind Posted November 23, 2020 Share Posted November 23, 2020 so I'm currently working on a project that will re-add the old Oblivion attribute system to the game in a way that works cohesively and blends in well. After lots of trial and error, I've managed to get the menu loaded in game properly, which you can find a video of here: https://streamable.com/hul4sy As of now, I'm trying to find a way to replace the text shown in each of the various buttons/sprites to include custom strings and the particular actor values I have set up for each attrubute. For instance, I want the buttons showing "Strength - $STR" to show the particular float actor value I have set up for the strength attribute in the place of $STR. Unfortunately, I really don't know how to do this properly. I'm not sure how to get the script to trigger whenever the player opens the levelup menu upon leveling up, and I don't know how I should set up the particular _root path target and other things to add in the right AVs to the buttons. Out of all the functions used by SKSE found [post=https://www.creationkit.com/index.php?title=UI_Script]here[/post] should I use and how to get this all working properly? how can I get this script to trigger properly when the levelup menu is opened each time and get it to target the right componants of my moviefile. and is there anything else I'll need to do that you can walk me through? Link to comment Share on other sites More sharing options...
dylbill Posted November 23, 2020 Share Posted November 23, 2020 For having the script fire when you open the menu, you need to use RegisterforMenu: https://www.creationkit.com/index.php?title=RegisterForMenu_-_Form And then OnMenuOpen: https://www.creationkit.com/index.php?title=OnMenuOpen_-_Form I'm not too familiar with using the actual UI script, but there's an explanation on how to here: http://www.gamesas.com/invokebool-invokestring-etc-how-use-them-t345972.html Link to comment Share on other sites More sharing options...
Jazwind Posted November 24, 2020 Author Share Posted November 24, 2020 For having the script fire when you open the menu, you need to use RegisterforMenu: https://www.creationkit.com/index.php?title=RegisterForMenu_-_Form And then OnMenuOpen: https://www.creationkit.com/index.php?title=OnMenuOpen_-_Form I'm not too familiar with using the actual UI script, but there's an explanation on how to here: http://www.gamesas.com/invokebool-invokestring-etc-how-use-them-t345972.htmlyeah I've already figured that out. the problem I'm having now is that while I'm able to replace the text string for the button initially, as soon as the player hovers over it it goes [post=https://streamable.com/vieocx]right back[/post] as if SetString was never used. I believe it's due to how I'm targeting the movieclip inside the Script in the SetString SKSE function so could you look through it right here and tell me what I'll need to fix to get it working? Scriptname tyLESALevelUpScript extends Quest actor property Playerref auto float fVersion = 1.0 float str function LVLStartup() RegisterForMenu("LevelUp Menu") Debug.Messagebox("Now Running LESA Version" + fVersion) EndFunction event OnMenuOpen(String MenuName) str = playerref.getav("ShieldPerks") debug.Messagebox("Testing!") UI.SetString("LevelUp Menu", "_root.LevelUpMenu_mc.StrengthButton.textField.text", "Strength - " + (str As Int)) endevent Link to comment Share on other sites More sharing options...
dylbill Posted November 24, 2020 Share Posted November 24, 2020 (edited) Hmmm, not sure, like I said I've never really done any ui scripting. It looks like though when you hover over the button, it resets the string to what it's originally set to in the movie clip. The only way I know to get around that is to use a while loop while in the level up menu. Something like this: actor property Playerref auto float fVersion = 1.0 float str Bool MenuOpen = false function LVLStartup() RegisterForMenu("LevelUp Menu") Debug.Messagebox("Now Running LESA Version" + fVersion) EndFunction event OnMenuOpen(String MenuName) MenuOpen = true debug.Messagebox("Testing!") SetStrengthButtonString() EndEvent Event OnMenuClose(String menuName) MenuOpen = False EndEvent Function SetStrengthButtonString() While MenuOpen == True str = playerref.getav("ShieldPerks") UI.SetString("LevelUp Menu", "_root.LevelUpMenu_mc.StrengthButton.textField.text", "Strength - " + (str As Int)) EndWhile EndFunctionEdit: There's probably a better way to do it, but as I said I'm not really familiar with UI scripting. Edited November 24, 2020 by dylbill Link to comment Share on other sites More sharing options...
Jazwind Posted November 24, 2020 Author Share Posted November 24, 2020 (edited) Hmmm, not sure, like I said I've never really done any ui scripting. It looks like though when you hover over the button, it resets the string to what it's originally set to in the movie clip. The only way I know to get around that is to use a while loop while in the level up menu. Something like this: actor property Playerref auto float fVersion = 1.0 float str Bool MenuOpen = false function LVLStartup() RegisterForMenu("LevelUp Menu") Debug.Messagebox("Now Running LESA Version" + fVersion) EndFunction event OnMenuOpen(String MenuName) MenuOpen = true debug.Messagebox("Testing!") SetStrengthButtonString() EndEvent Event OnMenuClose(String menuName) MenuOpen = False EndEvent Function SetStrengthButtonString() While MenuOpen == True str = playerref.getav("ShieldPerks") UI.SetString("LevelUp Menu", "_root.LevelUpMenu_mc.StrengthButton.textField.text", "Strength - " + (str As Int)) EndWhile EndFunctionEdit: There's probably a better way to do it, but as I said I'm not really familiar with UI scripting. that does seem to work much better now, but I'm getting lots of flickering when I highlight over the button going back an forth from it's edited and pre-edited states. Any idea how I can alleviate that more perhaps and get it to always use it's edited form regardless of what frame it's on? EDIT: Nevermind, I managed to get it working by changing the target for SetString a bit. it should be working fine now but I'll be sure to poke around here again once the time comes. Edited November 24, 2020 by Jazwind Link to comment Share on other sites More sharing options...
Recommended Posts