amokrun1 Posted April 19 Share Posted April 19 Greetings. So I am using something that grants a trait on level-up and it works fine except for one minor detail. The trait menu appears after you have selected a perk. Works fine unless you take Intense Training, which prompts the SPECIAL menu upon selection. What happens here is that the SPECIAL menu is superimposed by the trait menu and looks quite unsightly, like a bug tbh. Don't get me wrong, functionality is there, you can select the trait, which will close the trait menu and allow you to make your SPECIAL selection. But I would like to make it so the trait menu only appears after all other menus have been concluded. Maybe a kind of scripted condition, but I have no idea how to go about this. Can anybody offer some relevant scripting wisdom to me in this regard? It would be greatly appreciated. Link to comment Share on other sites More sharing options...
ebizoe Posted April 22 Share Posted April 22 I think this would do. Giving 1 to bShowTraitMenu will activate the trait menu after the levelup menu is closed.: int iMenuID int bShowTraitMenu SetOnMenuOpenEventHandler (begin function {iMenuID} if bShowTraitMenu CallWhen ({} => ShowTraitMenu) ({} => 1 != MenuMode) 16 endif end) 1 1027 Link to comment Share on other sites More sharing options...
amokrun1 Posted April 23 Author Share Posted April 23 Thanks! I will give it a whirl and let you know how it goes. Link to comment Share on other sites More sharing options...
amokrun1 Posted April 27 Author Share Posted April 27 Greetings again. Does this script go in a config folder or in the plugin? I tried inserting into the already-done plugin script because something I forgot to mention, the mod has a customizable option to set how often the trait menu appears. Ideally I want it set to appear every fifteen level-ups. Link to comment Share on other sites More sharing options...
ebizoe Posted April 28 Share Posted April 28 If you need to store the value for the level requirement in a separate file, create data\config\amokrun1s mod.ini and place the following in it: [General] iModLevel=15 ;Give the player a trait at every 15 level. Since the code I posted is an event-handler, it needs to run once at the start of a session. Place it in the GameMode block of a quest script, like this: scn QuestScript float fSetting int iMenuID int iModLevel int iQ begin GameMode if GetGameRestarted ; Read the level requirement value from a config file. TestExpr iModLevel = GetINIFloat "General:iModLevel" "amokrun1s mod.ini" if 0 < iModLevel ; Set an event-handler so it runs everytime the levelup menu is opened. SetOnMenuOpenEventHandler (begin function {iMenuID} ; Test if the player's level meets the requirement. iQ = Floor ((player.Getlevel) / iModLevel) if 0 == (player.Getlevel) - (iQ * iModLevel) ; If the requirement is met, run the trait menu after the levelup menu is closed. CallWhen (begin function {} ; Give the player only 1 trait. fSetting = GetNumericGameSetting "iTraitMenuMaxNumTraits" SetNumericGameSetting "iTraitMenuMaxNumTraits" 1 ShowTraitMenu ; Set "iTraitMenuMaxNumTraits" the original value. SetNumericGameSetting "iTraitMenuMaxNumTraits" fSetting end) ({} => 1 != MenuMode) 16 endif end) 1 1027 endif endif end Or for a Script Runner script, create a script file with "gr_" prefix, something like this: "data\nvse\plugins\scripts\gr_amokrun1s_mod.txt" So that it runs once at the start of a session. In gr_amokrun1s_mod.txt: float fSetting int iMenuID int iModLevel int iQ ; Read the level requirement value from a config file. TestExpr iModLevel = GetINIFloat "General:iModLevel" "amokrun1s mod.ini" if 0 < iModLevel ; Set an event-handler so it runs everytime the levelup menu is opened. SetOnMenuOpenEventHandler (begin function {iMenuID} ; Test if the player's level meets the requirement. iQ = Floor ((player.Getlevel) / iModLevel) if 0 == (player.Getlevel) - (iQ * iModLevel) ; If the requirement is met, run the trait menu after the levelup menu is closed. CallWhen (begin function {} ; Give the player only 1 trait. fSetting = GetNumericGameSetting "iTraitMenuMaxNumTraits" SetNumericGameSetting "iTraitMenuMaxNumTraits" 1 ShowTraitMenu ; Set "iTraitMenuMaxNumTraits" the original value. SetNumericGameSetting "iTraitMenuMaxNumTraits" fSetting end) ({} => 1 != MenuMode) 16 endif end) 1 1027 endif Link to comment Share on other sites More sharing options...
amokrun1 Posted April 29 Author Share Posted April 29 Thanks so much! I'll try the less invasive approach of the scriptrunner first. Just a question, what does end) 1 1027 mean? Link to comment Share on other sites More sharing options...
ebizoe Posted April 30 Share Posted April 30 "end)" is how Lambda statement is closed in this case. The following two numbers are arguments for SetOnMenuOpenEventHandler. 1027 is the menu code for the levelup menu. Link to comment Share on other sites More sharing options...
amokrun1 Posted April 30 Author Share Posted April 30 Ah I see, thanks for the explanation. So it worked! I didn't use your script exclusively, what I did was go into the mod's scripts, found the right one, then injected some of yours into it. Worked like a charm! Thanks so much for this, it makes the mod fit with vanilla so much better. Link to comment Share on other sites More sharing options...
Recommended Posts