Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

RMXP Flash Player and Add-ons [Updated:13/5/09]

Flash Player for RMXP Version: 0.3Mod
By: 灼眼的夏娜 Moded by Dahrkael

Updated! Added new add-on: animated Scene_Title
Updated! Added new add-on: Scene_IntroFlash
Updated! Added flash10a.ocx for better compatibility with all flash files.

Introduction

With this script you can play a flash file from a call in an event or in the menu or wherever you want.

Features


[*]Reproduces flash files
[*]The flash is played in the game, no on like the other flash script.
[*]Support interactive flash (need RGSS knownledge)
[*]Support transparent flash.
[*]Can play flash everywhere

Screenshots

Not necessary i think Oo

Scripts

Main Script

Code:
#==============================================================================#

#                                                                 Version 0.3  #

#                         RPG Maker XP Flash Player                            #

#                                                                              #

#  Author: 灼眼的夏娜                     Updated by: Dark_Wolf_Warrior/Dahrkael #

#                                                                              #

#  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                                          #

#                                                                              #

#==============================================================================#

 

 

 

class String

  

  CP_ACP = 0

  CP_UTF8 = 65001

  

  def u2s

    m2w = Win32API.new("kernel32", "MultiByteToWideChar", "ilpipi", "i")

    w2m = Win32API.new("kernel32", "WideCharToMultiByte", "ilpipipp", "i")

    

    len = m2w.call(CP_UTF8, 0, self, -1, nil, 0)

    buf = "\0" * (len*2)

    m2w.call(CP_UTF8, 0, self, -1, buf, buf.size/2)

    

    len = w2m.call(CP_ACP, 0, buf, -1, nil, 0, nil, nil)

    ret = "\0" * len

    w2m.call(CP_ACP, 0, buf, -1, ret, ret.size, nil, nil)

    

    return ret

  end

  

  def s2u

    m2w = Win32API.new("kernel32", "MultiByteToWideChar", "ilpipi", "i")

    w2m = Win32API.new("kernel32", "WideCharToMultiByte", "ilpipipp", "i")

  

    len = m2w.call(CP_ACP, 0, self, -1, nil, 0);

    buf = "\0" * (len*2)

    m2w.call(CP_ACP, 0, self, -1, buf, buf.size/2);

  

    len = w2m.call(CP_UTF8, 0, buf, -1, nil, 0, nil, nil);

    ret = "\0" * len

    w2m.call(CP_UTF8, 0, buf, -1, ret, ret.size, nil, nil);

     

    return ret

  end

 

  def s2u!

    self[0, length] = s2u

  end  

  

  def u2s!

    self[0, length] = u2s

  end

  

end

 

class Bitmap

  

  RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')

  RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')

 

  def address

    buffer, ad = "xxxx", object_id * 2 + 16

    RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L")[0] + 8

    RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L")[0] + 16

    RtlMoveMemory_pi.call(buffer, ad, 4); return buffer.unpack("L")[0]

  end

  

end 

 

class RMFlash

 

    API_NEW           = Win32API.new("RMFlash", "_new", "piil", "l")

    API_UPDATE      = Win32API.new("RMFlash", "_update", "l", "v")

    API_FREE          = Win32API.new("RMFlash", "_free", "l", "v")

    API_PLAYING     = Win32API.new("RMFlash", "_is_playing", "l", "i")

    API_PAUSE         = Win32API.new("RMFlash", "_pause", "l", "v")

    API_RESUME      = Win32API.new("RMFlash", "_resume", "l", "v")

    API_BACK          = Win32API.new("RMFlash", "_back", "l", "v")

    API_REWIND      = Win32API.new("RMFlash", "_rewind", "l", "v")

    API_FORWARD     = Win32API.new("RMFlash", "_forward", "l", "v")

    API_CURFRAME      = Win32API.new("RMFlash", "_cur_frame", "l", "i")

    API_TOTALFRAME  = Win32API.new("RMFlash", "_total_frames", "l", "i")

    API_GOTOFRAME     = Win32API.new("RMFlash", "_goto_frame", "li", "v")

    API_GETLOOP       = Win32API.new("RMFlash", "_get_loop", "l", "i")

    API_SETLOOP       = Win32API.new("RMFlash", "_set_loop", "li", "v")

    API_CLEARALL      = Win32API.new("RMFlash", "_clear_all", "v", "v")

  API_VALID       = Win32API.new("RMFlash", "_valid", "l", "i")

  API_SENDMSG     = Win32API.new("RMFlash", "_send_message", "liii", "l")

    

  CUR_PATH        = Dir.pwd

  

    def self.get_version

 

    end

 

    def self.clear_all

        API_CLEARALL.call

    end

  

  def self.load(name, width, height, v = nil)

    new("#{CUR_PATH}/Graphics/Flash/#{name}".u2s, width, height, v)

  end

  

  attr_reader   :valid

 

    def initialize(flash_name, flash_width, flash_height, viewport = nil)

        @sprite = Sprite.new(viewport)

        @sprite.bitmap = Bitmap.new(flash_width, flash_height)

        @value = API_NEW.call(flash_name, flash_width, flash_height, @sprite.bitmap.address)

        @loop = API_GETLOOP.call(@value) > 0

    @valid = API_VALID.call(@value) > 0

    end

 

    def viewport

        @sprite.viewport

    end

 

    def update

        API_UPDATE.call(@value)

    end

 

    def dispose

        API_FREE.call(@sprite.bitmap.address)

    end

 

    def playing?

        API_PLAYING.call(@value) > 0

    end

 

    def pause

        API_PAUSE.call(@value)

    end

 

    def resume

        API_RESUME.call(@value)

    end

 

    def back

        API_BACK.call(@value)

    end

 

    def rewind

        API_REWIND.call(@value)

    end

 

    def forward

        API_FORWARD.call(@value)

    end

 

    def current_frame

        API_CURFRAME.call(@value)

    end

 

    def total_frames

        API_TOTALFRAME.call(@value)

    end

 

    def goto_frame(goal_frame)

        API_GOTOFRAME.call(@value, goal_frame)

    end

 

    def x

        @sprite.x

    end

 

    def x=(v)

        @sprite.x = v

    end

 

    def y

        @sprite.y

    end

 

    def y=(v)

        @sprite.y = v

    end

 

    def z

        @sprite.z

    end

 

    def z=(v)

        @sprite.z = v

    end

 

    def width

        @sprite.bitmap.width

    end

 

    def height

        @sprite.bitmap.height

    end

 

    def loop?

        @loop

    end

 

    def loop=(v)

        if @loop != v

            @loop = v

            API_SETLOOP.call(@value, v)

        end

    end

  

  def msg_to_flash(msg, wParam, lParam)

    return API_SENDMSG.call(@value, msg, wParam, lParam)

  end

  

  #  例

  WM_MOUSEMOVE  = 0x0200

  

  def make_long(a, b)

    return (a & 0xffff ) | (b & 0xffff) << 16

  end

  

  def on_mouse_move(x, y)

    return msg_to_flash(WM_MOUSEMOVE, 0, make_long(x, y))

  end

 

end

 

module Kernel

 

  alias origin_exit exit unless method_defined? :exit

  

  def exit(*args)

    RMFlash.clear_all

    origin_exit(*args)

  end

  

end

 

module Keyb

  $keys = {}

  $keys["Enter"] = 0x0D

  GetKeyState = Win32API.new("user32","GetAsyncKeyState",['i'],'i')

  module_function 

  def trigger(rkey) 

    GetKeyState.call(rkey) & 0x01 == 1

  end

end

 

class Play

  

  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.dispose

    Graphics.frame_rate = @fr

    fondo.dispose

  end

 

end

 

 

Add-ons

Animated Scene_Title with flash
Code:
 

#==============================================================================

# ** Scene_Title with Flash Background                                 Dahrkael

#------------------------------------------------------------------------------

#  You can put a picture with the title and a flash in the background.

#  Requires the .dll and the .ocx

#==============================================================================

 

class Scene_Title

 

  #--------------------------------------------------------------------------

  # * Main Processing

  #--------------------------------------------------------------------------

  def main

    

    # Write the name of the flash file you want to use as background with the extension

    # in the "/Graphics/Flash/" folder

    @archivo_flash = "miku.swf"

    # If battle test

    if $BTEST

      battle_test

      return

    end

    # Load database

    $data_actors        = load_data("Data/Actors.rxdata")

    $data_classes       = load_data("Data/Classes.rxdata")

    $data_skills        = load_data("Data/Skills.rxdata")

    $data_items         = load_data("Data/Items.rxdata")

    $data_weapons       = load_data("Data/Weapons.rxdata")

    $data_armors        = load_data("Data/Armors.rxdata")

    $data_enemies       = load_data("Data/Enemies.rxdata")

    $data_troops        = load_data("Data/Troops.rxdata")

    $data_states        = load_data("Data/States.rxdata")

    $data_animations    = load_data("Data/Animations.rxdata")

    $data_tilesets      = load_data("Data/Tilesets.rxdata")

    $data_common_events = load_data("Data/CommonEvents.rxdata")

    $data_system        = load_data("Data/System.rxdata")

    # Make system object

    $game_system = Game_System.new

    # Make title graphic

    @sprite = Sprite.new

    @sprite.bitmap = RPG::Cache.title($data_system.title_name)

    @sprite.z = 5

    # Flash background

    @fondo = RMFlash.load(@archivo_flash, 640, 480)

    @fondo.z = @sprite.z - 1

    @fondo2 = Sprite.new

    @fondo2.bitmap = Bitmap.new(640, 480)

    @fondo2.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 255))

    @fondo2.z = -1

    #@fondo.loop = 1

    @fr = Graphics.frame_rate

    Graphics.frame_rate = 40

    

    # Make command window

    s1 = "New game"

    s2 = "Load game"

    s3 = "Exit to Windows"

    @command_window = Window_Command.new(192, [s1, s2, s3])

    @command_window.back_opacity = 160

    @command_window.x = 320 - @command_window.width / 2

    @command_window.y = 288

    @command_window.z = 6

    # Continue enabled determinant

    # Check if at least one save file exists

    # If enabled, make @continue_enabled true; if disabled, make it false

    @continue_enabled = false

    for i in 0..3

      if FileTest.exist?("Save#{i+1}.rxdata")

        @continue_enabled = true

      end

    end

    # If continue is enabled, move cursor to "Continue"

    # If disabled, display "Continue" text in gray

    if @continue_enabled

      @command_window.index = 1

    else

      @command_window.disable_item(1)

    end

    # Play title BGM

    $game_system.bgm_play($data_system.title_bgm)

    # Stop playing ME and BGS

    Audio.me_stop

    Audio.bgs_stop

    # Execute transition

    Graphics.transition

    # Main loop

    loop do

      # Update game screen

      Graphics.update

      # Update input information

      Input.update

      #Flash update

      @fondo.update

      # Frame update

      update

      # Abort loop if screen is changed

      if $scene != self

        break

      end

    end

    # Prepare for transition

    Graphics.freeze

    # Dispose of command window

    @command_window.dispose

    # Dispose of title graphic

    @sprite.bitmap.dispose

    @sprite.dispose

    @fondo.pause

    @fondo.z = -2

    @fondo.dispose

    # Normal frame rate

    Graphics.frame_rate = @fr

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # Update command window

    @command_window.update

    # If C button was pressed

    if Input.trigger?(Input::C)

      # Branch by command window cursor position

      case @command_window.index

      when 0  # New game

        command_new_game

      when 1  # Continue

        command_continue

      when 2  # Shutdown

        command_shutdown

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Command: New Game

  #--------------------------------------------------------------------------

  def command_new_game

    # Play decision SE

    $game_system.se_play($data_system.decision_se)

    # Stop BGM

    Audio.bgm_stop

    # Reset frame count for measuring play time

    Graphics.frame_count = 0

    # Make each type of game object

    $game_temp          = Game_Temp.new

    $game_system        = Game_System.new

    $game_switches      = Game_Switches.new

    $game_variables     = Game_Variables.new

    $game_self_switches = Game_SelfSwitches.new

    $game_screen        = Game_Screen.new

    $game_actors        = Game_Actors.new

    $game_party         = Game_Party.new

    $game_troop         = Game_Troop.new

    $game_map           = Game_Map.new

    $game_player        = Game_Player.new

    # Set up initial party

    $game_party.setup_starting_members

    # Set up initial map position

    $game_map.setup($data_system.start_map_id)

    # Move player to initial position

    $game_player.moveto($data_system.start_x, $data_system.start_y)

    # Refresh player

    $game_player.refresh

    # Run automatic change for BGM and BGS set with map

    $game_map.autoplay

    # Update map (run parallel process event)

    $game_map.update

    # Switch to map screen

    $scene = Scene_Map.new

  end

  #--------------------------------------------------------------------------

  # * Command: Continue

  #--------------------------------------------------------------------------

  def command_continue

    # If continue is disabled

    unless @continue_enabled

      # Play buzzer SE

      $game_system.se_play($data_system.buzzer_se)

      return

    end

    # Play decision SE

    $game_system.se_play($data_system.decision_se)

    # Switch to load screen

    $scene = Scene_Load.new

  end

  #--------------------------------------------------------------------------

  # * Command: Shutdown

  #--------------------------------------------------------------------------

  def command_shutdown

    # Play decision SE

    $game_system.se_play($data_system.decision_se)

    # Fade out BGM, BGS, and ME

    Audio.bgm_fade(800)

    Audio.bgs_fade(800)

    Audio.me_fade(800)

    # Shutdown

    $scene = nil

  end

  #--------------------------------------------------------------------------

  # * Battle Test

  #--------------------------------------------------------------------------

  def battle_test

    # Load database (for battle test)

    $data_actors        = load_data("Data/Actors.rxdata")

    $data_classes       = load_data("Data/Classes.rxdata")

    $data_skills        = load_data("Data/Skills.rxdata")

    $data_items         = load_data("Data/Items.rxdata")

    $data_weapons       = load_data("Data/Weapons.rxdata")

    $data_armors        = load_data("Data/Armors.rxdata")

    $data_enemies       = load_data("Data/Enemies.rxdata")

    $data_troops        = load_data("Data/Troops.rxdata")

    $data_states        = load_data("Data/States.rxdata")

    $data_animations    = load_data("Data/Animations.rxdata")

    $data_tilesets      = load_data("Data/Tilesets.rxdata")

    $data_common_events = load_data("Data/CommonEvents.rxdata")

    $data_system        = load_data("Data/System.rxdata")

    # Reset frame count for measuring play time

    Graphics.frame_count = 0

    # Make each game object

    $game_temp          = Game_Temp.new

    $game_system        = Game_System.new

    $game_switches      = Game_Switches.new

    $game_variables     = Game_Variables.new

    $game_self_switches = Game_SelfSwitches.new

    $game_screen        = Game_Screen.new

    $game_actors        = Game_Actors.new

    $game_party         = Game_Party.new

    $game_troop         = Game_Troop.new

    $game_map           = Game_Map.new

    $game_player        = Game_Player.new

    # Set up party for battle test

    $game_party.setup_battle_test_members

    # Set troop ID, can escape flag, and battleback

    $game_temp.battle_troop_id = $data_system.test_troop_id

    $game_temp.battle_can_escape = true

    $game_map.battleback_name = $data_system.battleback_name

    # Play battle start SE

    $game_system.se_play($data_system.battle_start_se)

    # Play battle BGM

    $game_system.bgm_play($game_system.battle_bgm)

    # Switch to battle screen

    $scene = Scene_Battle.new

  end

end

 
Scene_Intro using flash
Code:
 

#===============================================================================

#

# * Scene_IntroFlash by Dahrkael using 灼眼的夏娜 Flash Player

#                                                                          v1.0

#   Requires the .dll and .ocx

#===============================================================================

class Scene_IntroFlash

  

  def initialize

    # Set the file which will be played

    @file = "miku.swf"

    # Choose if the player can skip the intro (0 => false, 1 => true)

    @button = 1

  end

  

  def main

    # Black background

    @fondo = Sprite.new

    @fondo.bitmap = Bitmap.new(640, 480)

    @fondo.bitmap.fill_rect(0, 0, 640, 480, Color.new(0,0,0,255))

    @fondo.z = -1

    # Set flash video

    fls = RMFlash.load(@file, 640, 480)

    fls.loop = 1

    fls.z = 2

    # Save frame rate

    @fr = Graphics.frame_rate

    # Set new frame rate

    Graphics.frame_rate = 40

    # Main loop

    Graphics.transition

    while true

      Graphics.update

      #Input.update

      fls.update

      # Skip the video using Enter

      break if @button == 1 and Keyb.trigger($keys["Enter"]) 

      # Skip when finished

      break if !fls.playing?

    end

    $scene = Scene_Title.new

    Graphics.freeze

    # Little solution for frozen images

    fls.z = -2

    fls.dispose

    # Set old frame rate

    Graphics.frame_rate = @fr

  end

end

 

Demos

Main script demo:
http://ofarts.rpgmaker.es/scripts/Flashv0.3Mod.zip

Scene_Title demo:
http://ofarts.rpgmaker.es/scripts/Scene_TitleFlash.zip

Scene_Intro demo:
http://ofarts.rpgmaker.es/scripts/Scene_IntroFlash.zip

Flash ocx

Use Flash10a.ocx for the best performance, if you use old flash files and have problems try using another ocx.

http://ofarts.rpgmaker.es/scripts/Flash10a.ocx

http://ofarts.rpgmaker.es/scripts/Flash9.ocx

http://ofarts.rpgmaker.es/scripts/Flash6.ocx

Instructions

Use $flash.play("file.swf", button) to reproduce the flash file..

If you want to play an intro in the Main script change "$scene = Scene_Title.new" with "$scene = Scene_IntroFlash.new"

FAQ

Q: Are you the original author of teh script?
A: No, the original script author is 灼眼的夏娜, but the script was only a core, im making it useful.

Q: Can i put a flash video anywhere in the game?

A: Yes.

Q: Can i ask for an add-on?
A: Sure, post your idea.

Q: Can i use interactive flash files?
A: Yes, but if you want to interactuact with it you must know how with RGSS.

Compatibility

Unkown problems with other scripts.
Works in fullscreen mode.

Credits and Thanks

To 灼眼的夏娜 for make the script and the dlls.
Thanks to myself for add the call methods and make the add-ons xD

Author's Notes

You can make awesome things with this script if you know RGSS.

Terms and Conditions

Must include original scripter's name (灼眼的夏娜).
If you want to include mine too is your decision.

PD: Sorry for my bad english, im spanish.
 
Nice, really nice I think !

but I havn't tested the script.
The first thing that comes to mind is that the programmer likes to torture his brain for nothing: The first two functions are almost the same, and they could be merged. And then many APIs are declared without being used...

regards,
berka
 

Yin

Member

Hey, I'm very interested in this script, but why does it keep posting random numbers when playing a file? Is there any way I can remove that? Also, in order for it to close automatically, I just have to put a few black frames? Sounds easy, then I won't have to worry about those popups.

Also, A+ for it also working in fullscreen with no problems (In the demo, haven't tried it with my game yet). Is there a button that I can assign to close the movie before it ends?
 
berka":217bhe3x said:
many APIs are declared without being used...
Because the author wanted the maximum of possibilities with this script, if you know RGSS you can use the unused calls for make cool things :D

Yin":217bhe3x said:
why does it keep posting random numbers when playing a file? Is there any way I can remove that?

Oo what do you mean? can you put a screenshot or something?

Yin":217bhe3x said:
Is there a button that I can assign to close the movie before it ends?
Yes, i updated the script (and the demo) you can choose if is possible to skip the flash with Enter key.

Added things for better performance.
- When flash is played the frame rate is 40, after play the flash the frame rate will be the same of before.
- Added the "skip with button" function using another input module, so you wont have problems of pressing keys. by default the skip key is Enter.
- Now the flash stops automatically so you dont need to specificate the duration in some flashes.
 

Yin

Member

Ok, before I post a screenshot, let me check to see if you fixed it in the updated one.

EDIT: It's fixed because it only happened with the playt call. But just so you know, before little Windows boxes were popping up with random numbers for every frame. It's perfect now!
 
I've got a question. Can the script handle intro videos? I'd like to get a video to appear before the title screen does. I have almost zero knowledge on RGSS, but I imagine it would have to deal with Scene_Title. Any way to code it to do that?
 
Beautiful! I works! For some reason it doesn't want to play the video (it plays audio, but no video) but I'm sure that this is the fault of the file I'm using. Thanks a bunch, you've really helped me out by posting this here! :biggrin:

EDIT: Ok, another problem.So it doesn't play the video, only the audio. I skipped the animation with the enter key and then a still of the video (that didn't play) was stuck over the game and I couldn't see, though I could still move. The same happens when I wait it out and let the music finish normally. Now this completely blows my mind!

Here is a screenshot of what I mean. The animation is a dummy test animation of Sonic. I think his face kinda suits the situation, huh.
mokup.jpg
 
@Emerald Lance, this script uses Flash 6. If you are using a compression method not supported, this could happen. try replacing Flash.ocx with this one, it uses Flash 9. I compress my flash videos using flash 8 and the flash.ocx that was included could not support it, but flash 9 does. Everything else works the same.

@Dahrkael, Is there anyway you could add an option to change the volume? Also, maybe you could replace the flash.ocx with the one I provided if you want.

Thank you,
Draycos Goldaryn
 

Yin

Member

I'm using Flash 9 and it works just fine. If I do have any problems down the line, I will be sure to try your file out.
 
Emerald Lance":3iq7k21z said:
Beautiful! I works! For some reason it doesn't want to play the video (it plays audio, but no video) but I'm sure that this is the fault of the file I'm using. Thanks a bunch, you've really helped me out by posting this here! :biggrin:

EDIT: Ok, another problem.So it doesn't play the video, only the audio. I skipped the animation with the enter key and then a still of the video (that didn't play) was stuck over the game and I couldn't see, though I could still move. The same happens when I wait it out and let the music finish normally. Now this completely blows my mind!

Here is a screenshot of what I mean. The animation is a dummy test animation of Sonic. I think his face kinda suits the situation, huh.
mokup.jpg

The first problem is easy, if you see the line above the flash play is Graphics.freeze, without a Graphics.transition the screen wont display anything, put the code like this:

Code:
Graphics.freeze

  $flash = Play.new

Graphics.transition(1)

  $flash.play("file.swf", button)

Graphics.freeze

  $scene = Scene_Title.new

I had problem of the frozen image when i was making the animated Scene_Title, the solution was setting the .z of the flash to -2 and drawing a black rect at -1, i didnt find another solution, for make that take a look in the code of the Scene_Title.

DraycosGoldaryn":3iq7k21z said:
@Dahrkael, Is there anyway you could add an option to change the volume? Also, maybe you could replace the flash.ocx with the one I provided if you want.
Sure, thanks, this repair a problem with long flash files i had yesterday.
Can you search for the flash.ocx v10? i cant find it.

I have free time so i will make a Scene_Intro using flash now, im sure it will be useful for someone.

EDIT: Updated thread and ocx and added the Scene_Intro script
 
An even cooler add on to your Scene_Intro
Code:
class Scene_Cutscene

  

  def initialize(file, button)

    # Set the file which will be played

    @file = file

    # Choose if the player can skip the intro (0 => false, 1 => true)

    @button = button

  end

  

  def main

    # Black background

    @fondo = Sprite.new

    @fondo.bitmap = Bitmap.new(640, 480)

    @fondo.bitmap.fill_rect(0, 0, 640, 480, Color.new(0,0,0,255))

    @fondo.z = -1

    # Set flash video

    fls = RMFlash.load(@file, 640, 480)

    fls.loop = 1

    fls.z = 2

    # Save frame rate

    @fr = Graphics.frame_rate

    # Set new frame rate

    Graphics.frame_rate = 40

    # Main loop

    Graphics.transition

    while true

      Graphics.update

      #Input.update

      fls.update

      # Skip the video using Enter

      break if @button == 1 and Keyb.trigger($keys["Enter"]) 

      # Skip when finished

      break if !fls.playing?

    end

    $scene = Scene_Title.new

    Graphics.freeze

    # Little solution for frozen images

    fls.z = -2

    fls.dispose

    # Set old frame rate

    Graphics.frame_rate = @fr

  end

end

To call use
$scene = Scene_Cutscene.new("file.swf, button type)

that way you can have 3-D animated or whatever cutscenes in your game like FF games do.
 
gameguy27":1ki60lzo said:
An even cooler add on to your Scene_Intro
Code:
class Scene_Cutscene

  

  def initialize(file, button)

    # Set the file which will be played

    @file = file

    # Choose if the player can skip the intro (0 => false, 1 => true)

    @button = button

  end

  

  def main

    # Black background

    @fondo = Sprite.new

    @fondo.bitmap = Bitmap.new(640, 480)

    @fondo.bitmap.fill_rect(0, 0, 640, 480, Color.new(0,0,0,255))

    @fondo.z = -1

    # Set flash video

    fls = RMFlash.load(@file, 640, 480)

    fls.loop = 1

    fls.z = 2

    # Save frame rate

    @fr = Graphics.frame_rate

    # Set new frame rate

    Graphics.frame_rate = 40

    # Main loop

    Graphics.transition

    while true

      Graphics.update

      #Input.update

      fls.update

      # Skip the video using Enter

      break if @button == 1 and Keyb.trigger($keys["Enter"]) 

      # Skip when finished

      break if !fls.playing?

    end

    $scene = Scene_Title.new

    Graphics.freeze

    # Little solution for frozen images

    fls.z = -2

    fls.dispose

    # Set old frame rate

    Graphics.frame_rate = @fr

  end

end

To call use
$scene = Scene_Cutscene.new("file.swf, button type)

that way you can have 3-D animated or whatever cutscenes in your game like FF games do.

and the difference is? Oo

Edit: added flash10.ocx to download, the demos have the flash6 and flash9 so if you use adobe flash cs4 or you have problems with some files use the v10.

http://ofarts.rpgmaker.es/scripts/Flash10a.ocx
 
Dahrkael":1jmygoc5 said:
gameguy27":1jmygoc5 said:
An even cooler add on to your Scene_Intro
Code:
class Scene_Cutscene

  

  def initialize(file, button)

    # Set the file which will be played

    @file = file

    # Choose if the player can skip the intro (0 => false, 1 => true)

    @button = button

  end

  

  def main

    # Black background

    @fondo = Sprite.new

    @fondo.bitmap = Bitmap.new(640, 480)

    @fondo.bitmap.fill_rect(0, 0, 640, 480, Color.new(0,0,0,255))

    @fondo.z = -1

    # Set flash video

    fls = RMFlash.load(@file, 640, 480)

    fls.loop = 1

    fls.z = 2

    # Save frame rate

    @fr = Graphics.frame_rate

    # Set new frame rate

    Graphics.frame_rate = 40

    # Main loop

    Graphics.transition

    while true

      Graphics.update

      #Input.update

      fls.update

      # Skip the video using Enter

      break if @button == 1 and Keyb.trigger($keys["Enter"]) 

      # Skip when finished

      break if !fls.playing?

    end

    $scene = Scene_Title.new

    Graphics.freeze

    # Little solution for frozen images

    fls.z = -2

    fls.dispose

    # Set old frame rate

    Graphics.frame_rate = @fr

  end

end

To call use
$scene = Scene_Cutscene.new("file.swf, button type)

that way you can have 3-D animated or whatever cutscenes in your game like FF games do.

and the difference is? Oo

Edit: added flash10.ocx to download, the demos have the flash6 and flash9 so if you use adobe flash cs4 or you have problems with some files use the v10.

http://ofarts.rpgmaker.es/scripts/Flash10a.ocx


The difference is that Scene_Intro only played one swf. My mod allows you to play any swf.
 
Thanks much Draycos for pointing me in the right direction, and Dahrkael for the update. Everything works perfectly now. :biggrin:

But now, I have a real challenge. Don't worry, I am more than content with what you've given us so far, so not having this little bit extra won't shatter my hopes and dreams or anything. But it would be kinda spiffy, I think, to have this ability:

In the Wild Arms series, the intro video doesn't play until after the player has selected to load or start a new game. Instead of going in the classic "intro, title, play" format that most RPGs have, it works in a "title, intro, play" format. Meaning, first the title screen appears, then you'd click Load (or New Game) and after you've loaded your game is when the intro plays. Immediately after the intro, the game begins. I was wondering if something like that was possible with this script? I've always thought that kind of opening sequence was cool, and sometimes I found myself loading a game just so I could see the intro, then I'd turn it off. So, can it be done? :boo:
 
i think you can make it with the default call:
$flash.play(filename, button)
putted in the
command_newgame
and in the
Scene_Load
just before the line
$scene = Scene_Map.new
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top