Registrarse

[Essentials] Añadir Intro antes del Título

Diego Mertens

Dartrix Joven
¡Alola!
Hoy les voy a mostrar cómo poner una intro, un "video" antes del Título, e incluso, dentro del juego. Yo sólo vengo a "transferir" a este Script a Whack a Hack!, porque, originalmente, estaba en PokéCommunity; créditos a "Peaverin"
https://www.pokecommunity.com/showthread.php?t=312010
Primero deberemos descargar esto:RMFlashFiles(2)
y descomprimirlo en la carpeta raíz del juego (en donde está el Game.exe) y crear dentro de Graphics una carpeta llamada "Flash".

Después, pegaremos el siguiente Script arriba de Main como "Intro1" o "Video1"
Aquí está el código sin los fallos del foro:
Video 1
Código:
#==============================================================================#
# Version 0.3 #
# RPG Maker XP Flash Player #
# #
# Author: ????? Updated by: Dark_Wolf_Warrior/Dahrkael #
# # Peaverin: Adapt to Essentials + tutorial(optional credits)
# How to Use: #
# 1. Create the folder Graphics/Flash and insert there the movies.
# #
# 2. If you want to play a flash at any moment insert: #
# $flash.play("file.swf", button)
# file= the name of the flash to be played
# button= 0(the player can't skip the flash by pressing enter)
# button= 1(the player can skip the flash by prssing enter)
# FOR EXAMPLE: I add a flash called Heya to the flash folder.
# # Then, in a event I call the script:
# # $flash.play("Heya.swf", 0)
# # By this way the flash Heya will be played and you won't be
# # able to skip it by pressing 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)
   [MENTION=24071]Sprite[/MENTION] = Sprite.new(viewport)
   [MENTION=24071]Sprite[/MENTION].bitmap = Bitmap.new(flash_width, flash_height)
   [MENTION=38955]val[/MENTION]ue = API_NEW.call(flash_name, flash_width, flash_height,   [MENTION=24071]Sprite[/MENTION].bitmap.address)
@loop = API_GETLOOP.call   [MENTION=38955]val[/MENTION]ue) > 0
   [MENTION=38955]val[/MENTION]id = API_VALID.call   [MENTION=38955]val[/MENTION]ue) > 0
end

def viewport
   [MENTION=24071]Sprite[/MENTION].viewport
end

def update
API_UPDATE.call   [MENTION=38955]val[/MENTION]ue)
end

def dispose
API_FREE.call   [MENTION=24071]Sprite[/MENTION].bitmap.address)
end

def playing?
API_PLAYING.call   [MENTION=38955]val[/MENTION]ue) > 0
end

def pause
API_PAUSE.call   [MENTION=38955]val[/MENTION]ue)
end

def resume
API_RESUME.call   [MENTION=38955]val[/MENTION]ue)
end

def back
API_BACK.call   [MENTION=38955]val[/MENTION]ue)
end

def rewind
API_REWIND.call   [MENTION=38955]val[/MENTION]ue)
end

def forward
API_FORWARD.call   [MENTION=38955]val[/MENTION]ue)
end

def current_frame
API_CURFRAME.call   [MENTION=38955]val[/MENTION]ue)
end

def total_frames
API_TOTALFRAME.call   [MENTION=38955]val[/MENTION]ue)
end

def goto_frame(goal_frame)
API_GOTOFRAME.call   [MENTION=38955]val[/MENTION]ue, goal_frame)
end

def x
   [MENTION=24071]Sprite[/MENTION].x
end

def x=(v)
   [MENTION=24071]Sprite[/MENTION].x = v
end

def y
   [MENTION=24071]Sprite[/MENTION].y
end

def y=(v)
   [MENTION=24071]Sprite[/MENTION].y = v
end

def z
   [MENTION=24071]Sprite[/MENTION].z
end

def z=(v)
   [MENTION=24071]Sprite[/MENTION].z = v
end

def width
   [MENTION=24071]Sprite[/MENTION].bitmap.width
end

def height
   [MENTION=24071]Sprite[/MENTION].bitmap.height
end

def loop?
@loop
end

def loop=(v)
if @loop != v
@loop = v
API_SETLOOP.call   [MENTION=38955]val[/MENTION]ue, v)
end
end

def msg_to_flash(msg, wParam, lParam)
return API_SENDMSG.call   [MENTION=38955]val[/MENTION]ue, 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(512, 384)
fondo.bitmap.fill_rect(0, 0, 512, 384, Color.new(0,0,0,255))
fls = RMFlash.load(filename, 512, 384)
fls.loop = 1
fls.z = 999999
@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
y guardar.

Luego debemos pegar el otro script arriba de Main, bajo el nombre de "Intro2" si pusiste "Intro1" al otro o "Video2" si al otro le pusistes "Video1"
Y aquí este sin los fallos del foro:
Video 2
Código:
#===============================================================================
#
# * Scene_IntroFlash by Dahrkael using �眼的�娜 Flash Player
#   Adapted to Pokemon Essentials by Peaverin                                                                                                            v1.0
#    Requires the .dll and .ocx
#===============================================================================
class Scene_IntroFlash
 
  def initialize
     # Set the file which will be played
     @file = "intro.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(512, 384)
     @fondo.bitmap.fill_rect(0, 0, 512, 384, Color.new(0,0,0,255))
     @fondo.z = -1
     # Set flash video
     fls = RMFlash.load(@file, 512, 384)
     fls.loop = 1
     fls.z = 999999
     # 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 = pbCallTitle
     Graphics.freeze
     # Little solution for frozen images
     fls.z = -2
     fls.dispose
     # Set old frame rate
     Graphics.frame_rate = @fr
  end
end

Y luego deberás buscar, cerca de la línea 35, algo como ésto:
Código:
$scene = pbCallTitle
y reemplazarlo con esto:
Código:
$scene = Scene_IntroFlash.new

Ya con todo esto, cuando queramos poner nuestra intro, debemos pegar el archivo ".swf" en la carpeta que creamos antes, "Flash". Y si quieres llamar al Script y poner un "video" wow si que uso muchas comillas en el juego, deberás poner el siguiente evento:
Código:
$flash.play("file.swf", button)
En donde "file" es el nombre del archivo que quieran reproducir, y "button" es si el jugador puede saltarlo o no, siendo 0 que no pueda y 1 que si.
También cabe remarcar que hay una parte del primer script que dice "#{CUR_PATH}/Graphics/Flash/#{name}"
y hay que reemplazar el "#{name}" por el nombre del archivo swf.
Espero les haya servido y si es así, dame un +Gracias.
¡Alola!
 
Última edición:
M

Miembro eliminado 28262

Invitado
Bonito tutorial papu
algo que me encanta del codigo libre de Essentials, es que es parecido a C y es totalmente comprensible si se le presta un poco de atención.
En fin, lamento no extenderme más porque estoy exhausto pero creeme que es un aportazo, lo he visto en varios juegos pero ni idea de como insertarlo, seguro le será de suma utilidad e importancia a los que quieran empezar con el pie derecho su proyecto en RPM
Gracias por aportar al foro!, No te olvides reclamar tu Xtraball a @KleinStudio

Saludos y Buenas vibras!

~SAGE
 

White

--------------------------------------------------
He completado todos los pasos pero al entrar al juego me dice:

---------------------------
Pokemon Worlds
---------------------------
Script 'Video1' line 126: SyntaxError occurred.
---------------------------
Aceptar
---------------------------
 

Kaiser de Emperana

Called in hand
He completado todos los pasos pero al entrar al juego me dice:

---------------------------
Pokemon Worlds
---------------------------
Script 'Video1' line 126: SyntaxError occurred.
---------------------------
Aceptar
---------------------------
Cuando @Diego Mertens copió los scripts en el post se ve que estos perdieron el formato. Hay líneas del código cortadas a la mitad por alguna razón.

Podés sacar los scripts del post original de pokecommunity (el link está al principio de este tema).
 

Kaiser de Emperana

Called in hand
No hice nada mas y si tengo la animación.
No te sabría decir la verdad, ando sin RPG Maker para probarlo. Además hay algunas cosas del script que no le veo mucho sentido.
En la línea que dice:
Código:
new("#{CUR_PATH}/Graphics/Flash/Untitled.swf".u2s, width, height, v)
Tendría más sentido así:
Código:
new(("#{CUR_PATH}/Graphics/Flash/" + name).u2s, width, height, v)
Pero bueno, alguien que ande mejor con RGSS que yo y tenga RPG Maker te va a poder ayudar más.

PD: ¿Con qué nombre tenés guardada tu intro? Es "intro.swf" y está en la carpeta Flash ¿cierto?
 

Diego Mertens

Dartrix Joven
No te sabría decir la verdad, ando sin RPG Maker para probarlo. Además hay algunas cosas del script que no le veo mucho sentido.
En la línea que dice:
Código:
new("#{CUR_PATH}/Graphics/Flash/Untitled.swf".u2s, width, height, v)
Tendría más sentido así:
Código:
new(("#{CUR_PATH}/Graphics/Flash/" + name).u2s, width, height, v)
Pero bueno, alguien que ande mejor con RGSS que yo y tenga RPG Maker te va a poder ayudar más.

PD: ¿Con qué nombre tenés guardada tu intro? Es "intro.swf" y está en la carpeta Flash ¿cierto?
En efecto, es línea es así:
Código:
new("#{CUR_PATH}/Graphics/Flash/#{name}".u2s, width, height, v)
realmente no sé porqué estaba así, porque así solo se reproduciría el Untitled.swf xd
 
Está genial, ya hice mi intro y todo, peeero me salta error al poner el juego. Me sale:
---------------------------
Pokemon Essentials
---------------------------
????? 'Intro1' ? 285 ??? NoMethodError ????????

undefined method `play' for nil:NilClass
---------------------------
Aceptar
---------------------------


He intentado un monton de cosas pero no lo soluciono :,u en donde me sale el error es en esta parte: $flash.play("intro.swf", 1)

tambien he probado sin esa parte del script peroo al iniciar el juego el intro no sale :c
 
si, lo puse en orden, pero hay alguna falla en los scripts? por que me sale el error DD::

-------------------

Intro1:

#==============================================================================#
# Version 0.3 #
# RPG Maker XP Flash Player #
# #
# Author: ????? Updated by: Dark_Wolf_Warrior/Dahrkael #
# # Peaverin: Adapt to Essentials + tutorial(optional credits)
# How to Use: #
# 1. Create the folder Graphics/Flash and insert there the movies.
# #
# 2. If you want to play a flash at any moment insert: #
# $flash.play("file.swf", button)
# file= the name of the flash to be played
# button= 0(the player can't skip the flash by pressing enter)
# button= 1(the player can skip the flash by prssing enter)
# FOR EXAMPLE: I add a flash called Heya to the flash folder.
# # Then, in a event I call the script:
# # $flash.play("Heya.swf", 0)
# # By this way the flash Heya will be played and you won't be
# # able to skip it by pressing 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/#{intro.swf}".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, buttton)
fondo = Sprite.new
fondo.bitmap = Bitmap.new(512, 384)
fondo.bitmap.fill_rect(0, 0, 512, 384, Color.new(0,0,0,255))
fls = RMFlash.load(filename, 512, 384)
fls.loop = 1
fls.z = 999999
@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
$flash.play("intro.swf", 1)


-----------------------------

Intro2:

#===============================================================================
#
# * Scene_IntroFlash by Dahrkael using 灼眼的夏娜 Flash Player
# Adapted to Pokemon Essentials by Peaverin v1.0
# Requires the .dll and .ocx
#===============================================================================
class Scene_IntroFlash

def initialize
# Set the file which will be played
@file = "intro.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(512, 384)
@fondo.bitmap.fill_rect(0, 0, 512, 384, Color.new(0,0,0,255))
@fondo.z = -1
# Set flash video
fls = RMFlash.load(@file, 512, 384)
fls.loop = 1
fls.z = 999999
# 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 = pbCallTitle
Graphics.freeze
# Little solution for frozen images
fls.z = -2
fls.dispose
# Set old frame rate
Graphics.frame_rate = @fr
end
end

---------------------------------------------

esta en orden pero supongo algo me falto modificar, o quizas un error en el script
 
Última edición por un moderador:

Diego Mertens

Dartrix Joven
si, lo puse en orden, pero hay alguna falla en los scripts? por que me sale el error DD::

-------------------

Intro1:

#==============================================================================#
# Version 0.3 #
# RPG Maker XP Flash Player #
# #
# Author: ????? Updated by: Dark_Wolf_Warrior/Dahrkael #
# # Peaverin: Adapt to Essentials + tutorial(optional credits)
# How to Use: #
# 1. Create the folder Graphics/Flash and insert there the movies.
# #
# 2. If you want to play a flash at any moment insert: #
# $flash.play("file.swf", button)
# file= the name of the flash to be played
# button= 0(the player can't skip the flash by pressing enter)
# button= 1(the player can skip the flash by prssing enter)
# FOR EXAMPLE: I add a flash called Heya to the flash folder.
# # Then, in a event I call the script:
# # $flash.play("Heya.swf", 0)
# # By this way the flash Heya will be played and you won't be
# # able to skip it by pressing 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/#{intro.swf}".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, buttton)
fondo = Sprite.new
fondo.bitmap = Bitmap.new(512, 384)
fondo.bitmap.fill_rect(0, 0, 512, 384, Color.new(0,0,0,255))
fls = RMFlash.load(filename, 512, 384)
fls.loop = 1
fls.z = 999999
@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
$flash.play("intro.swf", 1)


-----------------------------

Intro2:

#===============================================================================
#
# * Scene_IntroFlash by Dahrkael using �眼的�娜 Flash Player
# Adapted to Pokemon Essentials by Peaverin v1.0
# Requires the .dll and .ocx
#===============================================================================
class Scene_IntroFlash

def initialize
# Set the file which will be played
@file = "intro.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(512, 384)
@fondo.bitmap.fill_rect(0, 0, 512, 384, Color.new(0,0,0,255))
@fondo.z = -1
# Set flash video
fls = RMFlash.load(@file, 512, 384)
fls.loop = 1
fls.z = 999999
# 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 = pbCallTitle
Graphics.freeze
# Little solution for frozen images
fls.z = -2
fls.dispose
# Set old frame rate
Graphics.frame_rate = @fr
end
end

---------------------------------------------

esta en orden pero supongo algo me falto modificar, o quizas un error en el script
Te pasaría mis scripts funcionales, pero he perdido mi juego y por ahora no lo tengo. Tendrías que cambiar los Sprite s a sprites
 
Arriba