• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Loading Data with Preload Natives

Status
Not open for further replies.
There are many threads on here that show how you can save data to a text file using PreloadGenStart,Preload, andPreloadGenEnd. However, there are no threads showing how to retrieve any of the saved data. How can you load data from a text file with these natives? Any resources relating to this have been removed, oddly enough.

Edit: I've figured out a way to save and load data. The only downside is I have no clue how multiplayer friendly it is.
JASS:
function SaveFile takes string Msg returns nothing
    call PreloadGenClear()
    call PreloadGenStart()
    call Preload("\" )\ncall SetPlayerName(Player(0),\""+Msg+"\") //")
    call PreloadGenEnd("Saves\\Test Save.txt")
endfunction


function LoadFile takes nothing returns string
    local string PN=GetPlayerName(Player(0))
    local string Str
    call Preloader("Saves\\Test Save.txt")
    set Str=GetPlayerName(Player(0))
    if PN==Str then
        return ""
    endif
    call SetPlayerName(Player(0),PN)
    return Str
endfunction
 
Last edited:
Status
Not open for further replies.
Top