Magnusen2 Posted October 3, 2016 Share Posted October 3, 2016 event OnOptionSliderAccept(int a_option, float a_value) ;things here get applied when the slider value is accepted {Called when the user accepts a new slider value} if (a_option == _FemaleRatio) xxxFemaleChanceGlobal.SetValue(a_value) SetSliderOptionValue(a_option, a_value) endIf endEvent event OnOptionSelect(int option) if (option == _Assassins) ;if the assassin option was toggled if xxxGlobal_Assassins.GetValue() == 1 ;if it is already on: xxxGlobal_Assassins.SetValue(0) ;sets the global to 0 SetToggleOptionValue(_Assassins, 0) ;sets the option to 0 WEAssassinSubChar.Revert() ;revert the changes done to the leveled list WEAssassinSubChar.AddForm( zxxxDefaultWEAssassinSubChar, 1) ;add the default vanilla actors endif if xxxGlobal_Assassins.GetValue() == 0 ;if it is off: xxxGlobal_Assassins.SetValue(1) ;sets the global to 1 SetToggleOptionValue(_Assassins, 1);sets the option to 1 ;now comes the part in which the rates set on the slider are checked if xxxFemaleChanceGlobal.GetValue() == 0 ;if it is set to 0 = only males spawn WEAssassinSubChar.Revert() WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) elseif xxxFemaleChanceGlobal.GetValue() == 10 ;if the chance is 10% WEAssassinSubChar.Revert() WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) WEAssassinSubChar.AddForm( zxxxLCharNewNPCs, 1) elseif xxxFemaleChanceGlobal.GetValue() == 20 ;if the chance is 20% WEAssassinSubChar.Revert() WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) WEAssassinSubChar.AddForm( zxxxLCharBanditM, 1) WEAssassinSubChar.AddForm( zxxxLCharNewNPCs, 1) ;this goes on until it reaches 100. Then it goes to the next faction/creature. What i'm doing:A sort of variation mod that the user can configure (through a MCM) the rate of males to females that get spawned from leveled lists.The problem:There's one slider that the user can select the rate.I also added toggleable options in which the user can choose which factions and/or types of creatures get the changes applied (e.g. bandits/forsworn/etc).When i set the slider to a different amount, the script doesn't update the OnOptionSelect event to match the new values.I want to force the OnOptionSelect event to reevaluate all the options contained within it every time i set the value of the slider (some code that i can throw on the OnOptionSliderAccept event) Any help is appreciated. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 3, 2016 Share Posted October 3, 2016 SetValue and GetValue work with floats. Try adding a .0 after each of your numbers and see if that doesn't change behavior. I know it doesn't make sense but I've seen stranger things with Papyrus. Link to comment Share on other sites More sharing options...
Magnusen2 Posted October 4, 2016 Author Share Posted October 4, 2016 I was able to fix the issue by making functions for each type of actor and throwing the code that modified the leveled lists into each one. Then called the functions in the OnOptionSliderAccept event. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts