Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: G_G on January 18, 2009, 07:56:53 pm

Title: Force Save[Resolved with 2 ways]
Post by: G_G on January 18, 2009, 07:56:53 pm
Okay well I know how to force the player to save his game.
Like I can actually make him have to save the game before he can move on.
But thats not what the request is.

I want to be able to force the Game itself save without going into the save screen. I want to be able to use a syntax like this or something.

ForceSave(Slot # Here)

Where slot # here is what slot number the script saves the data to.

I don't know if this script is possible but it would work perfect for my star wars mini project.

Thanks in advanced.
Title: Re: Force Save
Post by: Aqua on January 18, 2009, 09:47:50 pm
Um... isn't this... basically... built in...?


    file = File.open(filename, "wb")
    write_save_data(file)
    file.close


Took that from Scene_Save.
That's basically what happens when you decide to save in the slot from the regular save screen.
Title: Re: Force Save
Post by: G_G on January 18, 2009, 11:29:44 pm
Doesn't work.
Title: Re: Force Save
Post by: Starrodkirby86 on January 18, 2009, 11:31:51 pm
Quote from: game_guy on January 18, 2009, 11:29:44 pm
Okay thank you!

But how do you decide what slot it is?

I think it's stated right there...
  def on_decision(filename)
    # Play save SE
    $game_system.se_play($data_system.save_se)
    # Write save data
    file = File.open(filename, "wb")
    write_save_data(file)
    file.close

Except you need to replace the savedata of that with SAVE001 or whatever the savefiles are named? Simple assumptions for the win...

And to accommodate your edited post, can't you launch this with a Call Script?
Title: Re: Force Save
Post by: G_G on January 18, 2009, 11:55:21 pm
I used Script Call and it crashed

And I'm not quite getting what you posted?
Title: Re: Force Save
Post by: Starrodkirby86 on January 19, 2009, 12:04:50 am
Talking with Aqua, I just decided I might as well use my extensive resources and search for this problem, since I would figure there'd be something on this case (Playing Phoenix Wright >_>; ).

So I found a topic on .ORG that has the solution. Thanks Zeriab!

http://www.rmxp.org/forums/viewtopic.php?f=8&t=53216&p=504504&hilit=force+save#p504504
Title: Re: Force Save
Post by: Zeriab on January 19, 2009, 02:14:31 am
I had forgotten I made that >_>
I would suggest using this instead
class Scene_Save
  def self.save(file_index)
    save_obj = self.new
    file = File.open(save_obj.make_filename(file_index), "wb")
    save_obj.write_save_data(file)
    file.close
  end
end


The syntax is: Scene_Save.save(slot)
For example Scene_Save.save(0) saves to the first slot and Scene_Save.save(3) saves to the last slot.

*hugs*
- Zeriab
Title: Re: Force Save
Post by: G_G on January 19, 2009, 02:24:55 am
Thanks Zeriab!

Wierd thing is I used the event syntax and put it into a script. Then I customized it a little. This is actually much better. Thanks!

*powers up*
Title: Re: Force Save[Resolved with 2 ways]
Post by: Fantasist on January 19, 2009, 07:18:38 am
@Zeriab: Might I ask, why make a new object? Wouldn't something like this do?


class Scene_Save

  def self.save(file_index)
    file = File.open(make_filename(file_index), 'wb')
    write_save_data(file)
    file.close
  end

end


EDIT: nvm, I got why, I'm so stupid >.<
Title: Re: Force Save[Resolved with 2 ways]
Post by: Calintz on February 08, 2009, 03:26:41 pm
Oh wow...very nice job Zeriab!