Udefined method when editing a gameover script.

AceOfAces_Mod

Engineering to infinity!
Veteran
Joined
Sep 7, 2014
Messages
1,721
Reaction score
1,200
First Language
Greek
Primarily Uses
RMVXA
Consider the following scenario:


You installed DoctorTodd's GameOver +.


You modify part of the script like this:


class Scene_Gameover < Scene_Base
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
play_gameover_music
tone = Tone.new(80,0,0,200)
$game_map.screen.start_tone_change(tone, 120)
SceneManager.scene.wait(180)
fadeout_frozen_graphics
tone = Tone.new(0,0,0,255)
$game_map.screen.start_tone_change(tone, 1)
SceneManager.scene.wait(1)
create_background
create_command_window
end


In this scenario, the game crashes with this message:





NOTE: It could also happen on the vanilla Scene_GameOver Script.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
simple as the error message tells: wait is not defined for any scene.


wait is a function of the game interpreter to be used in the game loop for events, and it is a subfunction of special parts where timing counts (like in messages or battles), but scenes are timeless and have no wait, so you can't use wait as a method of a scene.


EDIT: You'll need an entirely different structure here, but I can't tell you how.
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Ohh, you can use 'wait(frames)' if you define it. //rmwforums.s3.amazonaws.com/emoticons/default_tongue.gif


Scene_Battle actually got that method defined. Not that it is usable on the game over screen, but it is a scene with a wait method, right? 


Anyway, if you just want to force a few frame wait time, you can use this:


Graphics.wait(frames)


This will wait the amount of frames you enter while still updating the screen.


Note that this will NOT run any other stuffs while waiting, only the screen redraw. If you need to update something else too while waiting (like some sprites, windows, or the input module), you will need to create your own wait method where you update all what you need, and just loop that for the amount of frames you want.


For example, you want to update the "screen" game map is using, otherwise it will never change the tone no matter how long you wait.


Remove those wait lines you added, and do the following:


120.times do
Graphics.update
$game_map.screen.update
end
Graphics.wait(60)


Insert this just below the first tone change you do in your script. This will finish the tone change for the screen and after that, it will wait an extra 60 frames before continuing.


Because the second tone change should only last 1 frame (very quick), you don't really need to wait here. 


Instead, you can forcibly call the update method of $game_map.screen to instantly change the tone.


So, after the second tone change, just enter this:


$game_map.screen.update




Of course, I didn't test this, because I can't seem to trigger the game over screen, not even if I want to, I just can't lose in games. //rmwforums.s3.amazonaws.com/emoticons/default_biggrin.gif


Okay, jokes aside, I really didn't test this, but in theory, it should work. 
 

AceOfAces_Mod

Engineering to infinity!
Veteran
Joined
Sep 7, 2014
Messages
1,721
Reaction score
1,200
First Language
Greek
Primarily Uses
RMVXA
It works, but for some reason, it doesn't tint the screen. Am I doing something wrong?
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
I just noticed that you try to do this in the start method.


That won't work like that, because during scene changes, the graphic changes are frozen until the transition effect is called, and on that scene, that method is called in the 'fadout_frozen_graphics', which will also get rid of the background picture for the map too at the same time, so there is not much you can do to actually show that tint effect in that method without rewriting the whole start method.


Instead, you should perform the tinting before you actually call the game over scene, so that you are still on the map, and can tint that map screen freely. When you are done with the tinting stuffs and all, you can call the game over screen.


This might even look better, considering that the map itself can still be updated, so there can be moving events and stuffs around while the screen is being tinted.


You can modify this method in Game_Interpreter to do your stuffs before getting on the game over screen:


def command_353
SceneManager.goto(Scene_Gameover)
Fiber.yield
end


So, put your tint stuffs before the actual game over call.
 
Last edited by a moderator:

AceOfAces_Mod

Engineering to infinity!
Veteran
Joined
Sep 7, 2014
Messages
1,721
Reaction score
1,200
First Language
Greek
Primarily Uses
RMVXA
Well, tried and instead of tinting, I get frozen graphics until the game over scene starts up. Maybe it's an issue caused by the Crossfader script I use?
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,570
Latest member
fgfhdfg
Top