Changing Opacity of an Event via Variable

Status
Not open for further replies.

Stupidbro

Veteran
Veteran
Joined
Jul 8, 2019
Messages
87
Reaction score
8
First Language
English
Primarily Uses
RMVXA
Long story made short, I want to make an event seemed to slowly fade in. The method I came up with would, theoretically, be using the Set Move Route function to:
-Change the opacity based on a variable (I'm using the second one specifically)
-Wait a frame
Then simply change the value of the variable. The problem is that I can't figure out how to change the opacity based on a variable. If anyone knows how to do that, or a more efficient way of achieving the same result, I'd appreciate the help. :)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Why do you want to use a variable, if it's the move route that's going to change it? Why not just change the opacity directly, to the current opacity + or - a given amount?

How are you going to tell it when to start fading in, and when to stop? Is it a part of a cutscene that needs things to happen before and after?

If you have a cutscene controller, and the event you want to fade in is a different event, then set up your event to have no sprite. If you want this character to stay around after the player leaves the map and returns, or you want to be able to interact with it after, add a second page with the sprite, conditioned by a switch.

Now in your controller, at the time you want the character to appear, do 2 move route commands. The first will be:
Code:
Set Move Route: [EV001] (Wait)
                Change Opacity: 0
                Change Graphic: (select character and index)
then the second, immediately after, will be:
Code:
Set Move Route: [EV001] (Wait)
                Script: @opacity = [@opacity + 20, 250].min
                Wait 5 frames
                Script: @move_route_index = -1 if @opacity < 250
The above commands will make the NPC invisible and set the correct graphic (do it in that order), and the second one will gradually fade in, looping until the fadein is complete. After it's complete, the event will continue with the next command, which should be to turn on the switch to activate the second page of the event.

You can change the 20 and the 5 to alter the fade in rate, and of course EV001 should be whatever event it is that you want to fade in.
 

Stupidbro

Veteran
Veteran
Joined
Jul 8, 2019
Messages
87
Reaction score
8
First Language
English
Primarily Uses
RMVXA
Why do you want to use a variable, if it's the move route that's going to change it? Why not just change the opacity directly, to the current opacity + or - a given amount?
Eh... mostly not knowing any better. I didn't know one could reference the opacity of an event just like one would do with a variable.

How are you going to tell it when to start fading in, and when to stop? Is it a part of a cut scene that needs things to happen before and after?
The initial plan had been to do it as I had described it before, but with a loop and conditional and... blah blah blah, yes, it is part of cut scene.

Thanks, it worked!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
I asked about the variable because I wanted to know if you were using it for something else as well, and needed it to use the variable because opacity isn't the only thing being controlled by it.

If you need it to be triggered and ended some other way, just say so. Because you didn't describe the context I just made some assumptions, which could be wrong.

But if it does what you need, and no tweaking is necessary, just report your first post and let the mods know the question has been answered, and they'll close the thread for you.
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,374
Reaction score
8,536
First Language
English
Primarily Uses
RMMV

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.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

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,035
Messages
1,018,455
Members
137,821
Latest member
Capterson
Top