Window Color changes as game progresses

FirestormNeos

Veteran
Veteran
Joined
Jul 23, 2019
Messages
178
Reaction score
128
First Language
English
Primarily Uses
RMMV
My project has, at the end of every chapter, a part where the player is faced with a moral dilemma and is forced to make a decision that will radically alter the world they had journeyed through in that chapter. These moral dilemmas always have three options and are always color-coded with red, green and blue respectively. I want it so that every time a player goes with an option, the window colors become brighter in the color the player picked.

For example, the Window Color at the start of the game is at [-255, 0, -255](aka a sort of dark green) if the player picks mostly red options, I want the menu color to become [0, -255, -255](aka dark red).

Is there a way to do this through common eventing or am I gonna need a plugin?
 

Shiro-chan

Friendly Neighbourhood Neppy Maid
Veteran
Joined
Aug 7, 2018
Messages
151
Reaction score
42
First Language
German
Primarily Uses
RMVXA
You need a script for this, and 3 variables.
Code:
class Window_Base < Window
  def update_tone
    self.tone.set(Tone.new($game_variables[X],$game_variables[Y],$game_variables[Z]))
  end
end
Put this code into a new entry in your script editor, then change X, Y, and Z to the variables you want to use. You don't need any script calls or Common Events; changing any of the variables will apply the change immediatly.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
@Shiro-chan that completely overwrites the old method though, which means that the window will not have the tone set in the system settings when the game starts.

Code:
class Window_Base < Window
  #----------------------------------------------------------------------------
  # * Aliased Method: Update Tone
  #----------------------------------------------------------------------------
  alias hrk_update_tone_old update_tone
  def update_tone
    if $game_switches[X]
      self.tone.set(Tone.new(*$game_variables[Y]))
    else
      hrk_update_tone_old
    end
  end # Update Tone
end # end of Window_Base class
If you use this you can store the three values you need in variable Y like this:
Code:
[r, g, b] # r is red, g is green, b is blue
There is no need for a script call as you can do it using the Script box in the Control Variable event command. This will still use the old method when the switch X is not active, which allows you to keep using the original settings before the end of the game. It goes without saying that yo have to change X and Y in my script accordingly.

@FirestormNeos just a random off-topic tip: don't refer to scripts as plugins, that is the word used to refer to MV plugins. VX Ace scripts are usually referred as "scripts".
 
Last edited:

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,599
Reaction score
6,552
First Language
Indonesian
Primarily Uses
RMVXA
@Heirukichi isn't the correct syntax, like this?
Code:
self.tone.set(Tone.new(*$game_variables[Y]))
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
@TheoAllen yes it is, I will promptly fix those (both the missing * and the missing parenthesis).

EDIT: on a side note the syntax
Code:
self.tone.set(*$game_variables[Y])
should also be correct as the set method of the Tone class can receive either a tone or a set of colors (that is if I am not wrong).
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,446
Members
137,820
Latest member
georg09byron
Top