RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
RPG Maker XP... Movie... Need Help!

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 89
Hey guys.

I used to have some knowledge bout Java and other programming languages but can't fix this.

I want to play a movie/flash movie/picture BEFORE the title screen.

How I gonna do that?

Supervisor... For the real small things... and the finest stuff...
www.rpgs.nl
Woodcutting Xtreme: 94% Stuck on Error

****
Rep:
Level 89
Currently there is no compatibility in RMXP that allows you to play .fla files or .gif files in the program.

However there is a script that allows you to play .avi file within the game itself, but has a few bugs here and there and really hasn't been thoroughly investigated for validity.

---------------------------------------------------
Script Credit goes to Soundspawn
DEMO: HERE
---------------------------------------------------

Code: [Select]

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)','')


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).

all right, not much has changed here, but it's actually a pretty big deal, so I'm cropping out all that older stuff. To call the script now (you may have just read it above too) just call "Scene_Movie("movie_name")" WITHOUT "$scene = " before it. This will retain the "scene" and the game will just return to the portion of code it left off at when the movie is done. With this seemingly small change, you can now play movies inside battles, or anywhere else. 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: [Select]

Scene_Movie.new("dev_by")
Scene_Movie.new("pro_by")
Scene_Movie.new("intro")


This assumes your movies are "dev_by.avi" for your developed by movie, "pro_by.avi" for your producers movie, and "intro.avi" for your intro movie. Just change those to be the correct filenames and you're set.

To call a movie during a battle, there's actually multiple ways. If you can trap the spot you want the movie (for example through a trigger in the Monster Group tab) just call script "Scene_Movie("moviename")" and you're set. It will play the movie, then return to where the battle left off.

This should also work with CBS', as long as you can trap the spot you want the movie to play. My best advice for trapping spots in code is to type

Code: [Select]

print "HEY"


in the code, then when you play, a windows-style popup box will show up when it hits that line. If that's where you want the movie, replace it with the "Scene_Movie.new" line.

To call the movie from an event (for example, everytime you talk to a certain person, a movie plays) make the event, set it's Trigger to "action key" and for the event commands, use call script (last page, bottom right) and type "Scene_Movie.new("moviename")".

--------------------------------------------------------------
FAQ:


1) Can this play wmv/mpg/whatever format files?

If you modify the line

Code: [Select]

@movie_name = Dir.getwd()+"\\Movies\\"+movie+".avi"


to end with ".wmv"/".mpg"/whatever. If the movies are original though, just save them as avis. You can use any codec you want with most formats, I use windows media player 9 encoding on my avis, making them just BARELY larger than wmvs, and it doesn't step on any EULA toes (WMV is the devil).

2) What codec should I use?
In the past the only video codec known NOT to work is an old Divx codec... so if you want to use divx, just make sure you are using the newest codec. If you want something compatible with every windows computer, use Windows Media Player 9 (or 10 if that's out now). As for audio, choose any MP3 codec.

3) Are their any known bugs?
Yes, first off if you are playing in fullscreen mode the movie will actually pull you out of fullscreen before it plays, then return you to fullscreen mode after it completes. This has to do with the workaround I had to do in order to eliminate flicker in the movies.
The biggest bug (and most easially avoidable) only applies if you are running windowed mode with 640x480 resolution. You should know if this is the case, because the game window won't fully fit on your screen (games screen is 640x480, plus the border around the screen and the titlebar make it too big for that resolution). If this is the case, you're going to see some funky stuff... It'll shoot INTO fullscreen mode, play the movie with flicker, and spit you back into windowed mode when the movie is over... Just up your resolution.

4) Can I call this script from anywhere in my game?
Sure can. You can use events (common or not) as well as actual code to play the movie... If using an event, go to the third page of event buttons (you know, three tabs full of labeled buttons...) and click on "Call Script". A text box will appear where you can type Ruby code. Type the code as was described above.
If you want to call it from actual code, just figure out WHERE in your code it needs called from (I recommend inserting pring "HEY" to test). When you find the place, same story.[/b]


Ref: http://www.rmxp.net/forums/index.php?showtopic=12952&hl=\.avi

**
Rep: +0/-0Level 89
I love you :p that will do

Supervisor... For the real small things... and the finest stuff...
www.rpgs.nl
Woodcutting Xtreme: 94% Stuck on Error

***
Rep:
Level 89
who want to play worms 4
i got a little problem there is an name error
......___|__
__/******\=======#
|**M1A2 ***:\
(@=@=@=@=@)

copy this tank and we wil concer the world

http://www.nintendo-europe.com/NOE/nl/NL/register/index.jsp?m=l&a=robot797
klik this link and give me stars

**
Rep: +0/-0Level 89
Currently there is no compatibility in RMXP that allows you to play .fla files or .gif files in the program.

However there is a script that allows you to play .avi file within the game itself, but has a few bugs here and there and really hasn't been thoroughly investigated for validity.

---------------------------------------------------
 Its .swf lol ( im an action scripter)
I AM CANADIAN

**
Rep: +0/-0Level 90
it keeps saying im getting a syntax error how do i fix thaat??