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.

Hope this helps you guys get started! Also thank you to for showing me this!

Thanks Creative… this is awesome :slight_smile:

Thanks a lot, i’ll add that to the current documentation.

No problem! Anyway I can help!

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.

can we get a section for all the “how to’s and tutorials?”

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

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?

I don’t find the option switchasauthority
switch.png

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

Check “Context Sensitive” and it will appear.

Still don’t see it unless it’s switch on something

Also after I get that working how do you assign the value from the variable to the option in the blueprint?

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

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

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?

event begin play doesn’t seem to be firing I tried adding a send text to player to confirm but doesn’t do anything

Creative, how exactly did you get it to check the ini file first? I’ve never done anything like this before, and your tutorial was incredibly helpful, but I don’t know how to figure out how to do that bit.

I’ve been using it it’s under events and it’s visual scripting you can read from the gameusersettings.ini file the way he said only for it to actually work I had to use a delay after event begin play. you just can’t do it from certain blueprints. I used it on a shop so that it would read from the file and set the sell prices

So in order to stop it setting stuff to “0” if there is no value in the INI file, i need to set a delay-- to I set that on the “cast to shootergame” or “flotoptionini” bit?

no the delay comes after “begin play” otherwise it doesn’t seem to execute… just a .2 sec is all it needs if you read from the ini and put nothing in it … the value returned is 0 and you deal with that the way you want. the floatoptionini part pulls 0 if the item isn’t in the ini file