[SCRIPTING][RMVX ACE] CHANGING THE TINT OF A SCREEN BASED ON A VALUE

Posts

Pages: 1
I want to change the screen's tint based on a variable, I know Ruby is different from Java but the only thing I can think of is something like:

if (Var != Current_Var) {
Color_Tone_Red = Current_Var
Color_Tone_Green = Current_Var
Color_Tone_Blue = Current_Var
Var = Current_Var
} end if

A PseudoCode of what I wish to desire, given that Var is within the boundaries of the color tones (max value at 200 || 250). I would have the script in an event that performs a parallel process running. Unless there is an easier way to increment color tones (besides {Tint Screen...} which changes the screen to a set value)

PS: Forgot to submit this for a few hours, which is not very helpful... hehe...
Look at the start_tone_change method in the Game_Screen class. It controls the tint applied to the screen and an instance is in the Game_Map and Game_Troop classes. The quick and dirty way to do this would be to have an event do the call. It can use two variables to track the current and last value as your code above does. Once the value changes you can use an event->script call to create your new tone and call $game_map.screen.start_tone_change with your new tone and a duration of zero or whatever you want. Update the previous_value variable and have it repeat.

Alternatively you can do the same in the Game_Map update loop and skip the event and duct tape. Something like
class Game_Map

  alias :update_screen_tint_variable :update unless $@
  def update(*args)
    # Check to see if we're updating the tint, we assume variable ID 999 for now
    # We also use a switch in case we want to not execute this code as needed
    if $game_switches[999] and @last_tint_value != $game_variables[999] 
      # This is just a screen space saver
      v = $game_variables[999]
      # Create the new tone of the screen based on the variable
      t = Tone.new(v, v, v)
      # This should make the screen tint occur immediately
      screen.start_tone_change(t, 0)
      # Now remember the current tone value
      @last_tint_value = v
    end

    # Now call the original method so the  map gets updated
    # (we do this second as the screen is updated here too)
    update_screen_tint_variable(args)
  end

end


Quick demo of the script here
@GreatRed Spirit
EEEK!!! My game scared me with this script *~*

Is there a way to tint the parallax background graphic? My game works insanely well at getting dark(black), but it is crippled when it is bright(white). My fix should be to add a parallax that changes as you move on. I need to create fear in the player in either direction of the hall.

Also would tinting a picture be the same method as the tint screen script? Something Like...

class Game_Picture

alias :update_screen_tint_variable :update unless $@
def update(*args)
# Check to see if we're updating the tint, we assume variable ID 999 for now
# We also use a switch in case we want to not execute this code as needed
if $game_switches and @last_tint_value != $game_variables
# This is just a screen space saver
v = $game_variables
# Create the new tone of the picture based on the variable
t = Tone.new(v, v, v)
# This should make the screen tint occur immediately
picture.start_tone_change(t, 0)
# Now remember the current tone value
@last_tint_value = v
end

# Now call the original method so the map gets updated
# (we do this second as the screen is updated here too)
update_picture_tint_variable(args)
end

end

I could be horribly wrong or close but no cigar as I am still new to Ruby programming and RGSS3. But this is the theory for it yes?
Pages: 1