x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Is there a way to save and get values from the game ini file?

Hi there, is there any way to save and get values from the game ini file from blueprint? it's a pretty necessary feature for almost every game.

Greetings.

Product Version: Not Selected
Tags:
more ▼

asked Aug 03 '14 at 08:43 AM in Blueprint Scripting

avatar image

EIREXE
43 10 16 20

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Yes there is, I've seen various posts about this but for me this simple solution works very well.

In this example I'm using a fixed file name and save object but you can extend this simply to work with different files and object to for example keep game settings in one file and multiple saves in another.

First create a new blureprint of type 'SaveGame'. Name it to what you want but in my example it's 'PlayerObject'. Within Player Object have a variable that is a 'User Structure' you have created to contain all your save game info, IE Score, etc etc.

Then create another blueprint of functions and add the following functions.

alt text

You should then have a variable in your game controller which is of type Player Object. You can now call save game with that object and it will save it or return it in the case of load. I've seen people copying out data from the user structure to local variables then back in to save however you can work directly with your user structure and its a lot less work.

One caviate is that you must call StartNewGame Once before the above. You can do this using the function 'Does Save Game Exist' which will let you know if you already have a save game.

saveall.png (116.1 kB)
more ▼

answered Aug 03 '14 at 09:58 AM

avatar image

xrouter
123 3 3 5

avatar image EIREXE Aug 03 '14 at 10:04 AM

Do these files get saved as binary files or plain text? I want my users to be able to modify certain stuff externally.

avatar image xrouter Aug 03 '14 at 10:10 AM

Binary I'm afraid. If you want to use a ini file text format your going to need to hit C++ to do it as I've not found a way.

Its on my TODO list to write an ini loader which can expose it's self to blueprints but its way down the list atm. If you do find someone who has already done it let me know ;)

avatar image EIREXE Aug 03 '14 at 11:39 AM

Ow, I hope Epic implements it for 4.5 or even 4.4, it's a really basic thing.

avatar image Osok Sep 18 '14 at 04:58 AM

Save Game function does not work. do you have to cast to player item before you run save game function?

Could you post a screenshot showing your setup please? I switched to saving gamedata your way from the complex one you mentioned, but I am having troubles. Thank you in advance

avatar image MrCorzell Jul 23 '16 at 12:51 AM

The accepted answer on here doesn't provide a solution close to the question unfortunately due to binary / non-portable nature of save data. A binary save data file is completely different than modifying ini files at run-time. What if you want presets that designers can create in-game that save to an ini and you can propagate those through version control to other designers / programmers in the engine?

Save data doesn't support that.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question