Movie In RPGXP

  • Thread starter Thread starter ken10
  • Ngày gửi Ngày gửi

ken10

Programmer
Tham gia ngày
10/1/04
Bài viết
2,341
Reaction score
6
Đây là Script do 1 người bên Tây Ban Nha viết Script giúp VM .Ông dgam3z sẽ được để tên trong danh sách những người giúp VM.Hiện tui đang hoỉ ổng về cách Font chữ .
Script :#==============================================================================
# Khởi tạo Movie (@system.frame.set)
#------------------------------------------------------------------------------
# By: dgam3z
# Date: 18/10/04
# VM(@bitmap_VietNam-maker:Cache.new)
#==============================================================================

module MoviePlayer

#--------------------------------------------------------------------------
# ? Xét attr_acessor cho System.
#-------------------------------------------------------------------------
class<<self
attr_accessor(:x,:y,:z,:width,:height,:opacity)
end

#--------------------------------------------------------------------------
# ? Xét Even cho system.
#-------------------------------------------------------------------------
MULTIFILE = 1
ONEFILE = 2

#--------------------------------------------------------------------------
# ? Biến 1.
#-------------------------------------------------------------------------

@loaded = false

#--------------------------------------------------------------------------
# ? Loads the file(s).
# In: name, frames, @loaded
# Out: @rmm_name, @rmm_type, @rmm_width, @rmm_height, @loaded, @rmm_frames
#-------------------------------------------------------------------------
def self.load(name,frames=0)
if not @loaded then
#Checks if the movie is ONEFILE.
if FileTest.exists?("Movies/"+name+".png") then
if frames != 0
@rmm_frames = frames
else
if $DEBUG then print "Debug: Number of frames needed for this movie." end
return 3 #Error 3: Need the number of frames.
end

@rmm = Sprite.new
@rmm_name = name
@rmm_type = ONEFILE
@rmm_x = 0
@rmm_y = 0
@rmm_z = 4000
@rmm_width = 0
@rmm_height = 0
@frame_counter = 0

#Checks the size of the file.
@rmm_width = Bitmap.new("Movies/"+@rmm_name+".png").width/@rmm_frames
@rmm_height = Bitmap.new("Movies/"+@rmm_name+".png").height
@loaded = true
return 0 #No Errors: Everything wen't fine.
end
#Checks if the movie is MULTIFILE.
if FileTest.exists?("Movies/"+name+"/"+name+"_0.png") then

@rmm = Sprite.new
@rmm_name = name
@rmm_type = MULTIFILE
@rmm_frames = 0
@rmm_x = 0
@rmm_y = 0
@rmm_z = 4000
@rmm_width = 0
@rmm_height = 0
@frame_counter = 0

#Checks the size of the file.
@rmm_width = Bitmap.new("Movies/"+@rmm_name+"/"+@rmm_name+"_0.png").width
@rmm_height = Bitmap.new("Movies/"+@rmm_name+"/"+@rmm_name+"_0.png").height

i = 0
while FileTest.exist?("Movies/"+@rmm_name+"/"+@rmm_name+"_#{i}.png")
i = i + 1
end
#And get the number of frames.
@rmm_frames = i - 1
@loaded = true
return 0 #No Errors: Everything wen't fine.
end
if $DEBUG then print "Debug: File not found." end
return 2 #Error 2: File not found.
end
if $DEBUG then print "Debug: Last movie not unloaded." end
return 1 #Error 1: Needs to unload last movie first.
end

#--------------------------------------------------------------------------
# ? Bắt đầu chạy Movies.
#-------------------------------------------------------------------------
def self.start(trans=40)
if not @loaded then
if $DEBUG then print "Debug: Can't start, movie not loaded." end
return 1 #Error 1: Not loaded.
end

Graphics.freeze

if @rmm_type == ONEFILE then
@rmm.bitmap = Bitmap.new("Movies/"+@rmm_name+".png")
@rmm.src_rect.set(@rmm_width*@frame_counter, 0, @rmm_width, @rmm_height)
end

if @rmm_type == MULTIFILE then
@rmm.bitmap = Bitmap.new("Movies/"+@rmm_name+"/"+@rmm_name+"_0.png")
@rmm.src_rect.set(0, 0, @rmm.bitmap.width, @rmm.bitmap.height)
end

@frame_counter = 1

#Makes the transition.
Graphics.transition(trans)
end

#--------------------------------------------------------------------------
# ? Updates the movie. (changes to the next frame)
#-------------------------------------------------------------------------
def self.update
if @loaded == true then
if @rmm_type == ONEFILE then
@rmm.src_rect.set(@rmm_width*@frame_counter, 0, @rmm_width, @rmm_height)
end
if @rmm_type == MULTIFILE then
@rmm.bitmap = Bitmap.new("Movies/"+@rmm_name+"/"+@rmm_name+"_#{@frame_counter}.png")
@rmm.src_rect.set(0, 0, @rmm.bitmap.width, @rmm.bitmap.height)
end
Graphics.update
@frame_counter = @frame_counter + 1
if @frame_counter == @rmm_frames
@frame_counter = 0
return true
else
return false
end
end
end


#--------------------------------------------------------------------------
# ? Xét Frame movie.
#-------------------------------------------------------------------------
def self.x; return @rmm.x; end
def self.x=(tx); @rmm.x = tx; end
def self.y; return @rmm.y; end
def self.y=(ty); @rmm.y = ty; end
def self.z; return @rmm.z; end
def self.z=(tz); @rmm.z = tz; end

#--------------------------------------------------------------------------
# ? Xét Dung lượng.
#-------------------------------------------------------------------------
def self.width; return @rmm_width; end
def self.height; return @rmm_height; end

#--------------------------------------------------------------------------
# ? Sets and retrieves the movie opacity.
#-------------------------------------------------------------------------
def self.opacity; return @rmm.opacity; end
def self.opacity=(topacity); @rmm.opacity = topacity; end

#--------------------------------------------------------------------------
# ? Bắt đầy load.
#-------------------------------------------------------------------------
def self.loaded?
return @loaded
end

#--------------------------------------------------------------------------
# ? Không có hoạt động nào diễn ra khi Movie play.
#-------------------------------------------------------------------------
def self.frame?
if @loaded then
return @frame_counter
end
end

#--------------------------------------------------------------------------
# ? Phân bố .
#-------------------------------------------------------------------------
def self.play(movie, loops=1, wait=2, trans=0, x=nil, y=nil, z=4000, opacity=255)
MoviePlayer.load(movie)
if x != nil then MoviePlayer.x = x; else MoviePlayer.x = 320 - @rmm_width/2; end
if y != nil then MoviePlayer.y = y; else MoviePlayer.y = 240 - @rmm_height/2; end
MoviePlayer.z = z
MoviePlayer.start(trans)
for i in 1..loops
begin
for i in 0..wait
Graphics.update
end
end while MoviePlayer.update == false
end
MoviePlayer.stop(trans)
end

#--------------------------------------------------------------------------
# ? Dừng lại và ngưng upload movie.
#-------------------------------------------------------------------------
def self.stop(trans=40)
if not @loaded then
if $DEBUG then print "Debug: Can't stop, movie not loaded." end
return 1 #Error 1: Not loaded.
end

Graphics.freeze

@rmm.bitmap.dispose

@loaded = false

#Makes the transition.
Graphics.transition(trans)
end
end



Thank you dgam3z ! Good luck!!
Ổng hay vào RPGbox nên tui mới làm dzị thông cảm
 
Trùi ui! Ông Ken ui! Ông post cái này lên đây làm gì? Đằng nào thì cũng có ai hỉu cái gì đâu! (ngoài ông và Pre(có thể thêm cả Ice nữa)) Cái vụ nì thì ông cứ âm thầm lo hết đi. Tụi tui chỉ bít trông đợi vào các ông, chỉ cần thỉnh thoảng các ông nói vài câu cho anh em bít là được rùi!

Thay mặt toàn thể nhóm Việt Nam Maker tui chân thành cảm ơn ông Dgam3z vì sự giúp đỡ vô cùng cần thiết này! Và hi vọng rằng trong tương lai ông chính thức gia nhập nhóm để chúng ta cộng tác được tốt hơn và nhìu hơn nữa!

He he chẳng bít tui có vượt quyền không nữa? Tui đâu phải là nhân viên quản lý!
Nhưng ông thấy tui nói năng thế nào? Làm phát thanh viên của nhóm được chứ? (gì chứ ngoại giao thì tui được 10 trên 100 điểm lun!!!! he he ...:D)
 
:D Cho dù copy Script này vào chạy.Movie nào đi nữa nó cũng có chữa ViệtNam-maker bự chảng :D
 
Tui khổ hơn SVS ở chỗ ko apply được nên hả làm gì được.Đúng là cái nì chỉ ông dzà sư phụ tui hiểu chứ tui thì mù chữ rồi,giờ chả cách chi down bản sửa lỗi nên việc biết script chỉ lun là giấc mơ :((
 
U~ chả hiểu lệnh gì cả, có thể học những cái lệnh này ở đâu vậy ?
 
hiểu làm gì cho mệt xác bell ơi...thôi bỏ wa đi...đừng cố sức wá mắc công tốn tiền của cha mẹ....hehe....tui khuyên ông nếu muốn hiểu mấy thứ này thì lên google mà search "RGSS language" vào cá trang đó mà tìm hiểu nhé....
 
Back
Top