Cần giúp gấp : Chèn film vào RPGXP

bangchukieuphong

Donkey Kong
Tham gia ngày
10/10/04
Bài viết
310
Reaction score
2
Bác nào biết cách chèn film vào RPGXP chỉ cho tui nhé. Đang cần gấp lắm
Cảm ơn rất nhiều
 
Cảm ơn bác rất nhiều. Tôi sẽ thử xem sao. Nhân tiện bác cho hỏi luôn có thể nhập nhiều chipset nhỏ để tạo ra 1 chipset lớn không? Hoặc làm thế nào để vẽ chipset được?
 
@Bangchukieuphong (Nam Mộ Dung - Bắc Kiều Phong ) : hoàn toàn có thể thực hiện được.Ông làm cách như sau :
1.http://img275.echo.cx/img275/9118/tileset256x10247gm.png download về máy
2.Dùng Photoshop mở các chipset muốn gộp
3.Copy và paste theo đúng kích thước trong hình.
4.khử màu và save lại.

Chúc ông may mắn.
 
Ủa tui không hiểu lắm. Cái hình của bác nó bé tí à, làm sao copy hết được các chipse chứ?.
Với lại khử màu như thế nào? Khử màu gì?
 
chip trong RPGXP hình như là 32*32, mình coi như là 1 filmstrip dùng CT như GIF Movie Gear tách từng hình có kích cỡ 32*32, copy , tạo file mới paste dô, nếu chiều ngang có 5 hình thì kíck cỡ là 32*5,... thích hình nèo copy dô tạo chip mới, vẽ chip thì xài CT vẽ chip chuyên dụng ấy, xài photoshop tui ko biết làm. còn CT nào thì cũng ko biết nốt. nhưng có lẽ có :D :D
 
Rất tiếc là không có CT vẽ chuyên nghiệp cho Rpg maker Xp đâu bạn ạ! Khử màu thực ra là làm cho hình mềm mại và màu sắc đẹp hơn thôi! Chỉ cần thấy đẹp là xong! 32x32 là một ô thôi!
 
ko phải vẽ chuyên dụng cho RPGXP mà CT chuyên vẽ chip, tex, hình như cũng nhìu lắm, ở ko kiếm đi :D :D
 
Sao cái scrip của bác Vo_dich, khi chạy xong film là nó bay ra ngoài Win luôn, phải nhấn vào Taskbar ở dưới mới quay lại game được? Bác nào biết sửa cái lỗi này không?
 
phần main replace = cái nì
Mã:
#==============================================================================
# ■ Main
#------------------------------------------------------------------------------
#  各クラスの定義が終わった後、ここから実際の処理が始まります。
#==============================================================================

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

begin
 
   # FOLLOWING IS AN API CALL TO ALT+ENTER (GO INTO OR OUT OF FULLSCREEN)
 $full = Win32API.new('user32','keybd_event','%w(l,l,l,l)','')  
 
 $fog_opacity = 0
 $fog_opacity_duration = 0
 $fog_opacity_target = 0
 $fog_override_opacity = 0
 $fog_override_tone = Tone.new(0,0,0,0)
 $fog_sx = 0
 $fog_sy = 0
 
 $outdoors = Tone.new(0,0,0,0)
  
  # Change the $fontface variable to change the font style
  $fontface = ".VnTime"
  # Change the $fontsize variable to change the font size
  $fontsize = 24
  # トランジション準備
  Graphics.freeze
  # シーンオブジェクト (タイトル画面) を作成
  $scene = Scene_Title.new
  # $scene が有効な限り main メソッドを呼び出す
  while $scene != nil
    $scene.main
  end
  # フェードアウト
  Graphics.transition(20)
rescue Errno::ENOENT
  # 例外 Errno::ENOENT を補足
  # ファイルがオープンできなかった場合、メッセージを表示して終了する
  filename = $!.message.sub("No such file or directory - ", "")
  print("File #{filename} was not found.")
end
script movie sửa thành

Mã:
class Scene_Movie

 def initialize(movie,length,x=0,y=0,x2=640,y2=480)
   @movie_name = Dir.getwd()+"\\movies\\"+movie+".mpg"
   @counter = length
 end
 
 def main
   Graphics.transition
   @wnd = Win32API.new('user32','FindWindowEx','%w(l,l,p,p)','L')
   @temp = @wnd.call(0,0,nil,"MovieTest").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
   
   @movie.call("play FILE",0,0,0)
   loop do
     sleep(1)
     @message.call(@temp.to_i,11,0,0)
     Graphics.update
     @message.call(@temp.to_i,11,1,0)
     Input.update
     if Input.trigger?(Input::B)
       break
     end
     @counter = @counter - 1
     if @counter <= 0
       break
     end
   end
   @movie.call("close FILE",0,0,0)
   $scene = Scene_Map.new
   Graphics.freeze
   if @width == 640
     fullscreen
   end
 end
end
 
Script lỗi rồi! Khi test thì chưa kịp thấy cái movie mặt mũi ra sao thì nó đã tắt rồi! Với lại nó không chỉ tắt movie mà nó còn tắt cả Game luôn! Ông xem lại đi!
 
có bỏ file RGSS100J.dll vô thư mục game chưa, ko bỏ vô nó crash
 
Có bỏ rồi nhưng tình trạng nó vẫn như cũ bác à. Sau khi hết movie là nó bay ra win luôn, phải nhấn vào Icon ở Taskbar để bật lại game.
Một điều lạ nữa là tôi chạy "game.exe" ở trong thư mục "movietest" thì nó có film, còn chạy Shortcut của nó ở ngoài Desktop thì lại không có film.?? (tôi test bằng cái "movietest" bác up lên hồi trước)
 
Một điều lạ nữa là tôi chạy "game.exe" ở trong thư mục "movietest" thì nó có film, còn chạy Shortcut của nó ở ngoài Desktop thì lại không có film.?? (tôi test bằng cái "movietest" bác up lên hồi trước)
xem lại trong shortcut, xem trong properties, phần start in phải có đường dẫn đúng mới có phim,

Bác cho hỏi tiếp : Tôi đã thử chèn film theo kiểu của bác Vo_Dich nhưng sao film nó ra bé bé một góc chứ không fullscreen à? (Mặc dù màn hình là fullscreen nhưng film nó ở nhõn góc bên trái)
mặc định độ phân giải của RPGXP là 640*480, phim bé bé như bạn nói là phim nó ko thể tự stretch, cách giải quyết đơn giản thui, xài 1 CT stretch phim ra độ phân giải là 640*480.

Sau khi hết movie là nó bay ra win luôn, phải nhấn vào Icon ở Taskbar để bật lại game.
thay movie script mới này nhé. script này bạn khỏi phải để tâm đến việc chỉnh game title, tự nó read file Game.ini trong thư mục game. Lúc trước tôi có bảo replace script trong main nhưng bây giờ xài script movie này thì khỏi nhé, để main như cũ thui.
Nhớ phải có file RGSS100J.dll trong thư mục nhé, nếu ko nó crash đấy.

Mã:
class Scene_Movie

 def initialize(movie,length)
   #=========================
   @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
   #=========================
   @movie_name = Dir.getwd()+"\\Movies\\"+movie+".mpg"
   @counter = length
 end
 
 def main
   
    #===============================================
   game_name = "\0" * 256
   @readini.call('Game','Title','',game_name,255,".\\Game.ini")
   game_name.delete!("\0")
   #================================================
   
   Graphics.transition
   @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)
   @movie.call("play FILE",0,0,0)
   loop do
     Graphics.update
     sleep(1)
 Input.update
     if Input.trigger?(Input::B)
       break
     end
       @counter = @counter - 1
     if @counter == 0
       break
     end
        end
   @movie.call("stop FILE",0,0,0)
   $scene = Scene_Map.new
   Graphics.freeze
 end     
end
========================================

Help, sao ko ai trả lời em hết vậy, hu hu, mà cho hỏi lun cái cách làm thời gian ngày tháng năm gì đó hồi đó có người hướng dẫn mà bi giờ wăn đâu mất bịt rùi, có ai thấy nó ko?
đây là script thời gian, ngày tháng năm.
tạo 1 script mới copy và paste cái nì vào

Mã:
class Game_Time

attr_accessor :minute_length

def initialize
 @minute_length=2.0      #độ dài của 1 phút, tính = giây, ở đây là 2 giây thực = 1 phút trong game
 @hour_length= 60.0      # 1 giờ trong game = 60 phút trong game :D :D
 @day_length=24.0        # 1 ngày trong game = 24 giờ trong game :D :D
 @month_length=30.0     # 1 tháng trong game = 30 ngày trong game :D :D
 @year_length=12.0       # 1 năm trong game = 12 tháng trong game :D :D
 @minutes=0                 
 start_minute=50      # phút bắt đầu game 
 add_minutes(start_minute)
 start_hour=12          # giờ bắt đầu game 
 add_hours(start_hour)
 start_day=24                 #ngày bắt đầu game 
 add_days(start_day)
 start_month=3              #tháng bắt đầu game 
 add_months(start_month-1)
 start_year=2005              # năm bắt đầu game
 add_years(start_year)
end

def add_minutes(minutes)
 @minutes +=minutes
end

def add_hours(hours)
 @minutes +=hours*@hour_length
end

def add_days(days)
 @minutes += days*@hour_length*@day_length
end

def add_months(months)
 @minutes +=months * @hour_length*@day_length*@month_length
end

def add_years(years)
 @minutes += years * @hour_length*@day_length*@month_length * @year_length
end
 

def get_year
  minutes=get_total_minutes
  year=minutes / @hour_length / @day_length / @month_length  / @year_length
  return year
end
 
def get_month
  minutes=get_total_minutes
  month=minutes / @hour_length / @day_length /  @month_length % @year_length + 1
  return month
end
 
def get_day
  minutes=get_total_minutes
  day=minutes / @hour_length / @day_length % @month_length
  return day
end  
 
def get_hour
  minutes=get_total_minutes
  hour=minutes / @hour_length % @day_length
  return hour
end
 
def get_total_minutes
  total_sec=Graphics.frame_count / Graphics.frame_rate
  minute=(total_sec/@minute_length+@minutes)
  return minute
end

def get_minute
 minutes=get_total_minutes % @hour_length
 return minutes
end

def get_tone
 period_length=Math::PI*(get_hour / @day_length)
 red_shift=  -100+ 115*Math.sin(period_length)
 green_shift=  -140+ 155*Math.sin(period_length)
 blue_shift=  -150+ 165*Math.sin(period_length)
 return Tone.new(red_shift, green_shift, blue_shift, 0)
end

end # of class Game_Time

còn để in ra màn hình thì xài script này, cái này tui dùng in ra trong Menu, ai mún in ra ở chỗ khác thì thay class nha.

Mã:
class Window_PlayTimePlus < Window_Base

def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = 18
refresh
end

def refresh
  self.contents.clear
  @total_sec = Graphics.frame_count / Graphics.frame_rate
  @minute=$game_time.get_minute.floor
  hour = $game_time.get_hour
  pm_flag= hour >=12 ? true : false
  hour= hour >= 12 ? hour-12 : hour
  day=$game_time.get_day
  month=$game_time.get_month
  year=$game_time.get_year
  if hour.floor==0
    text=sprintf("%02d:%02d",12,@minute)
  else
    text=sprintf("%02d:%02d",hour,@minute)
  end
  if pm_flag
    text += " PM"
  else
    text += " AM"
  end
  self.contents.font.color = normal_color
  self.contents.draw_text(4, 0, 120, 32, text, 2)
  text = sprintf("%02d-%02d-%02d", month, day, year)
  self.contents.font.color=system_color
  self.contents.draw_text(4,10,120,32,text, 2)
end


def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
 
Ổn hết rồi, bác Vo_Dich Vô Địch :D
À bác có cách nào cho nó tự động fullscreen luôn mà không cần phải nhấn Alt_Enter không?
 
thay main = script na`y
Mã:
#==============================================================================
# ■ Main
#------------------------------------------------------------------------------
#  各クラスの定義が終わった後、ここから実際の処理が始まります。
#==============================================================================

begin
   $key_simulieren = Win32API.new 'user32', 'keybd_event', %w(l l l l), '' 
  $key_simulieren.call(18,0,0,0) 
  $key_simulieren.call(13,0,0,0) 
  $key_simulieren.call(13,0,2,0) 
  $key_simulieren.call(18,0,2,0) 
  # Change the $fontface variable to change the font style
  $fontface = ".VnTime" # font chu~
  # Change the $fontsize variable to change the font size
  $fontsize = 24 
  # トランジション準備
  Graphics.freeze
  # シーンオブジェクト (タイトル画面) を作成
  $scene = Scene_Title.new
  # $scene が有効な限り main メソッドを呼び出す
  while $scene != nil
    $scene.main
  end
  # フェードアウト
  Graphics.transition(20)
rescue Errno::ENOENT
  # 例外 Errno::ENOENT を補足
  # ファイルがオープンできなかった場合、メッセージを表示して終了する
  filename = $!.message.sub("No such file or directory - ", "")
  print("File #{filename} was not found.")
end
 
Sao tui vẫn không dùng được?
Ông nào hướng dẫn tường tận cách làm cho tui cái!
Đầu tiên là insert script sau đó thì call nó ra như thế nào.
Tui call : $scene = Scene_movie.new('Intro',20)
Mà nó báo lỗi tùm lum!
 
Ông call vầy nè :

call script :

$scene = Scene_Movie.new("tên phim",thời gian chờ)

Mà cái script này bị lag, mấy ông ơi .
Thanks Vo_dich nhắc nhở.
 
$scene = Scene_Movie.new("tên phim",thời gian chờ)
để trong dấu ngoặc kép, nếu ko nó tưởng variable
 
Rất tiếc phải nói với các ông là tui vẫn thấy bị bật ra! Tức la khi kích hoạt Event thì tự dưng thấy bật ra khỏi Game. Không movie mà Game cũng tắt!
Cái Script Full screen thì chưa kịp chạy game đã báo lỗi! Chưa kể lỗi xong thì tất cả các File chạy khác lỗi theo! Không khởi động được bất kì trình nào khác! Phải restart lại máy!
 
Back
Top