Help - Search - Members - Calendar
Full Version: Berka's Video script II reloaded !
RPG RPG Revolution Forums > Scripting > Script Tutorials > RGSS2
Pages: 1, 2
berka
Hi !

I've made a new movie's managment in rm.
It's more simple and add lots of settings:
volume managment, fullscreen mode, auto-detect file format...

puts this script above main and run the game first: a Videos directory will be created !
then add your videos files into.

and call the video with an event (call script) like this:

QUOTE
[film]
film = test.avi
aig = 999
bass = 0


the scripts:
[Show/Hide] rmvx&rmxp
CODE
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#                            -  Game_Film II - reloaded ^^
#  par berka
#                          www.rpgmakervx-fr.com                                          
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#  Rgss 1&2                  v 1.0
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#                          -Utilisation-
# écrivez dans un event, commande insérer un script:
#
# #minimum requis:
# [film]                # obligatoire !
# film = monfilm.avi    # ou mpg... nom du fichier à lire
#
# #configuration optionnelle, l'ordre n'est pas important
# mettre les 4 coordonnées sinon aucune !
# x = 12                # position horizontale
# y = 1                  # position verticale
# w = 150                # redimensionnement du film: largeur
# h = 150                # redimensionnement du film: hauteur
#
# full = true            # active (ou pas) le plein écran dans le mode fenetré
# vol = 750              # entre 0 et 1000 volume sonore du film
# bass = 999            # entre 0 et 1000 volume des basses: tres faible nuance
# aig = 250              # entre 0 et 1000 volume des aigus: tres faible nuance
# #commandes:
# bouton B pour quitter, C pour interrompre/reprendre la lecture
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# pourquoi un nouveau script de video ?
# simplement pour ne plus avoir à répondre à toutes ces questions sur la video !
# ce script est le plus simple possible: j'ai testé toutes les erreurs possibles
# l'appel est personalisable
# le format de la video est auto-détecté
# ajout du plein écran
# de la gestion du volume
# Un dossier Films est automatiquement créé dans votre projet.
# vous y déposez les vidéos à lire !
# Il vaut mieux prendre de petites videos: parce que les démos de 200 Mo...
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

class Game_Film
  def initialize(hash)
    hash.has_key?(:film) ? film=hash[:film] : return
    hash.has_key?(:x) ? @x=hash[:x]+" " : @x="0"
    hash.has_key?(:y) ? @y=hash[:y]+" " : @y="0"
    hash.has_key?(:w) ? @w=hash[:w]+" " : @w=""
    hash.has_key?(:h) ? @h=hash[:h]+" " : @h=""
    hash.has_key?(:vol) ? @vol=hash[:vol]+" " : @vol="1000"
    hash.has_key?(:bass) ? @bass=hash[:bass]+" " : @bass="1000"
    hash.has_key?(:aig) ? @aig=hash[:aig]+" " : @aig="1000"
    hash.has_key?(:pos) ? @pos="at pos #{hash[:pos].to_i*1000} " : @pos="at pos 0 "
    @full=hash[:full] if hash.has_key?(:full)
    @full&&dim_ecran !=[640,480] ? @plee="fullscreen " : @plee=""
    @type=" "
    @type=" type mpegvideo" if File.extname(film)==(".mpg"||".mpeg")
    @type=" type avivideo" if File.extname(film)==".avi"
    @nom='./Films/'+film
    (p "fichier #{@nom} non trouvé";return) if !FileTest.exist?(@nom)
    @film=Win32API.new('winmm','mciSendString','ppll','v')
    lecture
  end
  def handle
    jeu="\0"*256
    ini=Win32API.new('kernel32','GetPrivateProfileStringA','pppplp', 'l')
    ini.call('Game','Title','',jeu,255,".\\Game.ini")
    return Win32API.new('user32','FindWindowEx','llpp','l').call(0,0,nil,jeu.delete!("\0"))
  end
  def lecture
    v,t,status,pause=version,Time.now," "*255,false
    @film.call("open #{@nom} alias FILE#{@type} style child parent "+handle.to_s,0,0,0)
    @film.call("put FILE window at #{@x}#{@y}#{@w}#{@h}",status,255,0)
    @film.call("setaudio File volume to #{@vol}",status,255,0)
    @film.call("setaudio File bass to #{@bass}",status,255,0)
    @film.call("setaudio File trebble to #{@bass}",status,255,0)
    @film.call("play FILE #{@plee} notify",status,255,handle)
    loop{sleep(0.1)
      Input.update
      @film.call("status FILE mode notify",status,255,0)
      break if status.unpack("aaaa")=="stop".split(//)||Input.trigger?(Input::B)
      if Input.trigger?(Input::C)
        if !pause;@film.call("pause FILE notify",status,255,handle);pause=true
        else;@film.call("play FILE #{@plee} notify",status,255,handle);pause=false
        end      
      end
      (t=maj(t))if v=='xp'}
    @film.call("close FILE notify",0,0,handle)
    $scene=Scene_Map.new
  end
  def dim_ecran
    lw=Win32API.new('user32','GetSystemMetrics','i','i')
    return lw.call(0),lw.call(1)
  end
  def maj(t)
    (Graphics.update;return Time.now)if t.sec<=Time.now.sec-9||t.min !=Time.now.min
    return t
  end
  def version;FileTest.exist?('./Data/scripts.rvdata') ? 'vx': 'xp';end
end
Dir.open("./Films") rescue Dir::mkdir("./Films",0777)
class Game_Interpreter;def eval(script);cmd_eval(script);end;end#rmvx
class Interpreter;def eval(script);cmd_eval(script);end;end#rmxp
def cmd_eval(script)
  if script.include?("[film]")
    hash={}
    script.gsub!("[film]"){}
    list=script.split("\n")
    list.each{|e|e.gsub!(" "){};f=e.split("=");hash[f[0].to_sym]=f[1] if !f[1].nil?}
    Game_Film.new(hash)
  else;return Kernel.eval(script)
  end
end


the demo

enjoy !

Caution:
this script is totally free of use, but I need an apparent credit in your game and:

Do not post these scripts anywhere without my permission !
paladin99706
Hmm.. interesting.... I'll give it a try. wink.gif
dandanthedan
wow! ill give it a try...although im using trebor's avi player at the moment i think ill give it a try...happy.gif
berka
I'll provide you a demo !
omegazion
wow berka, you make video scripts sound so easy to make. Amazing work. (LOL, overriding the eval method, that's sexy)
Mickadell
Comment
Rate: Good

You have done a good job. It will be useful when I find something
for to put on the game. Mostly likely anime. Thats the closest to my game.
Not real life. But still very well done.
berka
thanks !

suggestions for improving this script are welcomed !
kamster94
can u write how to call video from Main Menu (Scene_Title)? pls
berka
well...
you can transfer the player in an empty map which contains a video launcher event.
and when the video finishes, you call back the title thanks to the event command.
Genshyu
Tried your chara gen.. AWESOME DUDE. Very nice biggrin.gif.
dezet
thank you so much
SojaBird
Very nice,
Perhaps you could add a function so that you can add a border around the player tongue.gif


Anyway,
Nice.



Greatzz,
SojaBird.
berka
QUOTE (Genshyu @ Jan 21 2009, 12:11 AM) *
Tried your chara gen.. AWESOME DUDE. Very nice biggrin.gif.

You mean The ASA Heroes Creator ?
sweat.gif

Pim321:
What kinda border ? black bord like 16:9' ?
SojaBird
Well you know, like the vid is playing on a tv screen biggrin.gif That should be fun. (Could be done with show picture though).

Anyway,
Pure cool coding you've done so far biggrin.gif


Greatzz,
SojaBird.
berka
all right ! it is not possible since the video is played in a new transpearent window...which is "childed" (?) with the rgss player... the rgss player is set to the background and his handle is deactivated
luciferx
Nice Script... But when i try implemented on RMXP(with RMXP Script) It has error on the middle of the movie.....

is anyone has tries on RMXP...?? Please try it....
onidsouza
Hey SUPER ULTRA VERY NICE MEGA COOL SCRIPT! and works perfectly! Nice Work!
I CERTANLY WILL USE THIS IN MY GAME!
Thaks!
onidsouza
One thing about your script, once the video stops playing, my game window minimizes. Why? Can you fix that? I can't cuz i am BAD in the Win32API

EDIT: This when the game (not the video) is in full screenmode. When in windowed mode it works fine
berka
yeah... maybe it's a focus issue... i'll fix it !
aznguy212
oni please use edit your post and do not double post...it gets very annoying for some and its against the rules in almost every forum...
onidsouza
Ok i will stop doing doble posting happy.gif
berka
new version:

window's hangup resolved and code cleaned !

regards,
berka
onidsouza
QUOTE (berka @ Feb 7 2009, 08:26 PM) *
new version:

window's hangup resolved and code cleaned !

regards,
berka


Thanks! It's a lot better now!
oioioi
QUOTE (onidsouza @ Feb 8 2009, 09:10 PM) *
QUOTE (berka @ Feb 7 2009, 08:26 PM) *
new version:

window's hangup resolved and code cleaned !

regards,
berka


Thanks! It's a lot better now!



umm.....excoose me, where's the new one? I thought it'll fix the minimizing windows problem? unsure.gif
Traumatized
This script works for me but the problem is i got no sound (volume is set to 750, but i can hear game back ground music while the video is playing) and it plays the video in super fast speed as if it is fast forwarding...whats going on?
Tsutanai
Is there a way to play this before the title screen??? Like an intro.
kunitaj
this is so impressive it made me shriek.
But the mpgs did not play correctly.
mortigneous
hmm... I was looking for one of these
everyone i saw had random amounts of problems
hopefully this one works well (started scrapping the idea of using movies lol)

*SNAG [with credit of course]*
Traumatized
Can someone tell me why my video is not playing right? it got no sound and it is playing in fast forward speed.
I got the video in mp4 format and i convert it to avi then i use it to play but wont work...
may be my video converter is mess up...does anyone know any free program that lets me convert mp4 to avi?
Midnight Assassin
QUOTE (aznguy212 @ Jan 29 2009, 02:49 AM) *
oni please use edit your post and do not double post...it gets very annoying for some and its against the rules in almost every forum...


Where's your Moderator position, Aznguy? Oh, that's right - you have none. Please do not backseat moderate. We have Moderators and Administrators for that. However I do agree with you.

@Traumatised, I don't think you've heard of it, but there's this new thing called Google. Why don't you try it?

@Kunitaj, the video needs to be in an .avi format. .mpg/.mpeg will not work with an .avi player. It's common sense...

@Tsutanai, use Woratana's 'Skip Tite Screen' script and mod it so the character ends up on a blank map with an Autorun video call. After the video is done, put in the event command "Return To Title Screen". I have not tried it, but this should work with a bit of logic. I'll test it as soon as I've got the script down-pat.
If said method doesn't work, there's always the RGSS2 script requests forum.

@Oioioi, can you please use proper grammar/spelling and specify what you mean? Don't expect any help so quick with such a vague request.

@Berka, this is a great, simple alternative to Ariel's and Trebor's scripts. I just love it when I see a script of yours released and used! *flails* Continue the top-quality works, and I look forward to experimenting with this script.
zeshiba
Hey berka how do I make this compatible in battles like summoning a beast.
I use common events.
xerious
for the minimize problem i found a solution:

use this script

scaled window mode

set it up to the max resolution of your screen

then
Berka's Movie script II reloaded

!!don't start the game in fullscreen!!

laugh.gif
Bandito
dude the problem with this is that not everybody has the same resolution as your monitor so if you for example make your resolution 1650 x 1200 like me then my sister won't be able to play the game because he computer can only go 1024 x 800.
aggiegwyn
QUOTE (berka @ Jan 16 2009, 03:39 PM) *
Hi !

I've made a new movie's managment in rm.
It's more simple and add lots of settings:
volume managment, fullscreen mode, auto-detect file format...

puts this script above main and run the game first: a Videos directory will be created !
then add your videos files into.

and call the video with an event (call script) like this:

QUOTE
[film]
film = test.avi
aig = 999
bass = 0


the scripts:
[Show/Hide] rmvx&rmxp
CODE
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#                            -  Game_Film II - reloaded ^^
#  par berka
#                          www.rpgmakervx-fr.com                                          
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#  Rgss 1&2                  v 1.0
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#                          -Utilisation-
# �crivez dans un event, commande ins�rer un script:
#
# #minimum requis:
# [film]                # obligatoire !
# film = monfilm.avi    # ou mpg... nom du fichier � lire
#
# #configuration optionnelle, l'ordre n'est pas important
# mettre les 4 coordonn�es sinon aucune !
# x = 12                # position horizontale
# y = 1                  # position verticale
# w = 150                # redimensionnement du film: largeur
# h = 150                # redimensionnement du film: hauteur
#
# full = true            # active (ou pas) le plein �cran dans le mode fenetr�
# vol = 750              # entre 0 et 1000 volume sonore du film
# bass = 999            # entre 0 et 1000 volume des basses: tres faible nuance
# aig = 250              # entre 0 et 1000 volume des aigus: tres faible nuance
# #commandes:
# bouton B pour quitter, C pour interrompre/reprendre la lecture
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# pourquoi un nouveau script de video ?
# simplement pour ne plus avoir � r�pondre � toutes ces questions sur la video !
# ce script est le plus simple possible: j'ai test� toutes les erreurs possibles
# l'appel est personalisable
# le format de la video est auto-d�tect�
# ajout du plein �cran
# de la gestion du volume
# Un dossier Films est automatiquement cr�� dans votre projet.
# vous y d�posez les vid�os � lire !
# Il vaut mieux prendre de petites videos: parce que les d�mos de 200 Mo...
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

class Game_Film
  def initialize(hash)
    hash.has_key?(:film) ? film=hash[:film] : return
    hash.has_key?(:x) ? @x=hash[:x]+" " : @x="0"
    hash.has_key?(:y) ? @y=hash[:y]+" " : @y="0"
    hash.has_key?(:w) ? @w=hash[:w]+" " : @w=""
    hash.has_key?(:h) ? @h=hash[:h]+" " : @h=""
    hash.has_key?(:vol) ? @vol=hash[:vol]+" " : @vol="1000"
    hash.has_key?(:bass) ? @bass=hash[:bass]+" " : @bass="1000"
    hash.has_key?(:aig) ? @aig=hash[:aig]+" " : @aig="1000"
    hash.has_key?(:pos) ? @pos="at pos #{hash[:pos].to_i*1000} " : @pos="at pos 0 "
    @full=hash[:full] if hash.has_key?(:full)
    @full&&dim_ecran !=[640,480] ? @plee="fullscreen " : @plee=""
    @type=" "
    @type=" type mpegvideo" if File.extname(film)==(".mpg"||".mpeg")
    @type=" type avivideo" if File.extname(film)==".avi"
    @nom='./Films/'+film
    (p "fichier #{@nom} non trouv�";return) if !FileTest.exist?(@nom)
    @film=Win32API.new('winmm','mciSendString','ppll','v')
    lecture
  end
  def handle
    jeu="\0"*256
    ini=Win32API.new('kernel32','GetPrivateProfileStringA','pppplp', 'l')
    ini.call('Game','Title','',jeu,255,".\\Game.ini")
    return Win32API.new('user32','FindWindowEx','llpp','l').call(0,0,nil,jeu.delete!("\0"))
  end
  def lecture
    v,t,status,pause=version,Time.now," "*255,false
    @film.call("open #{@nom} alias FILE#{@type} style child parent "+handle.to_s,0,0,0)
    @film.call("put FILE window at #{@x}#{@y}#{@w}#{@h}",status,255,0)
    @film.call("setaudio File volume to #{@vol}",status,255,0)
    @film.call("setaudio File bass to #{@bass}",status,255,0)
    @film.call("setaudio File trebble to #{@bass}",status,255,0)
    @film.call("play FILE #{@plee} notify",status,255,handle)
    loop{sleep(0.1)
      Input.update
      @film.call("status FILE mode notify",status,255,0)
      break if status.unpack("aaaa")=="stop".split(//)||Input.trigger?(Input::B)
      if Input.trigger?(Input::C)
        if !pause;@film.call("pause FILE notify",status,255,handle);pause=true
        else;@film.call("play FILE #{@plee} notify",status,255,handle);pause=false
        end      
      end
      (t=maj(t))if v=='xp'}
    @film.call("close FILE notify",0,0,handle)
    $scene=Scene_Map.new
  end
  def dim_ecran
    lw=Win32API.new('user32','GetSystemMetrics','i','i')
    return lw.call(0),lw.call(1)
  end
  def maj(t)
    (Graphics.update;return Time.now)if t.sec<=Time.now.sec-9||t.min !=Time.now.min
    return t
  end
  def version;FileTest.exist?('./Data/scripts.rvdata') ? 'vx': 'xp';end
end
Dir.open("./Films") rescue Dir::mkdir("./Films",0777)
class Game_Interpreter;def eval(script);cmd_eval(script);end;end#rmvx
class Interpreter;def eval(script);cmd_eval(script);end;end#rmxp
def cmd_eval(script)
  if script.include?("[film]")
    hash={}
    script.gsub!("[film]"){}
    list=script.split("\n")
    list.each{|e|e.gsub!(" "){};f=e.split("=");hash[f[0].to_sym]=f[1] if !f[1].nil?}
    Game_Film.new(hash)
  else;return Kernel.eval(script)
  end
end


the demo

enjoy !

Caution:
this script is totally free of use, but I need an apparent credit in your game and:

Do not post these scripts anywhere without my permission !

where is the main?
wallywest07
Okay this is what i've done,copy my movie into the films folder,rename the script but there's an error.
the error is :fichier./Films/modulasas.avi(my video) non trouve.
wallywest07
QUOTE (wallywest07 @ Sep 10 2009, 06:08 AM) *
Okay this is what i've done,copy my movie into the films folder,rename the script but there's an error.

dricc
QUOTE (wallywest07 @ Sep 9 2009, 03:28 PM) *
QUOTE (wallywest07 @ Sep 10 2009, 06:08 AM) *
Okay this is what i've done,copy my movie into the films folder,rename the script but there's an error.




It means "file./Films/modulasas.avi(my video) not found. "
Check that your video is in the correct directory ...
PnP
This is a really nice script and I would absolutely love to use it. Unfortunately, when I use the ORBS battle system script, the video won't appear if it's not on full screen. Is there a way to make them more compatible with each other? If not, I can understand.

Edit: For some reason, it works fine now. But now Woratana's Character Text Box script stopped working with this script. Is there a way to fix that?
wallywest07
OK here's what I've done.Before my computer was formatted i can play the video.
Now after reformatting it only shows a blank black screen without the video.
i've installed klite codec pack 4.9 and nothing changes.

The Demo version video can be played.What should i do?
megamario
I Tried it and it makes my game freeze for about 3 seconds. No Video Shows up! Did i do something wrong?

EDIT: Nevermind, I acidently Played a Audio File laugh.gif
Mefisno
Hey I was wondering is there a way to use this script in battles?
I have a movie clip thing i'd like to use for a summon and when you cast the spell a common event then calls the script this bit works fine but after the clip ends the battle just closes down and the game continues.
Could anyone help?

EDIT

never mind I just got rid of the line
$scene=Scene_Map.new
and it now works in battle
DarkSarul
O..M..G.. IT ACTUALLY WORKS LOL SWEEET YOU ARE AWESOMENESS! thank you and great job!
arokalot
I'm new to this site, but I've been hanging around looking at scripts and other information. I just wanted to say nice work on this movie script. I've been looking for one of these. I only have found 1 issue so far....not so much a issue more like preference. Is there anyway to keep the picture quality while having the video play in full-screen?...not sure if that would be a script fix....or the video it self.
Kread-EX
Yeah, you can't really do anything about that. Fullscreen mode just stretches the display, so depending of the initial quality of your video, the result will be more or less pixelated.
arokalot
Thank you, I'll test a few things out and post back back if I find some good results.
Pharonix
I really hate necroing but I really need the help while I wait for a reply from Berka.

I put this into my project and now, any event that contains a script call runs an incompatibility with this script.

Is there any way to fix this?



Sorry for necro
-prepares for warning-
Zin Zero
I'm actually having the same issue as Pharonix, it's preventing many of the KGC scripts from working when I put a script into an event. Just keeps going on about compatibility. Any way to fix this would be appreciated. Obviously not only by me. Thank you laugh.gif
andyvrc [$]
can i use the another format except .avi ??

like 3gp,mp4,wmv,etc ?? for this script ?? ohmy.gif
berka
Hi,

What are the scripts you want to use with my script ? Indeed, I have rewritten several methods of the events interpreter such as Interpreter#eval.

@andyvrc: I have not tested all the video format. I recommend you to use the avi format, since it's uncompressed. No problem with mpeg too.

Regards,

Berka
Zin Zero
Okay, well specifically I'm using the KGC_LargeParty script but when I call any of the script commands up, it says:

NoMethodError occured while running script.
undefined method 'fix_actor' for Kernel:Module

It's doing this with most of the KGC scripts so I'm unable to utilize the fact that I need the main character must stay in the party for the story without messing up the party formation for events.
Event scripts like this work however: $scene = Scene_EquipmentUpgradeShop.new
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.