Script Request, Save System

Page 2 of 2 Previous  1, 2

Go down

Re: Script Request, Save System

Post by Dezz123 on Sun Nov 07, 2010 5:05 pm

You should rename this thread 'OMEGAS LOOK HERE' or something! ^_^
avatar
Dezz123
Legendary
Legendary

Posts : 1534
Gald : 6469

Stats
Cookies: 0

View user profile http://www.dezzgames.webs.com, www.evalon.webs.com

Back to top Go down

Re: Script Request, Save System

Post by The Creator on Sun Nov 07, 2010 8:04 pm

Lol, knowing Omegas he would STILL miss it! Razz
avatar
The Creator
Legendary
Legendary

Posts : 786
Gald : 920

Stats
Cookies: 0

View user profile

Back to top Go down

Re: Script Request, Save System

Post by Peva on Sun Nov 07, 2010 8:19 pm

Stay on topic fellas.

__________________________________
New to OmegaDev? Read the OmegaDev Official Rules.

Peva
Spoiler:





Well, happy RMing Wink
avatar
Peva
Development Moderator
Development Moderator

Posts : 1281
Gald : 4414

Stats
Cookies: 0

View user profile

Back to top Go down

Re: Script Request, Save System

Post by omegas7 on Wed Nov 10, 2010 1:20 pm

HEY!
Errrr.... nngh >___>

FINISH MY CASTLE IN AQUARIUM MASTER FIRST >:0

-----
On a side note, how big do you expect the screenshot to be? There are two ways:
The first one will make a perfect screenshot of a portion of the screen. Just a portion, because taking the whole screen might be very time consuming.
The other might be recreating the map with the Tilemap thingy. However, you won't retain certain aspects like your character or special effects like weather.
I'd go for the first option, if you're ok with me just taking a portion of the screen (the player's area)

__________________________________
avatar
omegas7
Admin
Admin

Posts : 1180
Gald : 4121

Stats
Cookies: 0

View user profile http://www.omegadev.biz

Back to top Go down

Re: Script Request, Save System

Post by Peva on Wed Nov 10, 2010 3:32 pm

Yeah whatever works easier for you. But it needs to be perfect or I won't use it. And your castle is done and Zaddy is mapping Smile

__________________________________
New to OmegaDev? Read the OmegaDev Official Rules.

Peva
Spoiler:





Well, happy RMing Wink
avatar
Peva
Development Moderator
Development Moderator

Posts : 1281
Gald : 4414

Stats
Cookies: 0

View user profile

Back to top Go down

Re: Script Request, Save System

Post by omegas7 on Wed Nov 10, 2010 4:55 pm

So this is how it turned out:



Ulrika is actor number 2.
Ralph is actor number 1.
Ylva's House is the map name (I named it \n[4]'s House) your maps with \n[] should work.
The screenshot is small, but it saves performance.
Colors can be changed, yes.

Looks good 0.o? Honestly I don't like save-related systems. I always end up screwing up something related to data XD

__________________________________
avatar
omegas7
Admin
Admin

Posts : 1180
Gald : 4121

Stats
Cookies: 0

View user profile http://www.omegadev.biz

Back to top Go down

Re: Script Request, Save System

Post by Peva on Wed Nov 10, 2010 5:09 pm

This is perfect, better than I could have ever dreamed Smile

__________________________________
New to OmegaDev? Read the OmegaDev Official Rules.

Peva
Spoiler:





Well, happy RMing Wink
avatar
Peva
Development Moderator
Development Moderator

Posts : 1281
Gald : 4414

Stats
Cookies: 0

View user profile

Back to top Go down

Re: Script Request, Save System

Post by omegas7 on Wed Nov 10, 2010 5:16 pm

Uh ok then take it far away from me.

Well, first of all, you will need this Bitmap tool I made a while back:
Spoiler:
Code:
module BitmapTool
  def self.bitmapToArray(bitmap)
    array = []
    for x in 0...bitmap.width
      array[x] = []
      for y in 0...bitmap.height
        array[x][y] = bitmap.get_pixel(x,y)
      end
    end
    return array
  end
  def self.arrayToBitmap(array)
    bitmap = Bitmap.new(array.size,array[0].size)
    for x in 0...bitmap.width
      for y in 0...bitmap.height
        bitmap.set_pixel(x,y,array[x][y])
      end
    end
    return bitmap
  end
end

This enables the script below to produce the images and save them.
Here's the script:

Spoiler:
Code:
module StupidSaveSystem
  CityNameColor = Color.new(60,220,60)
  PlayerNameColor = Color.new(255,255,255)
  StupidMapNameColor = Color.new(220,60,60)
  VariableColor = Color.new(255,255,255)
  GoldColor = Color.new(255,255,50)
 
  StupidVariableID = 1
  VariablePrefix = "Day "
  GoldPrefix = "Gold: "
end

class Game_System
  alias omegaSystemInitialize initialize
  attr_accessor :saveScreenshot
  attr_accessor :mapID
  attr_accessor :actorNames
  attr_accessor :variable
  attr_accessor :gold
  def initialize
    omegaSystemInitialize
    @saveScreenshot = nil
    @mapID = nil
    @actorNames = []
    @variable = 0
    @gold
  end
end

class Scene_Menu < Scene_Base
  alias omegaMenuInitialize initialize
  def initialize(menu_index = 0)
    omegaMenuInitialize(menu_index = 0)
    takePlayerScreenshot
  end
  def takePlayerScreenshot
    # Full screenshot = Time consuming.
    # Here we will only take a portion of the game screen (player's area)
    map = Graphics.snap_to_bitmap
    bitmap = Bitmap.new(110,110)
    bitmap.blt(0,0,map,Rect.new($game_player.screen_x + 16 - 75,
    $game_player.screen_y + 16 - 75,110,110))
    $game_system.saveScreenshot = BitmapTool.bitmapToArray(bitmap)
  end
end

class Scene_File < Scene_Base
  alias omegaFileInitialize initialize
  def initialize(saving, from_title, from_event)
    omegaFileInitialize(saving, from_title, from_event)
  end
  def create_savefile_windows
    @savefile_windows = []
    for i in 0..2
      @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
    end
    @item_max = 3
  end
  def do_save
    $game_system.actorNames.clear
    for i in 0...$game_actors.data.size
      $game_system.actorNames.push($game_actors[i + 1].name)
    end
    $game_system.mapID = $game_map.map_id
    $game_system.variable = $game_variables[StupidSaveSystem::StupidVariableID].to_s
    $game_system.gold = $game_party.gold
    file = File.open(@savefile_windows[@index].filename, "wb")
    write_save_data(file)
    file.close
    return_scene
  end
end

class Window_SaveFile < Window_Base
  include StupidSaveSystem
  attr_reader  :filename                # filename
  attr_reader  :file_exist              # file existence flag
  attr_reader  :time_stamp              # timestamp
  attr_reader  :selected                # selected
  alias omegaSaveDispose dispose
  def initialize(file_index, filename)
    super(0, 56 + file_index % 4 * 120, 544, 120)
    @file_index = file_index
    @filename = filename
    load_gamedata
    refresh
    @selected = false
  end
  def refresh
    self.contents.clear
    name = "Save #{@file_index + 1}"
    if @file_exist
      name = "#{@game_system.actorNames[1]}"
      self.contents.font.color = CityNameColor
      self.contents.draw_text(4, 0, 200, WLH, "#{name}")
      self.contents.font.color = PlayerNameColor
      self.contents.draw_text(4, WLH, 200, WLH, "#{@game_system.actorNames[0]}")
      #draw_party_characters(152, 58)
      #draw_playtime(0, 34, contents.width - 4, 2)
      mapdata = load_data("Data/MapInfos.rvdata")
      map_id = @game_system.mapID
      self.contents.font.color = StupidMapNameColor
      map = mapdata[map_id].name.gsub(/\\N\[([0-9]+)\]/i) { @game_system.actorNames[$1.to_i - 1] }
      self.contents.draw_text(200, 0, 200, WLH, "#{map}")
      self.contents.font.color = VariableColor
      self.contents.draw_text(200,WLH,200,WLH,VariablePrefix + @game_system.variable)
      self.contents.font.color = GoldColor
      self.contents.draw_text(200,WLH * 2,200,WLH,GoldPrefix + @game_system.gold.to_s)
      draw_screenshot
    else
      self.contents.draw_text(4, 0, 200, WLH, name)
    end
    @name_width = contents.text_size(name).width
  end
  def draw_screenshot
    @screenshot = Sprite_Base.new
    @screenshot.bitmap = BitmapTool.arrayToBitmap(@game_system.saveScreenshot)
    @screenshot.z = 300
    @screenshot.x = 544 - 110 - 40
    @screenshot.y = self.y + 5
  end
  def dispose
    omegaSaveDispose
    @screenshot.dispose if @screenshot != nil
  end
end

class Game_Actors
  attr_reader :data
end

Notes: Delete all existing save files after installing the script. They just won't work and will throw errors.

And you better put a huge dragon in my castle which is my pet >:0

__________________________________
avatar
omegas7
Admin
Admin

Posts : 1180
Gald : 4121

Stats
Cookies: 0

View user profile http://www.omegadev.biz

Back to top Go down

Re: Script Request, Save System

Post by IMP1 on Wed Nov 10, 2010 5:18 pm

Holy moly. You actually went for the get_pixel method? JEEEEeeez.
I guess the screenshots are small, so not too bad. But Enterbrain could have made Bitmap class so much easier to deal with ¬_¬

__________________________________
Code:
"haystack".scan(/needle/)
avatar
IMP1
Coding Moderator
Coding Moderator

Posts : 503
Gald : 1399

Stats
Cookies: 5

View user profile

Back to top Go down

Re: Script Request, Save System

Post by omegas7 on Wed Nov 10, 2010 5:31 pm

Yeah, why in the world would they hide Bitmap 0.o
Well, technically we could implement our own Bitmap class XD

I was originally going for simply recreating the Tilemap of the player's save location, but then I wouldn't have stuff like weather or pictures or characters (well characters maybe with some work :/), and I like all that stuff XD

Another choice was saving the screenshot as a .png image for easy loading in the future, but heck, should the player touch that image the whole save is screwed up =/

.get_pixel isn't so bad for small images like Peva's =D.. I think.

__________________________________
avatar
omegas7
Admin
Admin

Posts : 1180
Gald : 4121

Stats
Cookies: 0

View user profile http://www.omegadev.biz

Back to top Go down

Re: Script Request, Save System

Post by Peva on Wed Nov 10, 2010 5:34 pm

Thank you! As soon as Zaddy completes my maps I'll get ready to take some screenshots. This can be closed, thanks Smile

__________________________________
New to OmegaDev? Read the OmegaDev Official Rules.

Peva
Spoiler:





Well, happy RMing Wink
avatar
Peva
Development Moderator
Development Moderator

Posts : 1281
Gald : 4414

Stats
Cookies: 0

View user profile

Back to top Go down

Re: Script Request, Save System

Post by Peva on Sun Nov 14, 2010 8:19 pm

Hey since this is still open, can you add a little thing that makes it have town after actor 2's name?

EDIT: Do you think you can move the little image over to the right a bit?



Also, I believe your script is incompatible with this one...
Spoiler:
Code:

# Save confirmation popup
# By Mithran
# Makes a small window popup indicating the game has been saved, after it has been
# saved.
# Install: Insert below any custom file systems.  Should work with most
# custom file systems.

class Scene_File
  SAVE_CONFIRM_CAPTION = "Save Is Complete!"
  SAVE_CONFIRM_LENGTH = 120 # Max length in frames for the confirmed window to stay
  BLUR_BEFORE_CONFIRM_CAP = false
  # If set to true, the file screen will blur into the background before showing
  # the save confirmation box

  # do not edit beyond this point ----
  alias do_save_orig_popconfirm do_save
  def do_save
    do_save_orig_popconfirm
    @save_done = true
  end

  alias terminate_orig_popconfirm terminate
  def terminate
    if @save_done
      bp = Graphics.snap_to_bitmap
      bp.blur  if BLUR_BEFORE_CONFIRM_CAP
      bs = Sprite.new
      bs.bitmap = bp
    end
    terminate_orig_popconfirm
    if @save_done
      save_done_popup
      bs.dispose
    end
  end
 
  def save_done_popup
    Graphics.transition(0)
    create_save_done_window
    update_save_done_window
    close_save_done_window
    Graphics.freeze
  end
 
  def create_save_done_window
    tw = Bitmap.new(32, 32).text_size(SAVE_CONFIRM_CAPTION).width
    @save_done_window = Window_Base.new(0, 0, tw + 32, Window_Base::WLH + 32)
    @save_done_window.openness = 0
    @save_done_window.contents.draw_text(0, 0, tw, Window_Base::WLH, SAVE_CONFIRM_CAPTION)
    @save_done_window.x = (Graphics.width - @save_done_window.width) / 2
    @save_done_window.y = (Graphics.height - @save_done_window.height) / 2
    @save_done_window.open
  end
 
  def update_save_done_window
    sl = 0
    while sl < SAVE_CONFIRM_LENGTH
      Graphics.update
      Input.update
      @save_done_window.update
      sl += 1 unless @save_done_window.openness < 255
      break if Input.trigger?(Input::C)
    end
  end
 
  def close_save_done_window
    @save_done_window.close
    while @save_done_window.openness > 0
      Graphics.update; @save_done_window.update
    end
    @save_done_window.dispose
  end
 
end

if you could fix, I would be happy Smile

__________________________________
New to OmegaDev? Read the OmegaDev Official Rules.

Peva
Spoiler:





Well, happy RMing Wink
avatar
Peva
Development Moderator
Development Moderator

Posts : 1281
Gald : 4414

Stats
Cookies: 0

View user profile

Back to top Go down

Re: Script Request, Save System

Post by Peva on Fri Nov 19, 2010 3:50 pm

Bump, I get this error when I save for the second time.



Oh, and this ickyness is happening too...

__________________________________
New to OmegaDev? Read the OmegaDev Official Rules.

Peva
Spoiler:





Well, happy RMing Wink
avatar
Peva
Development Moderator
Development Moderator

Posts : 1281
Gald : 4414

Stats
Cookies: 0

View user profile

Back to top Go down

Re: Script Request, Save System

Post by Peva on Sun Nov 21, 2010 8:44 am

BUMP Read last two posts Sad

__________________________________
New to OmegaDev? Read the OmegaDev Official Rules.

Peva
Spoiler:





Well, happy RMing Wink
avatar
Peva
Development Moderator
Development Moderator

Posts : 1281
Gald : 4414

Stats
Cookies: 0

View user profile

Back to top Go down

Re: Script Request, Save System

Post by IMP1 on Sun Nov 21, 2010 9:47 am

Omegas doesn't seem to be around atm. Just be patient Wink

__________________________________
Code:
"haystack".scan(/needle/)
avatar
IMP1
Coding Moderator
Coding Moderator

Posts : 503
Gald : 1399

Stats
Cookies: 5

View user profile

Back to top Go down

Re: Script Request, Save System

Post by Peva on Sun Nov 21, 2010 10:06 am

Aight Smile Just the game is supposed to be done in about 4 days, so I really need some people to pull through for me.

__________________________________
New to OmegaDev? Read the OmegaDev Official Rules.

Peva
Spoiler:





Well, happy RMing Wink
avatar
Peva
Development Moderator
Development Moderator

Posts : 1281
Gald : 4414

Stats
Cookies: 0

View user profile

Back to top Go down

Re: Script Request, Save System

Post by omegas7 on Sun Nov 21, 2010 9:56 pm

I'm currently killing polar bears. Anyway, tell me step by step how to reach that error and I will take a look when got some time.

__________________________________
avatar
omegas7
Admin
Admin

Posts : 1180
Gald : 4121

Stats
Cookies: 0

View user profile http://www.omegadev.biz

Back to top Go down

Re: Script Request, Save System

Post by Peva on Mon Nov 22, 2010 5:49 am

Ok, well it only happened when I used the event processing to Open Save Screen, also you think you can move the little image over a bit? And be sure to really slaughter some cute bears for me ^^

__________________________________
New to OmegaDev? Read the OmegaDev Official Rules.

Peva
Spoiler:





Well, happy RMing Wink
avatar
Peva
Development Moderator
Development Moderator

Posts : 1281
Gald : 4414

Stats
Cookies: 0

View user profile

Back to top Go down

Re: Script Request, Save System

Post by Sponsored content


Sponsored content


Back to top Go down

Page 2 of 2 Previous  1, 2

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum