Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Using the rmxp AVI script, please help

Well I want to put my own clips that I have made into my rmxp game but I sadly figured out the hard way that making each clip into frames is mind numbingly long and the images are to large (50mgb for 200 frames) and I got the script made by SoundSpawn (script provided below) but I cannot figure out how to use it even with the directions I keep getting errors or nothing happens at all can someone provide a example for me if possible and what events I use to call the movie. Thanks in advance.


class Scene_Movie
##Copy this into a new section of your game.
##To play a file, move the avi file into a "movies" subdirectory (yourgame\data,
##yourgame\graphics, yourgame\movies).
##Then call "Scene_Movie.new(filename)" where filename is your movies actual filename
## (minus the .avi). exp Scene_Movie.new("???")
## If you want to play multiple movies in a row
##(for example before the game starts, maybe a "developed by", "produced by", "intro movie"
## set or something... Go to the "main" section of code and find the line "$scene = Scene_Title.new".
##Just after that line add:
##CODE
##Scene_Movie.new("dev_by")
##Scene_Movie.new("pro_by")
##Scene_Movie.new("intro")
##$scene = Scene_Movie.new("intro",8,false)assuming the filename of the intro movie is "intro.avi" and it's 8 seconds long.
##class Scene_Movie
def initialize(movie)
@readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
@movie_name = Dir.getwd()+"\\Movies\\"+movie+".avi"
main
end

def main

game_name = "\0" * 256
@readini.call('Game','Title','',game_name,255,".\\Game.ini")
game_name.delete!("\0")
@wnd = Win32API.new('user32','FindWindowEx','%w(l,l,p,p)','L')
@temp = @wnd.call(0,0,nil,game_name).to_s
movie = Win32API.new('winmm','mciSendString','%w(p,p,l,l)','V')
movie.call("open \""+@movie_name+"\" alias FILE style 1073741824 parent " + @temp.to_s,0,0,0)
@message = Win32API.new('user32','SendMessage','%w(l,l,l,l)','V')

@detector = Win32API.new('user32','GetSystemMetrics','%w(l)','L')
@width = @detector.call(0)
if @width == 640
fullscreen
Graphics.update
sleep(1)
Graphics.update
sleep(1)
Graphics.update
sleep(1)
end

status = " " * 255
movie.call("play FILE",0,0,0)
loop do
sleep(0.1)
@message.call(@temp.to_i,11,0,0)
Graphics.update
@message.call(@temp.to_i,11,1,0)
Input.update
movie.call("status FILE mode",status,255,0)
true_status = status.unpack("aaaa")
if true_status.to_s != "play"
break
end
if Input.trigger?(Input::B)
Input.update
break
end
end
movie.call("close FILE",0,0,0)
bail
end

def bail
if @width == 640
fullscreen
end
end
end

def fullscreen()

$full.call(18,0,0,0)
$full.call(13,0,0,0)
$full.call(18,0,2,0)
$full.call(13,0,2,0)
end
$full = Win32API.new('user32','keybd_event','%w(l,l,l,l)','')
 
I have it in my game you can check it out.... Instructions are going to be hard to understand..... but the main thing to realize is that the Codec of the movie has to be a codec just about everyone has. Also you have to use "Scene_Movie('...')" [In Call Script] to call the movie.

Check out my game to see how it works. The file is unencrypted so you should able to figure it out. The event that calls the Movie is in Common Events under "Earth Granade" [Silly Name I know].

I'll help anyway I can.
 

Kraft

Sponsor

I too would like to know how to use this script.
I have it, but I cant get it to work... with Mpg, AVI, MP4... anything, I cant get it to work.

Before the title screen, or called by a script in the game.
Kraft
 
This could you your problem:
Code:
##class Scene_Movie

That's the 'object' the rest of the script of describing but '#' in script makes a comment and RMXP will ignore anything after it on the same line.
XD
 
I have no idea if there is a difference...but this one is working for me:
Code:
#================================
# .avi's in RMXP by Soundspawn
# (and I think edited by Popper)
#----------------------------------------------------------------
# Instructions                                                          
#================================
=begin
In the RPG Maker XP menu, go to Game > Open Game Folder
You'll see subfolders like Graphics and Data.  Make a new folder and call it 'Movies'.
Put your .avi movie files in that folder.  To play a movie in game, put:
    Scene_Movie.new("movie_name")
  where movie_name is the name of your .avi file WITHOUT the .avi part.
To make an intro/developed by/credits movie before your title screen, go to Main and put
    Scene_Movie.new("movie_name")
under $scene = Scene_Title.new
=end
class Scene_Movie

 def initialize(movie)
   @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
   @movie_name = Dir.getwd()+"\\Movies\\"+movie+".avi"
   main
 end
 
 def main

   game_name = "\0" * 256
   @readini.call('Game','Title','',game_name,255,".\\Game.ini")
   game_name.delete!("\0")
   @wnd = Win32API.new('user32','FindWindowEx','%w(l,l,p,p)','L')
   @temp = @wnd.call(0,0,nil,game_name).to_s
   movie = Win32API.new('winmm','mciSendString','%w(p,p,l,l)','V')
   movie.call("open \""+@movie_name+"\" alias FILE style 1073741824 parent " + @temp.to_s,0,0,0)
   @message = Win32API.new('user32','SendMessage','%w(l,l,l,l)','V')
   
   @detector = Win32API.new('user32','GetSystemMetrics','%w(l)','L')
   @width = @detector.call(0)
   if @width == 640
     fullscreen
     Graphics.update
     sleep(1)
     Graphics.update
     sleep(1)
     Graphics.update
     sleep(1)
   end
   
   status = " " * 255
   movie.call("play FILE",0,0,0)
   loop do
    sleep(0.1)
    @message.call(@temp.to_i,11,0,0)
    Graphics.update
    @message.call(@temp.to_i,11,1,0)
    Input.update
    movie.call("status FILE mode",status,255,0)
    true_status = status.unpack("aaaa")
    if true_status.to_s != "play"
      break
    end
    if Input.trigger?(Input::B)
      Input.update
      break
    end
   end
   movie.call("close FILE",0,0,0)
   bail
 end
 
 def bail
   if @width == 640
     fullscreen
   end
  end
end

def fullscreen()
 
 $full.call(18,0,0,0)
 $full.call(13,0,0,0)
 $full.call(18,0,2,0)
 $full.call(13,0,2,0)
end
$full = Win32API.new('user32','keybd_event','%w(l,l,l,l)','')
and there's a working demo at this french site:
http://cid6.over-blog.com/article-741054.html
Lemme know how this turns out for you guys.
 
Er, looks like there really a different between the first one and the second that posted by Tori, the first script didn't work for me, but the second is still don't work! but the second script givet he sound at least, but not the video, only sound, what happened?
 
Dude, last post was over 1 year ago...!! :dead:

News: STOP NECROPOSTING! Please check the date of the last post in a topic before replying.
Do not post in a topic that is over a month old. If this keeps occuring, we will begin to hand out automatic BANS. Thank you.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top