Announcement

Collapse
No announcement yet.

HOWTO: Get Variable Data From an Initiation File

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

  • HOWTO: Get Variable Data From an Initiation File

    Hey guys, I wrote a small tutorial to help some people that might have had the some question as me about getting data from an external file.

    1. Go to the blueprint in which you want the variable to be located (In this example it would be the Ankylo character blueprint)

    2. Declare a variable that you want to get the information for from the initiation file. You can only get booleans, floats and integers from an initiation file. (In this example I have a float variable named
    “AnkyloGrowTime”)

    3. In this part we will set up the graph. First right-click and add a “SwitchHasAuthority” node (I have an “EventBeginPlay” event plugged into the node.)

    4. Then you want to “right-click” and add a “GetGameMode” node.

    5. From there pull off the game mode reference and cast it to “ShooterGameMode”.

    6. Then plug the execution pin from the “Authority” section of the “SwitchHasAuthority” to the “CastToShooterGameMode” node. (The “Authority” option tells the game to get/send data from the server side and the “Remote” option would get/send data from the client side.

    7. Next you would right-click and add a “GetOptionIni” node. (Either a “GetBoolOptionIni”, “GetFloatOptionIni” or “GetIntOptionIni”. In this example I will use a “GetFloatOptionIni” node).

    8. In the “GetOptionIni” node you will now fill out the “Section” area with the name of the section you want your variable to be under in the ini file. Then you will fill out the “OptionName” area in the same node to assign a name that will appear to represent your variable in the ini file (For this example I have the “Section” set to “BabyDinosGrowTime” and the “OptionName” to AnkyloGrowTime.

    9. After the “GetOptionIni” node you will now have to set your variable with the information from the ini file. To do this you can drag your variable into the graph and select set. Then plug in the execution pin and the return value pin into the set node.

    10. Now you will have to go to the “GameUserSettings.ini” file which is located at this directory: Epic Games\ARKDevKit\Projects\ShooterGame\Saved\Config\Windows

    11. From there open the “GameUserSetting.ini” file and scroll to the bottom. Now you will type in the information you put in the node in the graph. So first type [Section] (replace Section with the name you set). Then hit enter and type OptionName=0 (replace OptionName with the name you set in the node and replace the 0 with whatever value you want. Once done save the file.

    12. Now if you have your editor still open close the editor and reopen it to reinitialize the initiation file. PLEASE NOTE WHEN YOU CHANGE VALUES IN THE INI FILE YOU HAVE TO RESTART THE EDITOR FOR THEM TO TAKE EFFECT. This is because the initiation file is only read on start up.


    Click image for larger version

Name:	INITut-X3.jpg
Views:	1
Size:	50.5 KB
ID:	1160561

    Click image for larger version

Name:	GaneUserSettingTUT-X3.jpg
Views:	1
Size:	115.5 KB
ID:	1160562

    Hope this helps you guys get started! Also thank you to Mezzow for showing me this!
    Richard Rude
    Environment Artist
    Portfolio: www.richardrude.com
    Artstation: www.artstation.com/artist/richardrude

  • #2
    Thanks Creative.. this is awesome

    Comment


    • #3
      Thanks a lot, i'll add that to the current documentation.

      Comment


      • #4
        No problem! Anyway I can help!
        Richard Rude
        Environment Artist
        Portfolio: www.richardrude.com
        Artstation: www.artstation.com/artist/richardrude

        Comment


        • #5
          Also I found out that if there is nothing in the ini file it will set the variable to 0. So I set up a branch to check to see if there was a value in the ini file if not it used the default value I set in the variable.
          Richard Rude
          Environment Artist
          Portfolio: www.richardrude.com
          Artstation: www.artstation.com/artist/richardrude

          Comment


          • #6
            can we get a section for all the "how to's and tutorials?"
            Creater of Btac Remap http://steamcommunity.com/sharedfile.../?id=491313948

            For questions or help see me on teamspeak @ 223.252.38.169

            Gankey ind. doing stuff right the first time <3

            Comment


            • #7
              You can find a list of how to & tutorials here (bottom of the first post) :

              https://forums.unrealengine.com/show...-amp-Tutorials

              Comment


              • #8
                Quick question: after I have the variable set how do I assign it to a blueprints value?
                I.E. assign the ankylo grow time to the actual value that is the ankylo's grow timer?

                Comment


                • #9
                  I don't find the option switchasauthority
                  Click image for larger version

Name:	switch.png
Views:	1
Size:	34.4 KB
ID:	1087152

                  That's all the options I have that start with swit

                  Comment


                  • #10
                    Check "Context Sensitive" and it will appear.
                    Richard Rude
                    Environment Artist
                    Portfolio: www.richardrude.com
                    Artstation: www.artstation.com/artist/richardrude

                    Comment


                    • #11
                      Still don't see it unless it's switch on something
                      Click image for larger version

Name:	swtich.png
Views:	1
Size:	69.3 KB
ID:	1087155

                      Also after I get that working how do you assign the value from the variable to the option in the blueprint?
                      Click image for larger version

Name:	assign.png
Views:	1
Size:	59.2 KB
ID:	1087156
                      Last edited by Davetiger; 09-06-2015, 01:15 PM.

                      Comment


                      • #12
                        Originally posted by CreativeHD View Post
                        Also I found out that if there is nothing in the ini file it will set the variable to 0. So I set up a branch to check to see if there was a value in the ini file if not it used the default value I set in the variable.
                        I'd also like to know how you did this cause I have defaults set that I want used if they don't change it in the options

                        Comment


                        • #13
                          Okay I just checked. You can't use a "SwitchHasAuthority" node in a resource or consumable blueprint.
                          Richard Rude
                          Environment Artist
                          Portfolio: www.richardrude.com
                          Artstation: www.artstation.com/artist/richardrude

                          Comment


                          • #14
                            Originally posted by CreativeHD View Post
                            Okay I just checked. You can't use a "SwitchHasAuthority" node in a resource or consumable blueprint.
                            ah ok... my goal is to make items price change based on variables in the ini cause I'm making a "shop" and want the server host to be able to set his economy

                            Comment


                            • #15
                              I'm still needing help with this can anyone tell me how to pull a variable from ini and assign it to a value (ie base resource requirement) of a blueprint?

                              Comment

                              Working...
                              X