VX 스크립트



 스크립트
    
class Scene_Movie
##Copy this into a new section of your game.
##To play a file, move the avi file into a "movies" subdirectory (yourgamedata,
##yourgamegraphics, yourgamemovies).
##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")
##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 = "" * 256
   @readini.call('Game','Title','',game_name,255,".Game.ini")
   game_name.delete!("")
   @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)','')




위 스크립트를 저장한뒤에


게임 내 이벤트에 "이벤트" 항목을 이용해서

 Scene_Movie.new("example")

이 줄을 삽입하면 됩니다.

ex : TV앞에서 사용 키를 누르면 작동되는 이벤트 작성.


example 은 avi 파일 이름이며, 확장자는 없이 파일명만 들어가야 합니다.

ex:  news.avi        >>      Scene_Movie.new("news")


해당 avi 파일은

"게임프로젝트movies"  폴더에 들어가야 합니다.

"게임프로젝트"  폴더에 "data","graphics","movie" 세 폴더가 있어야 하는 것이죠.

물론 "게임프로젝트" 폴더는 어떤걸 말하는지 아시리라..-_-;;


게임 진행 도중에도 동영상 재생은 문제없이 가능하였고, 동영상 종료후에 게임으로 복귀도 지장없음.

연속으로 동영상 재생도 이벤트만 잘 손보면 문제없이 가능.





문제점

 1.  전체화면으로 게임중이라면 동영상 재생시 창모드로 줄어들어서 재생이 되고,
    
      재생이 끝나면 다시 전체화면으로 돌아감. 재생시 동영상 크기도 작은 수준이라 고화질 동영상은 무리로 보임
 
      (직접 해보시고 판단하세요. 게임을 창모드로 만들면 해상도 전환은 일어나지 않습니다.)


2.  특정 컴퓨터에서 스크립트 오류가 일어나는 상황이 있을 수 있음.

     아무 문제없이 재생되는사람도 있지만,  
 
     동영상 소리가 나지 않는다, 재생속도가 이상하다 등 문제가 발생한 사람도 있는듯 합니다.
 
     (물론 이것도 직접 해보시고 판단하세요.)



3. 게임 릴리즈시 동영상 재생이 안되는 컴퓨터가 있음.
     
    제가 직접 제작하고 인코딩한 동영상이 게임제작시, 릴리즈 테스트시에는 문제없이 작동.

    하지만 친구컴퓨터로 파일을 보낸뒤에 테스트해보니 동영상만 쏙 빼놓고 진행.  동영상 재생 시간동안 가만히 멈춰있음
.

    컴터 세대로만 테스트해본것이지만 변수가 있을 수 있음.

    코덱문제인가 싶어서, mpeg, vp60, vp70, ffdshow, divx, 무압축!!  등 전부 시도해봄.

    운영체제문제인가 싶어서 xp sp2, sp3, vista 32bit, windows2000  에서 전부 시도해봄.
 
    결론은 제작한 이 컴퓨터에서만 아무 문제 없이 재생됨.-_-;;

    RTP파일이 문제인가 싶어서 그것도 설치해봄...    

    무엇인가 문제인것 같지만 아직 못찾음..;;





    한가지 안해본 테스트는

    재생이 안되는 컴퓨터에서 RMVX를 깔아서 동영상을 넣은 게임을 제작해보는것

    ...혹시 테스트해주실분




스크립트 출처 :   http://rmvx.org
Comment '12'
  • ?
    작은악마 2008.07.07 22:05
    그것보다 저런거 찾는게 신기함;;;
  • ?
    클라우드 2008.07.10 23:47
    혹시 그래픽 카드에 문제가 있진 안을까요??
  • ?
    불로불사 2008.09.04 11:54

    퍼가요~

  • ?
    승진쿤 2008.10.16 14:13
    전 시작도 안하는데요
    avi파일만 돼는건가요?
  • ?
    승진쿤 2008.10.16 14:27
    게임 내 이벤트에 "이벤트" 항목을 이용해서
    가 무슨 말인지..;; 이벤트 내에 스크립트를 이용하라는 말인가요?
    그리고 movie인지 movies인지.. 둘중 뭐가 맞는건가요?(둘 다 써놓으셨길래..)
  • profile
    아방스 2009.01.05 18:05
    movies 가 맞습니다.
  • ?
    다크아머 2008.10.25 11:03
    좋은자료 감사하므니다.
  • profile
    아방스 2009.05.02 16:49
  • profile
    은색바람 2012.10.18 22:42
    이거 그대로 따라해도
    SyntaxError occurred while running script. 이렇게 나오는데.. 왜그러죠?
  • profile
    은색바람 2012.10.18 22:55
    아 이런 다시 scripte SyntaxError occurred while running script 이거 오류 풀어도
    그냥 무시되고 이벤트가 진행되네요..ㅠ
  • ?
    짱말 2010.02.28 13:09

    감사합니다.

     

  • ?
    짱말 2010.02.28 13:11

    ㄳㄳㄳㄳㄳㄳㄳㄳㄳㄳ