<dm><dm><dm>How can I make all items save where there are and what your holding.
mob
proc
//----------------------------------//
CreateChar(mob/M) // The char creation function
//----------------------------------//
//----------------------//
usr << "Charecter created" // debug msg
//----------------------//
usr.loc = locate(1,1,1) // spawn the character to 1,1 on map #1
usr.sight = 0 // make it so the character can see
usr.SaveChar() // Auto-Save the new char for just in case game crashes.
..()
SaveChar() // The proc that saves your character.
var/savefile/F = new("players/[src.ckey].sav") // define the save file and create it
F["name"] << name // Outputs the characters name into the savefile list
F["X"] << src.x // Outputs the char's X coordinate into the list
F["Y"] << src.y // Outputs the char's Y coordinate into the list
F["Z"] << src.z // Outputs the char's Z coordinate into the list
F["Mob"] << usr.client.mob // Outputs ALL of the character (var's, etc) into the list
verb
Save()
usr.SaveChar() // Make a call to the character's saving proc
usr << "Your character has been saved." // Inform the player that he's been saved.
This is what I have so far for my save
turf/LoadChar
icon = 'title.dmi' // load png
icon_state = "load"
Click()
if(fexists("players/[usr.ckey].sav")) // check to see if the character has a savefile
usr.LoadCharacter() // Make a call to load the character
//----------------------------------//
world << "Welcom back [usr.name]!" // Announce to the world
// that the user logged in
//----------------------------------//
usr << "Welcome back to the game!" // Welcome the player
return ..()
else
alert("You don't HAVE an old character here, or it isn't found in our databases!")
// Uh oh! No player file found when they clicked Load!
return ..()
..()
And this is my load
And sorry if It doesnt show up in DM code format, Im a little new to this.
</<></<></<></<></< >
</DM>
mob
proc
LoadCharacter() // The load character proc
var/savefile/F = new("players/[src.ckey].sav") // define the location of the save file
var/X // Defines a temporary X variable
var/Y // Defines a temporary Y variable
var/Z // Defines a temporary Z variable
var/mob/newmob = new() // Initialize a new mob
F["name"] >> name // Load the name from the list into the character's name
F["X"] >> X // Load the X variable from the savefile to the temporary X variable
F["Y"] >> Y // Load the Y variable from the savefile to the temporary Y variable
F["Z"] >> Z // Load the Z variable from the savefile to the temporary Z variable
F["Mob"] >> newmob // Load all the mob data into the initialized mob
newmob.loc = locate(X,Y,Z) // Move the initialized mob to the last saved location
newmob.client = src.client // Set the mob's client to players client
</DM>