bangchukieuphong
Donkey Kong
- 10/10/04
- 310
- 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 rất nhiều
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.

#==============================================================================
# ■ 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
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
xem lại trong shortcut, xem trong properties, phần start in phải có đường dẫn đúng mới có phim,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ặ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.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)
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.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.
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
đây là script thời gian, ngày tháng năm.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?
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
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
#==============================================================================
# ■ 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