Announcement

Collapse
No announcement yet.

Mutator UI not saving choice or having effect on variables in mutator blueprint

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mutator UI not saving choice or having effect on variables in mutator blueprint

    Hey guys, I've been trying to create a Mutator settings UI with the ultimate goal of being able to package all weapon mutators I make together as one mutator and allow people the option to pick and choose which custom weapons they want on. Currently I've been trying to do this by taking a look at and replicating how this works with the in-game mutators provided in the editor. However the issue I am having is that the selection on the config settings seems to make no difference to that variable used in the mutator itself, and the choice is not saved either (possibly linked?).

    The mutator works fine by itself without a config UI (currently it's just a single weapon replacement mutator and I'm using a single boolean tied to a Branch node to test a single checkbox).

    Here are some screenshots of what I have so far:



    Here the grande launcher checkbox does nothing, the Rocket Launcher one is the one that I'm trying to get working to allow the user to change a boolean called 'Allow Rocket Launcher'.



    Here I've tried to use the Arena Mutator Menu as a guide to how I need to set up the graph. Prior to adding the 'Set Is Checked' node in the top right of the graph, the checkbox was always ticked or unticked based on the default value set in the designer, but now it does at least use the default value of the boolean in the mutator itself. It does not however save the users choice (ticked or unticked) after clicking OK, both in terms of whether it has any effect on the mutator (specifically the boolean variable within the mutator), or whether it saves the choice the next time the settings menu is opened.



    Heres the mutator itself, all the bit off to the right of the graph is just a standard weapon replacement mutator that works fine, and manually changing the default value of the boolean in the blueprint changes the outcome as expected, but the config ui is having no effect.

    I don't really know if there's a way for me to use Simulation to see if the issue is that the variable isn't getting changed in the first place, or whether it is but then the choice is not being saved after pressing OK, because playing in editor just launches the game on the level currently selected and trying to get to the menu by typing disconnect in the console leads me to a black screen.

    Any ideas as to something I may have missed or what I need to do to get it working properly?
    http://www.twitch.tv/zoh23

  • #2
    You need to use the Mod Config blueprint nodes to get and save variables when working solely in blueprints.

    The Weapon Arena example you are using has been created within C++, when the SaveConfig node is called it saves the C++ variables to a config file (this can be seen here).



    Example




    This will save in a file called Mod.ini under /UnrealTournament/Saved/Config and will look like

    Code:
    [Mutator_SaveTest]
    Kills=2
    http://imgur.com/a/tI9vI

    Comment


    • #3
      Ah I think I understand. So what I want to do is replace the 'Save Config' part of the Widget Blueprint with a Set Config node so that it actually saves the choices made, and then within the Mutator blueprint itself, use a Get Config node to load the choices made and set the values of the relevant variables?

      Also would this mean that theres no point in directly setting the value of a variable in the UI blueprint, because really whats happening is you're setting the value in the config, and then when the game starts loading it from the config?



      i.e. here, is the Set Allow Rocket Launcher node pointless because whats really happening is the value in the config is being set and then will be loaded by the mutator itself later, all the while the setting of the boolean will have no effect?

      Thanks a lot for your help, will dive into this now and see what I can do

      EDIT: Also realized not to use the Display name for the Config section in this way, http://i.imgur.com/Sw6Tblh.png
      Last edited by Zoh; 06-08-2017, 03:58 PM.
      http://www.twitch.tv/zoh23

      Comment


      • #4
        So it seems that what I had originally done with the SaveConfig node actually does work, what I needed to do was set the Variable to 'Config Variable' and then the values would be saved to another file, game.ini
        Huge thanks to Phroxen for that!



        EDIT: Though the game is now remembering the choices in the menu tickboxes, when launching the game the default values for the variables are used regardless (so if both boxes are unticked the game still launches in the mutators because the default values are both 1)
        Last edited by Zoh; 06-08-2017, 05:04 PM.
        http://www.twitch.tv/zoh23

        Comment


        • #5
          I'm glad you found the config variable checkbox, was about to mention that.. The way to get around the defaults thing is don't ever set a default value on a config variable because of this issue, instead use a different variable to store the default value, and in the blueprint set the config variable to the default during runtime if it wasn't set yet, otherwise compiling the blueprint locks the initial value to the default every time regardless of config..and yeah mod config functions can work as an alternative but config variable is appropriate for mutator settings usually

          Comment


          • #6
            Thanks for the reply Scoob, I'm not sure I quite understand what I need to do to get around this issue. The config variables I'm working with are Booleans, and as soon as I run or compile the blueprint a default value is set for them (False). Is there some way to make them not have a value set or do I need to use another type of variable?
            And then once I have my config variables defaulting to a null value I can then have on Event Begin Play, If Variable = Null (IsValid node?), set variable to desired default value?
            Last edited by Zoh; 06-09-2017, 08:04 AM.
            http://www.twitch.tv/zoh23

            Comment


            • #7
              Thanks to Scoob's help I've managed to get this working now, just thought I'd post in case somebody comes here and doesn't know what to do.

              The problem is that we need to use config variables so that going between the ui and launching the game our choices for our variables are saved and then loaded, however what happens is that if you manually set a default value in the editor for any of the config variables you want to use, those config variables will constantly be reset to default as Scoob says in his post. This means you have to not touch the default value for any of your config variables at all in the editor details panel. So long as you don't touch the defaults yourself the config variables will save and load properly.

              If you want to set default variables that are not what the editor defaults to when you click compile what you need to do is in the construction script use some method of determining whether defaults have been set or not, and if not then setting them using some other non-config variables which have been manually set to the desired default value.



              Here I use a config variable called 'HasRun' which defaults to False (again, not manually set because this is a config variable and we want it to work, thats just what it is set to when you click compile in the editor) and if it is False then I set it to True and then set each of my config variables ('Rocket Launcher Z' and 'Grenade Launcher Z') to the desired 'default' values (in this case True) using non-config manually set variables 'DefRLZ' and 'DefGLZ'.

              Also if you have been having issues with this previously you either need to make a new set of variables with different names, or if you are set on using the same variable names, close the editor, open the editor's game.ini file where config variables are saved, delete the relevant lines (they'll be of the form VariableName Value) then reopen the editor and make your new set of variables.
              http://www.twitch.tv/zoh23

              Comment

              Working...
              X