Wavy Screen Effect Script.

Hi all,

I'm looking for a script that can emulate the wavy screen effect from older games.

I've already found a script that does most of what I want here:

http://www.hbgames.org/forums/viewtopic.php?p=837775

Unfortunately, there's no way to turn this script off as Erase Picture doesn't work in this case. The best I could do was to turn the opacity on the picture down to 0, but that still leaves the script running in the background, taking up CPU cycles and RAM. (And this script is quite hard on both CPU cycles and RAM.)

So in short, does anyone know of a better script out there for RPG Maker VX Ace, or is there anyone out there that can work out how to turn the linked script off?

For reference, in my game I have my main character going through a burning village, and I want the wavy effect to simulate a heat haze.

 - Galdric
There is no "script left running in the background" - the script doesn't add any internal processing to the sprite class that isn't already there - it just sets a couple of variables.

The REAL issue (and the one that needs to be addressed) is that Erase Picture doesn't work on it. This is because when you choose picture 20 for the screen, you don't give a file name. THIS means it IS actually deleted with each frame, but because the name is expected to be empty, it keeps recreating it.

Here is the fixed script:

Spoiler
Code:
#==============================================================================# ** Sprite_Picture# Modified to show wavy picture with picture 19,# and a wavy screen with picture 20# For wavy screen with picture 20:# Place a blank picture in the Pictures folder & select it# Set the "Position" to "Upper-Left" & 0,0# 01APR11 - Brewmeister#============================================================================== class Sprite_Picture  alias wavy_init initialize  def initialize(viewport, picture)    wavy_init(viewport, picture)    if @picture.number == 19 # wavy picture      self.wave_amp = 2      self.wave_length = 208      self.wave_speed = 720    end    if @picture.number == 20 # wavy screen      self.wave_amp = 2      self.wave_length = 208      self.wave_speed = 720    end  end  alias wavy_update update  def update    if @picture.name.empty? and       @picture.number == 20 and [email protected]      cap_screen = true    end    wavy_update    if cap_screen      self.bitmap = Graphics.snap_to_bitmap    end  endendclass Game_Picture  attr_reader   :erased                   # picture erased (for wavy pictures)    alias wavy_show show  def show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)    wavy_show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)    @erased = false  end  alias wavy_erase erase  def erase    wavy_erase    @erased = true  endend
There is no "script left running in the background" - the script doesn't add any internal processing to the sprite class that isn't already there - it just sets a couple of variables.

The REAL issue (and the one that needs to be addressed) is that Erase Picture doesn't work on it. This is because when you choose picture 20 for the screen, you don't give a file name. THIS means it IS actually deleted with each frame, but because the name is expected to be empty, it keeps recreating it.

Here is the fixed script:

* snip code *
Thank you Shaz! All this Ruby goes right over my head.

One thing though, you need to use "@picture_name != @picture.name" in order for the script to work. With "if @picture.name.empty? and " in the code, it wont start the wavy screen affect.

What I meant about the script running in the background using up resources, is that when the script is active, it jumps my CPU usage by about 5% and my ram usage anywhere between 20,000K and 250,000K according to the Task Manager so not having the erase picture working was a resource nightmare.
wait a minute ... when I tested, I wasn't selecting a picture at all. That's probably what the difference is.

Hold on and I'll take a look ...

Alright - this is better. The original issue was that even though the picture name was set to blank, cap_screen was never changed, so once it had been displayed, the last part of the update was always redisplaying it. That cap_screen needs to change to false when the picture is erased.

Here is a less-modified version of the original script. I've tested, and it's working for me.

Spoiler
Code:
#==============================================================================# ** Sprite_Picture# Modified to show wavy picture with picture 19,# and a wavy screen with picture 20# For wavy screen with picture 20:# Place a blank picture in the Pictures folder & select it# Set the "Position" to "Upper-Left" & 0,0# 01APR11 - Brewmeister#============================================================================== class Sprite_Picture  alias wavy_init initialize  def initialize(viewport, picture)    wavy_init(viewport, picture)    if @picture.number == 19 # wavy picture      self.wave_amp = 2      self.wave_length = 208      self.wave_speed = 720    end    if @picture.number == 20 # wavy screen      self.wave_amp = 2      self.wave_length = 208      self.wave_speed = 720    end  end  alias wavy_update update  def update    if @picture_name != @picture.name and      @picture.number == 20      cap_screen = [email protected]?    end    wavy_update    if cap_screen      self.bitmap = Graphics.snap_to_bitmap    end  endend
Neat.

I just tried out your new script myself and It definitely works for me.

I was using a transparent picture I made for the image, and I didn't even think about trying it without a picture selected.

Thanks again Shaz.
Yeah, do it with the transparent image, as he suggests. I left it as none, thinking that would be the way to do it, and without actually reading all the comments in the script. So it didn't work for me because the name was always blank. That's why I added in the extra Game_Picture stuff initially. With the latest version, if you don't use an image, it won't work, so just stick with the instructions he's already given.


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.
Moderator note: Being re-opened temporarily to fix broken format of the script provided.
@tv.ghost When you've fixed it, please Report your post so that this can be closed again.
Thanks for your help on this.
Fixed script, credit Brewmeister.
(For picture 20, make a transparent png, rather than just setting a "show command" pic with no graphic.)

Code:
#==============================================================================
# ** Sprite_Picture
# Modified to show wavy picture with picture 19,
# and a wavy screen with picture 20
# For wavy screen with picture 20:
#Place a blank picture in the Pictures folder &select it
#Set the "Position" to "Upper-Left" & 0,0
# 01APR11 - Brewmeister
#==============================================================================
class Sprite_Picture 
  alias wavy_init initialize 
  def initialize(viewport, picture)   
    wavy_init(viewport, picture)   
    if @picture.number == 19
      # wavy picture     
      self.wave_amp = 2     
      self.wave_length = 208     
      self.wave_speed = 720   
    end   
    if @picture.number == 20
      # wavy screen     
      self.wave_amp = 2     
      self.wave_length = 208     
      self.wave_speed = 720   
    end 
  end 
  alias wavy_update update 
  def update   
    if @picture_name != @picture.name and @picture.number == 20     
      cap_screen = [email protected]?   
    end   
    wavy_update   
    if cap_screen     
      self.bitmap = Graphics.snap_to_bitmap   
    end 
  end
  end

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/wavy-screen-effect-script.18113/