Okay, hi to all. Today we are going to add something pretty flashy for your game. We are going to add videos !!! For that, we are going to use the Script RMFLASH. With this script we can play .swf files. But, what the advantage over a Avi player or a Mpg player??? With some modifications to our script we can put Videos as background on Menus, the title screen or as a Battle Background!!
Okay, lets start. First add the RMFLASH script to your project:
First, create a folder called "Flash" on the "Graphics" folders.
CODE
#==============================================================================# # Version 0.3.1 # # RPG Maker XP Flash Player # # # # Author: 灼眼的夏娜 Updated by: Dark_Wolf_Warrior/Dahrkael and # # Playhome # # # # How to Use: # # Graphics.freeze # # 1. Go to Main Script and add ----> $flash = Play.new # # $scene = Scene_Title.new # # # # 2. Copy the .dll and the .ocx to the game folder # # # # 3. Make a folder called "Flash" in the folder "Graphics" -> Graphics/Flash/ # # # # 4. To play a flash file use: # # $flash.play("file.swf", button) # # # # button can be 0 or 1, if 1 you can skip the flash using "Enter" # # # # # # # # Interactive flashes requires RGSS knownledge to make they work # # # # Original Keyb module by HoundNinja # # # #==============================================================================#
def play(filename, button) fondo = Sprite.new fondo.bitmap = Bitmap.new(640, 480) fondo.bitmap.fill_rect(0, 0, 640, 480, Color.new(0,0,0,255)) fls = RMFlash.load(filename, 640, 480) fls.loop = 1 fls.z = 9999 @button = button @fr = Graphics.frame_rate Graphics.frame_rate = 40 while true Graphics.update #Input.update fls.update break if @button == 1 and Keyb.trigger($keys["Enter"]) break if !fls.playing? end fls.pause fls.z = -2 fls.dispose Graphics.frame_rate = @fr fondo.dispose end end[code]
Then, modify You main, add this line ( [b]$flash = Play.new[/b] ) above [b]( $scene = Scene_Title.new)[/b]
Now your main should look like:
[code] # Transition preparation # Prepare for transition Graphics.freeze # Make scene object (title screen) $flash = Play.new $scene = Scene_Title.new
Ok, now, the funny part.
Video as background on the tittle screen:
Okay, go to your Scene_Title and add the blackened line on the def main
CODE
#============================================================================== # ** Scene_Title #------------------------------------------------------------------------------ # This class performs title screen processing. #==============================================================================
class Scene_Title #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main [b] @flash_file = "1.swf"[/b][/hide]
Change [b]"1.swf"[/b] with the name of your swf.
And add the Next lines after The "Makes Command Windows":
# Update game screen Graphics.update # Update input information Input.update #Flash update [b]@fondo.update[/b] # Frame update update
Finally, add on the dispose method:
CODE
# Prepare for transition Graphics.freeze # Dispose of command window @command_window.dispose # Dispose of title graphic @sprite.bitmap.dispose @sprite.dispose [b]@fondo.pause @fondo.z = -2 @fondo.dispose # Normal frame rate Graphics.frame_rate = @fr[/b] end
Result:
Do you like it ;D??? well, this is jsut the ebginning ;D
Video as background on Battle:
This is almost the same thing, but you have to modify some others thing.
First, i use Enu Tankentai Xp, so i will explain how to implement it on that system. It should be the same for other CBS.
For tankentai:
I will post the entire "Sideview 2" script to show it. [Posting Pastebin, the script was screwing the formatting]
http://pastebin.com/MyBXLv4Y
If you see, i added a a (Flash Bbacks (lol)) to help you xP.
#======================================================================= #=====================Flash Bbacks (lol)================================ #======================================================================= # Use a different variable Value for differents flashs # Lights Effects Can be done aswell, just use images @archivo_flash = $game_map.map_id @asdf = RMFlash.load(@archivo_flash, 640, 480) #@asdf.loop = 1 @variable_del_fondo = Sprite.new @variable_del_fondo.bitmap = Bitmap.new("Graphics/Pictures/#{$game_map.map_id}") @variable_del_fondo.z = 400
This is how it works:
As you can see, @archivo_flash remembers the Map id and @asdf plays the flash file. @asdf is gonna load a File on the "Flash" folder with the the number of the map as name (Without extension), so, if you want to put a Flash battleback on the map number 34, you have to put a flash file with the name "34" (without extension)
Result:
looks goods no ;D
Extra: Light effects on battle scene
#======================================================================= #=====================Flash Bbacks (lol)================================ #======================================================================= # Use a different variable Value for differents flashs # Lights Effects Can be done aswell, just use images @archivo_flash = $game_map.map_id @asdf = RMFlash.load(@archivo_flash, 640, 480) #@asdf.loop = 1 @variable_del_fondo = Sprite.new @variable_del_fondo.bitmap = Bitmap.new("Graphics/Pictures/#{$game_map.map_id}") @variable_del_fondo.z = 400
@variable_del_fondo is going to load an image file from the "Pictures" with the same name as the map id (without the extension)
Result:
Okay, this is all for now, in part 2 i will explain how to put videos on your menus ^^