• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

How to get string from a text file?

Status
Not open for further replies.

kesa_

K

kesa_

I want to create an auto-load system in a RPG map, is there a possible way to get string from a text file so it can be used in the load function?
 
The linked thread is about saving, not loading.

You can read information via the Preloader native, that is, if you have localfiles enabled, so you can access the files on the hard disk. The file loaded by Preloader is to be executed as a jass script and should have the right format of a preload file. Output such a file via PreloadGenEnd as described in the linked thread. A few jass natives besides normal preload lines can be inserted and those are used to add the information, one of that being SetPlayerName.

http://www.thehelper.net/threads/preloader-based-save-load-system-sync-local-data-system.141988/

Take a look at the code in this thread.

However, if your map is multiplayer, of course other players won't have the same data on their drive. So reading will yield async results first. They have to be broadcasted to the other players, which can be done via the game cache sync natives for example. Syncing requires time, you have to pause the game/wait until you can use the won information. If you have 12 players and everyone transmits multiple stuff, this can take quite long.

edit: https://www.hiveworkshop.com/forums/world-editor-help-zone-98/loading-data-preload-natives-248509/
 
Last edited:
Status
Not open for further replies.
Back
Top