Jo.
I'm wondering if anyone has any scripts that can specifically do this effect: invert all the colors of the screen. As in, every single color would be its opposite. Think of it like taking a picture, go to tools/image, and invert colors. I have a way to do that already, but its only for still screens and a whole lot of work. If anyone can, make it into stuff like $game.system_invert(0,0,0) or something like that.
So you are looking for an invert of color that will last while the character is playing??
Yeah, I'm pretty sure that's what I'm looking for.
Wow...
that will be interesting.
What do you need it for if you don't mind me asking??
Lots of very weird things. My games tend to get a bit melodramatic and stuff where the character gets a lot of these revelations and goes half insane and all forth, and stuff like this thing right here would be just perfect for some of these (mostly evented) scenes. I don't plan to have the character actually move around during this, but it'll be interesting if I do. I even got the good sound effect for when this comes on.
Oh yeah, forgot to add: I want to want an actual time for this transition to occur, to make it configurable over a certain amount of time. Thanks.
I suppose that would be quite interesting actually...
I hope someone with a moderate knowledge of scripting comes around and helps you. I would love to see what you do with this if you get it...
Will there be any movement during those inverted scenes? If no, it's very simple. If yes, I have an idea which might work. Tell me which.
No, absolutely no movement is needed. This is more of a cutscene thing, so there's no need for movement. And please remember to take a certain amount of time to pass as the colors slowly invert, it's for a sound effect.
But imagine if it did have movement... cool...
This would still be kinda neat...
I have exams the next 3 days. Probably I'll get this done the next weekend.
I use inversion of images on the fly during boss battles because of the fading animation. Rather than inverting it all at once, I have a subsystem that inverts a portion of the battler each frame. It's a very time consuming operation and to save space I have used this trick.
If you need an inverted image for a static image, your best bet is to screenshot that scene and use the Show Picture event command for a moment along with transitions.
As I said, it's a very time consuming operation so I suggest you don't do it.
Yeah, I have used this thing before, on my Nox Aeterna project. I even upted it a bit more on that. It is very time consuming, and the show picture stuff and all that is extremely annoying to me.
Either way, if I want to do this thing for a static image, if there's a moving fog, then it'll be totally messed up since at one moment the fog's moving and the next it's next. That's why I put up this request.
QuoteIf you need an inverted image for a static image, your best bet is to screenshot that scene and use the Show Picture event command for a moment along with transitions.
That's how I was going to implement it, but script-wise.
Quoteif there's a moving fog, then it'll be totally messed up since at one moment the fog's moving and the next it's next. That's why I put up this request.
@Bliz: Will the Graphics.freeze trick work on this?
I don't think so. :/
How about the same trick you use for Ultimate Font Override? Make a class variable for sprites and change the blending according to it? So every sprite will have a negative blending when the flag is on...
It can be done simplier. Edit Sprite#initialize and set negative blending. But negative blending isn't the same as negative. :/
QuoteBut negative blending isn't the same as negative. :/
Yeah, but that's the most efficient way to achieve a similar effect. Working on their bitmaps is a bad idea, isn't it.
QuoteIt can be done simplier. Edit Sprite#initialize and set negative blending.
But that would make everything look strange... Besides, I tried and it's not working. I thought I had a wrong idea about what negative blending is, but that trick isn't working with the tone either... Meh, I'll look into it after the exams
PS: I modified the Death Image in Tons to get a good effect without the sprites :D Here it is:
#==============================================================================
# ** RPG::Cache
#==============================================================================
module RPG
module Cache
def self.death_image(battler)
name = battler.battler_name + '_dead'
if @cache[name] == nil
b = Bitmap.new('Graphics/Battlers/' + battler.battler_name)
b.invert!
@cache[name] = b
end
return @cache[name]
end
end
end
#==============================================================================
# ** Bitmap
#==============================================================================
class Bitmap
def invert
w, h = self.width, self.height
inv = Bitmap.new(w, h)
(1..w).each{|x| (1..h).each{|y|
color = self.get_pixel(x, y)
next if color.alpha == 0
r, g = 255 - color.red, 255 - color.green
b, a = 255 - color.blue, color.alpha
inv.set_pixel(x, y, Color.new(r, g, b, a))}}
return inv
end
def invert!
w, h = self.width, self.height
(1..w).each{|x| (1..h).each{|y|
color = self.get_pixel(x, y)
next if color.alpha == 0
r, g = 255 - color.red, 255 - color.green
b, a = 255 - color.blue, color.alpha
self.set_pixel(x, y, Color.new(r, g, b, a))
}}
return self
end
end
# TONS Death Image
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
DEATH_IMAGE = nil # the battler file name of your death image
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Sprite_DummyBattler
#==============================================================================
class Sprite_DummyBattler < RPG::Sprite
attr_accessor :battler
def update
return if @battler == nil
super
if self.bitmap == nil
#==================== MOD Begin =====================
if DEATH_IMAGE
self.bitmap = RPG::Cache.battler(DEATH_IMAGE, 0)
else
self.bitmap = RPG::Cache.death_image(@battler)
self.tone.set(0, 128, 128) # <<< Set tone to cyan
end
#==================== MOD End =====================
@width, @height = bitmap.width, bitmap.height
self.ox, self.oy = @width / 2, @height
self.opacity = 0 if @battler.dead? || @battler.hidden
end
if @battler_visible
if !@battler.hidden && !@battler.dead? &&
(@battler.damage == nil || @battler.damage_pop)
escape
@battler_visible = false
elsif $game_temp.battle_main_phase
self.opacity += 3 if self.opacity < 255
elsif self.opacity > 207
self.opacity -= 3
end
elsif @battler.damage == nil && @battler.dead?
appear
@battler_visible = true
end
if @battler != nil
if $game_system.CENTER_BATTLER && @battler.is_a?(Game_Actor)
self.x = case $game_party.actors.size
when 1 then @battler.screen_x + 240
when 2 then @battler.screen_x + 80 + @battler.index * 160
when 3 then @battler.screen_x + 80
when 4 then @battler.screen_x
end
else
self.x = @battler.screen_x
end
self.y, self.z = @battler.screen_y, @battler.screen_z
end
end
end
What do you think? Of course, the cyan doesn't give exact results, but it's close enough.
Better take my monochrome inverter from CP (maximally optimized of course).
class Bitmap
def invert
(0...self.width).each {|x| (0...self.height).each {|y| invert_pixel(x, y)}}
end
def invert_pixel(x, y)
c = get_pixel(x, y)
return if c.alpha == 0
if c.red > c.green
if c.red > c.blue
max = c.red
min = (c.blue < c.green ? c.blue : c.green)
else
max = c.blue
min = (c.red < c.green ? c.red : c.green)
end
elsif c.green > c.blue
max = c.green
min = (c.blue < c.red ? c.blue : c.red)
else
max = c.blue
min = (c.red < c.green ? c.red : c.green)
end
med = (max + min) / 2
if med > 128
c.red, c.green, c.blue = 128-med/2, 383-med*3/2, 383-med*3/2
else
c.red, c.green, c.blue = 255-med*3/2, 255-med/2, 255-med/2
end
set_pixel(x, y, c)
end
end
How is this coming along??
Yeah, how are things coming along?
Not that I need it. I'm weeks away from starting on mapping and eventing.
QuoteNot that I need it. I'm weeks away from starting on mapping and eventing.
Good, cause I havent started on this one >.< Don't worry, I'll do this soon. By this Saturday in the worst case.
Okay, can anyone here can finish this request? It's been a while since I've visited, but that's because I've been working on a whole different game. Chapter 1 is 95% done(everything...) atm, but for one of the cutscene this effect would be perfect. Can anybody get this request to me before christmas?
sorry m8... its a little bid to advanced for me :S
:)
It's a little too advanced for me too, that's why I put it up for script requests. I am learning how to script, though, but I can't do anything like this anyways.
I'm sorry, won't be doing this :( but I'll guide anyone who would like to try. basically, you need to take a screenshot of the screen you want to invert. For that, use the "screenshot.dll" and the code (module Screen) from my transition demo (link in my sig). Once you've taken the screenshot, load the file (b = Bitmap.new(screenshot.png) ). Now, do this to the bitmap:
for i in 0...b.width
for j in 0...b.height
# Get original color
orig_color = b.get_pixel(i, j)
# Extract RGB components
orig_red = orig_col.red
orig_green = orig_col.green
orig_blue = orig_col.blue
# Invert RGB components
inv_red = 255 - orig_red
inv_green = 255 - orig_green
inv_blue = 255 - orig_blue
# Make inverted color
inv_color = Color.new(inv_red, inv_green, inv_blue)
# Set the inverted color
b.set_pixel(i, j, inv_color)
end
end
That's the basic concept. It's that big so you it's understandable. Now, once the loop is complete, the bitmap "b" will be inverted.
ha ha, I actually had this bumping around in my head when I was thinking of methods to do it, except I didn't have the dll part.
Thanks for doing this, at least. In a couple months, after I've gotten some mastery of rgss, I'll be able to inplement it in chapter two. For now, I'm just using an actual screenshot and inverting it, which is time consuming and space consuming, but oh well.
Thanks for trying.