Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
This puts Faces in your Games
#1
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


ok. with a little work and alota of trial and error. i found a way to put faces in ya game. now there maybe others out there that work for others. but this worked for me. its pretty easy and doesn't require much change to the standard RGSS Scripts.

Ok. firstly you need to create a folder for your faces and put it in your Graphics folder. now these "Faces" should be named match the chara num of the hero you want to assign it too. (i.e. face1 would go to Hero 001, etc) now that thats done on to the code:

Window_ Menustatus:
Code:
def initialize
super(0, 0, 496, 480)
self.contents = Bitmap.new(width - 32, height - 32)
@viewports = []
@faces = []
for i in 0..$game_party.actors.size - 1
actor_num = $game_party.actors[i].id
filename = "Graphics/MFaces/face" + actor_num.to_s + ".png"
@viewports[i] = Viewport.new(168, 16 + i * 116, 96, 96)
@viewports[i].z = 800
@faces[i] = Sprite.new(@viewports[i])
@faces[i].bitmap = Bitmap.new(filename)
@faces[i].opacity = 255
@faces[i].visible = true
if $game_party.actors[i].dead?
@faces[i].tone = Tone.new(0, 0, 0, 255)
end
end
refresh
self.active = false
self.index = -1
end
See the line starting with "filename ="? that pulls the "Faces" from the folder "MFaces" and each picture matches the actor number

Window_Status:
Code:
def initialize(actor)
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@actor = actor
actor_num = @actor.id
filename = "Graphics/MFaces/face" + actor_num.to_s + ".png"
@viewport = Viewport.new(8, 48, 96, 96)
@viewport.z = 975
@face = Sprite.new(@viewport)
@face.bitmap = Bitmap.new(filename)
@face.opacity = 255
@face.visible = true
refresh
end
#---------------------------
def dispose
super
@face.dispose
end
this was pretty easy to do once a igot the first part done.

Window_Savefile
Code:
def initialize(file_index, filename)
super(0, 64 + file_index % 4 * 104, 640, 104)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Jokerman"
self.contents.font.size = 36
@viewports = []
@faces = []
@file_index = file_index
@filename = "Save#{@file_index + 1}.rxdata"
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@useless = Marshal.load(file)
@frame_count = Marshal.load(file)
@system = Marshal.load(file)
@useless = Marshal.load(file)
@useless = Marshal.load(file)
@useless = Marshal.load(file)
@useless = Marshal.load(file)
@useless = Marshal.load(file)
@party = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
file.close
end

refresh
@selected = false
end
# ------------------
def dispose
super
if @file_exist
if @party.actors.size > 0
for i in 0..@party.actors.size - 1
@faces[i].dispose
@viewports[i].dispose
end
end
end
end
#--------------------------------------------------------------------------
# � リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
name = "Memory #{@file_index + 1}"
self.contents.draw_text(4, 0, 600, 32, name)
@name_width = contents.text_size(name).width
if @file_exist
if @party.actors.size > 0
for i in 0...@party.actors.size
actor_num = @party.actors[i].id
filename = "Graphics/MFaces/face" + actor_num.to_s + ".png"
x_coord = 250 + 100 * i
y_coord = 80 + 104 * @file_index
@viewports[i] = Viewport.new(x_coord, y_coord, 96, 96)
@viewports[i].z = 975
@faces[i] = Sprite.new(@viewports[i])
@faces[i].bitmap = Bitmap.new(filename)
@faces[i].opacity = 255
@faces[i].zoom_x = 0.75
@faces[i].zoom_y = 0.75
@faces[i].visible = true
if @party.actors[i].dead?
@faces[4 + i].tone = Tone.new(0, 0, 0, 255)
end
end
end
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("%02d:%02d", min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(50, 40, 164, 32, time_string, 2)
end
end
this took me soooo long to get right! took a lil help to finally get it done.
now you don't have to name your Faces folder like mine choose your own. but this works for me. hope it does for you too.
}




Users browsing this thread: