Main Menu
  • Welcome to The RPG Maker Resource Kit.

Cancel movie with a button RMVXA

Started by Yin, March 31, 2012, 04:18:02 PM

0 Members and 1 Guest are viewing this topic.

Yin

Writing a script to make the a movie play before the title screen, but I don't know how to make is so that when you press a button, the movie stops. Is there a way to cancel the movie at the press of a button? The movie plays all the way through.

Yin


DoctorTodd

Use this  :)
if Input.press?(:C)
SceneManager.call(Scene_Title)
end

Check help file for other buttons, C means you hit enter or Z.

Yin

#3
That works during movies? I don't think this does  ???

DoctorTodd

I think it might, why not give it a shot?

Yin

I did :x It would not skip the movie. Maybe i am doing it wrong though.

def before_title_play_movie(movie)
    movie = Movie_To_Play
    Graphics.play_movie('Movies/' + movie) unless movie.empty?
    if Input.press?(:C)
      goto_title
    end
  end


I've also tried trigger instead of press.

DoctorTodd

This may work, I think it wouldn't work because the option of cancelling isn't constant.
def update
  super
  cancel_options
end

def cancel_options
      if Input.press?(:C)
      goto_title
    end

Yin

Thanks. I did that before too, but it did not work. I think the update method is not called while a movie is running. I could be wrong though. But that's not working either.

# Name of movie to play
Movie_To_Play = "Movie"

class Scene_Movie
  def main
    movie=nil
    before_title_play_movie(movie)
    goto_title
  end
 
  def before_title_play_movie(movie)
    movie = Movie_To_Play
    Graphics.play_movie('Movies/' + movie) unless movie.empty?
  end
 
  def goto_title
    SceneManager.call(Scene_Title)
  end
 
  def update
  super
    cancel_options
  end

  def cancel_options
    if Input.press?(:C)
      goto_title
    end
  end
end


That's my full code. The movie keeps playing no matter what I press.

DoctorTodd

In that case I'm not sure. I highly doubt that this has any thing to do with it but wouldn't you add super after main?

Yin

No, there's no super class for main. (At least that's what rmvxa told me when I tried it :p)

Thanks for trying to help though. Maybe it's just a stupid limitation of rmvxa.

pacdiggity

The update method is not being called, mainly because Scene_Movie should have Scene_Base as its' superclass. Also you are overwriting 'main'. The update method is not being called, therefore the Input is not being checked, so it won't go to the title until the movie is over.
it's like a metaphor or something i don't know

Yin

Don't think I can overwrite main if it never existed in the class. I just added Scene_Base as the superclass and added the update call (That was a total facepalm moment for me)

My code now reads like this

# Name of movie to play
Movie_To_Play = "Movie"

class Scene_Movie < Scene_Base
  def main
    movie=nil
    before_title_play_movie(movie)
    goto_title
    update
  end
 
  def before_title_play_movie(movie)
    movie = Movie_To_Play
    Graphics.play_movie('Movies/' + movie) unless movie.empty?
    update
  end
 
  def goto_title
    SceneManager.call(Scene_Title)
  end
 
  def update
  super
    cancel_options
  end

  def cancel_options
    if Input.press?(:C)
      goto_title
    end
  end
end

#if Input.press?(:C)
# SceneManager.call(Scene_Title)
#end


Still doesn't work.

pacdiggity

main DOES exist. It's there. In the editor. In Scene_Base. Which is now the superclass of Scene_Movie. Which means it's in Scene_Movie.
There's a problem with this; while Graphics#play_movie is happening, the scene is not being updated. This might be fixed with this controversial method I just invented.
class << Graphics
  alias skip_plmovie play_movie
  def play_movie(*args)
    skip_plmovie(*args)
    SceneManager.scene.update if SceneManager.scene.exist?
  end
end

That might work. Not exactly sure how the play_movie method works.

EDIT:: No, that won't work. It'll only call update once the movie has finished.
Hrm...
it's like a metaphor or something i don't know

Yin

When I aliased main, it froze everything. I added a print in there and it was constantly printing (which means it was indeed updating I think) But it just wasn't playing the movie or recognizing my input.

Oh didn't see you edit the post  :P