automatic border around faces

Hi guys 🙂

So I'd like a simple border around the character's faces that are displayed in battle/in messages, but also I don't want to spend a billion hours in photoshop. I found this script that adds borders to icons, and tried changing it, but had zero luck. Does anyone think they could whip up a script that just automatically adds a border around the faces?

I'm using Yanfly's battle engine, which already overwrites the 'draw face' method:

def draw_face(face_name, face_index, dx, dy, enabled = true) bitmap = Cache.face(face_name) fx = [(96 - item_rect(0).width + 1) / 2, 0].max fy = face_index / 4 * 96 + 2 fw = [item_rect(0).width - 4, 92].min rect = Rect.new(fx, fy, fw, 92) rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92) contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha) bitmap.dispose endIf anyone could give me a hand with this, I'd super appreciate it 🙂
Try this:

Code:
def draw_face(face_name, face_index, dx, dy, enabled = true)  bitmap = Cache.face(face_name)  fx = [(96 - item_rect(0).width + 1) / 2, 0].max  fy = face_index / 4 * 96 + 2  fw = [item_rect(0).width - 4, 92].min  rect = Rect.new(fx, fy, fw, 92)  rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)  contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)  bitmap.dispose  # add a black border around the face  bitmap2 = Bitmap.new(96, 96)  bitmap2.fill_rect(bitmap2.rect, Color.new(0, 0, 0, 255))  bitmap2.clear_rect(1, 1, 94, 94)  contents.blt(x, y, bitmap2, bitmap2.rect, 255)  bitmap2.disposeend
If you find that doesn't give you a thick enough border, change this line:
Code:
bitmap2.clear_rect(1, 1, 94, 94)
to this, to make it a bit thicker:
Code:
bitmap2.clear_rect(2, 2, 92, 92)
is there anything you can't do??? thanks so much 😀 !
Yes, there are many things I can't do 🙂 In fact I've just thought of a nicer way to do the above, but since it works, we'll leave it at that 🙂


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/automatic-border-around-faces.24972/