ID:273913
 
I want to know how to save a specific var in an obj.

example:

obj
sword
var
attack=50
name="Master Sword"
magic=20
owner=""


The owner is what I am referring to. What I have my code do is; whenever an obj enters a mob's contents, it sets the obj's var/owner to the src's key (mob's key). However, when I close the world, the owner is reset. How would I make it so that a certain obj's owner var keeps the src.key -forever-.
The only way would be using savefiles or some other method of storing the data in a file and reading the data back when the world starts up.
In response to Complex Robot
I understand that part clearly, it's the method of "how to" I am not understanding.
In response to Paul De La Torre
Save the objects the same way you'd save a mob.
In response to Lugia319
Yeah it just came to me right now x.x

obj
sword
var
attack=50
name="Master Sword"
magic=20
owner=""

New()
..()
if(fexists("Folder/Game Vars.sav"))
var/savefile/O = new("Folder/Game Vars.sav")
O["obj_owner"] >> owner
Del()
var/savefile/O = new("Folder/Game Vars.sav")
O["obj_owner"] << owner
..()


Thanks for the advice.