12 de setembro de 2012 16:46:08 ART
Achei esse script aqui muuuito loko. Da so uma olhada nos efeitos que ele pode fazer com simples Fogs:
Demo do Near
Criado pelo poderoso Near Fantastica baseado no script do PinkMan. Esse script requer a biblioteca pro RGSS, SKD.
Link para o SKD 1.3: http://www.rmxponline.com/programs/sdk/SDK%20v1.3.txt
Crie um script acima do Main e coloque esse script:
Código:
#==============================================================================
# ** Particle Engine
#==============================================================================
# Near Fantastica
# Version 2
# 04.01.06
#==============================================================================
# Based on the Particle Engine designed by PinkMan
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log("Particle Engine", "Near Fantastica", 2, "04.01.06")
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state("Particle Engine") == true
class Particle_Engine
#--------------------------------------------------------------------------
def initialize(viewport)
@viewport = viewport
@effect = []
end
#--------------------------------------------------------------------------
def add_effect(event)
type = SDK.event_comment_input(event, 1, "Particle Engine Type")
return if type.nil?
case type[0].downcase
when "fire"
@effect[event.id] = Particle_Engine::Fire.new(event,@viewport)
when "smoke"
@effect[event.id] = Particle_Engine::Smoke.new(event,@viewport)
when "teleport"
@effect[event.id] = Particle_Engine::Teleport.new(event,@viewport)
when "spirit"
@effect[event.id] = Particle_Engine::Spirit.new(event,@viewport)
when "explosion"
@effect[event.id] = Particle_Engine::Explosion.new(event,@viewport)
when "aura"
@effect[event.id] = Particle_Engine::Aura.new(event,@viewport)
end
end
#--------------------------------------------------------------------------
def remove_effect(event)
return if @effect[event.id].nil?
@effect[event.id].dispose
@effect.delete_at(event.id)
end
#--------------------------------------------------------------------------
def update
for particle in @effect
next if particle.nil?
particle.update
end
end
#--------------------------------------------------------------------------
def dispose
for particle in @effect
next if particle.nil?
particle.dispose
end
@effect = []
end
#===========================================================================
class Particle_Engine::Fire
#------------------------------------------------------------------------
def initialize(event, viewport)
@event = event
@xoffset = -5 # offset for the x
@yoffset = -13 # offset for the y
@leftright = 0 # This is made to help the "fire" effect
@maxparticless = 20 # Wouldnt suggest going any higher then 478
@hue = 40 # Starting hue color
@slowdown = 0.5 # This will slow down the particless
@ytop = 0 # Top half of the screen pixel
@ybottom = 480 # Screen Height
@xleft = 0 # First pixel to the left
@xright = 640 # Screen Width
@xgravity = 0.5 # Gravity for x axis (goes by tens)
@ygravity = 0.10 # Gravity for y axis (goes by tens)
@particles = []
@opacity = []
@startingx = event.screen_x + @xoffset
@startingy = event.screen_y + @yoffset
@screen_x = @event.screen_x
@screen_y = @event.screen_y
for i in 0...@maxparticless
@particles = Sprite.new(viewport)
@particles.bitmap = RPG::Cache.fog("particle", @hue)
@particles.blend_type = 1
@particles.y = @startingy
@particles.x = @startingx
@particles.z = @event.screen_z
@opacity = 250
end
end
#------------------------------------------------------------------------
def update
@startingx = @event.screen_x + @xoffset
@startingy = @event.screen_y + @yoffset
offsetx = @event.screen_x - @screen_x
@screen_x = @event.screen_x
offsety = @event.screen_y - @screen_y
@screen_y = @event.screen_y
for i in 0...@maxparticless
@particles.z = @event.screen_z
if @particles.y <= @ytop
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.x <= @xleft
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.y >= @ybottom
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.x >= @xright
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @fade == 0
if @opacity <= 0
@opacity = @originalopacity
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
else
if @opacity <= 0
@opacity = 250
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
end
if @randomhue == 1
if @hue == 360
@hue = 0
end
@hue = @hue + 0.5
@particles.bitmap = RPG::Cache.fog("particle", @hue)
end
@opacity = @opacity - rand(30)
@leftright = rand(2)
if @leftright == 1
@particles.x = (@particles.x - (@xgravity / @slowdown)) + offsetx
else
@particles.x = (@particles.x + (@xgravity / @slowdown)) + offsetx
end
@particles.y = (@particles.y - (@ygravity / @slowdown)) + offsety
@particles.opacity = @opacity
end
end
#------------------------------------------------------------------------
def dispose
for particle in @particles
particle.dispose
end
@particles = []
end
end
#===========================================================================
class Particle_Engine::Smoke
#------------------------------------------------------------------------
def initialize(event, viewport)
@event = event
@leftright = 0 # This is made to help the "fire" effect
@fade = 0 # Opacity wont change at all 0 = yes, 1 = no
@originalopacity = 80 # this will only work if the one above is 0
@maxparticless = 20 # Wouldnt suggest going any higher then 478
@hue = 0 # Starting hue color
@slowdown = 0.5 # This will slow down the particless
@ytop = 0 # Top half of the screen pixel
@ybottom = 480 # Screen Height
@xleft = 0 # First pixel to the left
@xright = 640 # Screen Width
@xgravity = 0.5 # Gravity for x axis (goes by tens)
@ygravity = 0.10 # Gravity for y axis (goes by tens)
@xoffset = -5 # offset for the x
@yoffset = -15 # offset for the y
@particles = []
@opacity = []
@startingx = @event.screen_x + @xoffset
@startingy = @event.screen_y + @yoffset
@screen_x = @event.screen_x
@screen_y = @event.screen_y
for i in 0...@maxparticless
@particles = Sprite.new(viewport)
@particles.bitmap = RPG::Cache.fog("smoke", @hue)
@particles.blend_type = 1
@particles.y = @startingy
@particles.x = @startingx
@particles.z = @event.screen_z
@opacity = 100
end
end
#------------------------------------------------------------------------
def update
@startingx = @event.screen_x + @xoffset
@startingy = @event.screen_y + @yoffset
offsetx = @event.screen_x - @screen_x
@screen_x = @event.screen_x
offsety = @event.screen_y - @screen_y
@screen_y = @event.screen_y
for i in 0...@maxparticless
@particles.z = @event.screen_z
if @particles.y <= @ytop
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.x <= @xleft
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.y >= @ybottom
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.x >= @xright
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @fade == 0
if @opacity <= 0
@opacity = @originalopacity
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
else
if @opacity <= 0
@opacity = 250
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
end
if @randomhue == 1
if @hue == 360
@hue = 0
end
@hue = @hue + 0.5
@particles.bitmap = RPG::Cache.fog("smoke", @hue)
end
@opacity = @opacity - rand(5)
@leftright = rand(2)
if @leftright == 1
@particles.x = (@particles.x - (@xgravity / @slowdown)) + offsetx
else
@particles.x = (@particles.x + (@xgravity / @slowdown)) + offsetx
end
@particles.y = (@particles.y - (@ygravity / @slowdown)) + offsety
@particles.opacity = @opacity
end
end
#------------------------------------------------------------------------
def dispose
for particle in @particles
particle.dispose
end
@particles = []
end
end
#===========================================================================
class Particle_Engine::Teleport
#------------------------------------------------------------------------
def initialize(event, viewport)
@event = event
@randomhue = 1 # should the hue change ranomly 0 no 1 yes
@leftright = 0 # This is made to help the "fire" effect
@maxparticless = 10 # Wouldnt suggest going any higher then 478
@hue = 40 # Starting hue color
@slowdown = 0.5 # This will slow down the particless
@ytop = 0 # Top half of the screen pixel
@ybottom = 480 # Screen Height
@xleft = 0 # First pixel to the left
@xright = 640 # Screen Width
@xgravity = 0.5 # Gravity for x axis (goes by tens)
@ygravity = 0.10 # Gravity for y axis (goes by tens)
@xoffset = -8 # offset for the x
@yoffset = -15 # offset for the y
@particles = []
@opacity = []
@startingx = @event.screen_x + @xoffset
@startingy = @event.screen_y + @yoffset
@screen_x = @event.screen_x
@screen_y = @event.screen_y
for i in 0...@maxparticless
@particles = Sprite.new(viewport)
@particles.bitmap = RPG::Cache.fog("portal", @hue)
@particles.blend_type = 1
@particles.y = @startingy
@particles.x = @startingx
@particles.z = @event.screen_z
@opacity = 250
end
end
#------------------------------------------------------------------------
def update
@startingx = @event.screen_x + @xoffset
@startingy = @event.screen_y + @yoffset
offsetx = @event.screen_x - @screen_x
@screen_x = @event.screen_x
offsety = @event.screen_y - @screen_y
@screen_y = @event.screen_y
for i in 0...@maxparticless
@particles.z = @event.screen_z
if @particles.y <= @ytop
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.x <= @xleft
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.y >= @ybottom
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.x >= @xright
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @fade == 0
if @opacity <= 0
@opacity = @originalopacity
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
else
if @opacity <= 0
@opacity = 250
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
end
if @randomhue == 1
if @hue == 360
@hue = 0
end
@hue = @hue + 0.5
@particles.bitmap = RPG::Cache.fog("portal", @hue)
else
end
@opacity = @opacity - rand(20)
@leftright = rand(2)
@particles.x = @particles.x + offsetx
@particles.y = @particles.y - 3 + offsety
@particles.opacity = @opacity
end
end
#------------------------------------------------------------------------
def dispose
for particle in @particles
particle.dispose
end
@particles = []
end
end
#===========================================================================
class Particle_Engine::Spirit
#------------------------------------------------------------------------
def initialize(event, viewport)
@event = event
@randomhue = 1 # should the hue change ranomly 0 no 1 yes
@leftright = 0 # This is made to help the "fire" effect
@maxparticless = 20 # Wouldnt suggest going any higher then 478
@hue = 40 # Starting hue color
@slowdown = 0.5 # This will slow down the particless, change it to whatever.
@ytop = 0 # Top half of the screen pixel
@ybottom = 480 # Screen Height
@xleft = 0 # First pixel to the left
@xright = 640 # Screen Width
@xgravity = 0.5 # Gravity for x axis (goes by tens)
@ygravity = 0.10 # Gravity for y axis (goes by tens)
@xoffset = -5 # offset for the x
@yoffset = -13 # offset for the y
@particles = []
@opacity = []
@startingx = @event.screen_x + @xoffset
@startingy = @event.screen_y + @yoffset
for i in 0...@maxparticless
@particles = Sprite.new(viewport)
@particles.bitmap = RPG::Cache.fog("particle", @hue)
@particles.blend_type = 1
@particles.y = @startingy
@particles.x = @startingx
@particles.z = @event.screen_z
@opacity = 250
end
end
#------------------------------------------------------------------------
def update
@startingx = @event.screen_x + @xoffset
@startingy = @event.screen_y + @yoffset
for i in 0...@maxparticless
@particles.z = @event.screen_z
if @particles.y <= @ytop
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.x <= @xleft
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.y >= @ybottom
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.x >= @xright
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @fade == 0
if @opacity <= 0
@opacity = @originalopacity
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
else
if @opacity <= 0
@opacity = 250
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
end
if @randomhue == 1
if @hue == 360
@hue = 0
end
@hue = @hue + 0.5
@particles.bitmap = RPG::Cache.fog("particle", @hue)
else
end
@opacity = @opacity - rand(30)
@leftright = rand(2)
if @leftright == 1
@particles.x = (@particles.x - (@xgravity / @slowdown))
else
@particles.x = (@particles.x + (@xgravity / @slowdown))
end
@particles.y = (@particles.y - (@ygravity / @slowdown))
@particles.opacity = @opacity
end
end
#------------------------------------------------------------------------
def dispose
for particle in @particles
particle.dispose
end
@particles = []
end
end
#===========================================================================
class Particle_Engine::Explosion
#------------------------------------------------------------------------
def initialize(event, viewport)
@event = event
@randomhue = 0 # should the hue change ranomly 0 no 1 yes
@leftright = 0 # This is made to help the "fire" effect
@maxparticless = 20 # Wouldnt suggest going any higher then 478
@hue = 0 # Starting hue color
@slowdown = 0.5 # This will slow down the particles
@ytop = 0 # Top half of the screen pixel
@ybottom = 480 # Screen Height
@xleft = 0 # First pixel to the left
@xright = 640 # Screen Width
@xgravity = 0.5 # Gravity for x axis (goes by tens)
@ygravity = 0.10 # Gravity for y axis (goes by tens)
@xoffset = -5 # offset for the x
@yoffset = -13 # offset for the y
@particles = []
@opacity = []
@startingx = @event.screen_x + @xoffset
@startingy = @event.screen_y + @yoffset
@screen_x = @event.screen_x
@screen_y = @event.screen_y
for i in 0...@maxparticless
@particles = Sprite.new(viewport)
@particles.bitmap = RPG::Cache.fog("explosion", @hue)
@particles.blend_type = 1
@particles.y = @startingy
@particles.x = @startingx
@particles.z = @event.screen_z
@opacity = 250
end
end
#------------------------------------------------------------------------
def update
@startingx = @event.screen_x + @xoffset
@startingy = @event.screen_y + @yoffset
offsetx = @event.screen_x - @screen_x
@screen_x = @event.screen_x
offsety = @event.screen_y - @screen_y
@screen_y = @event.screen_y
for i in 0...@maxparticless
@particles.z = @event.screen_z
if @particles.y <= @ytop
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.x <= @xleft
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.y >= @ybottom
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.x >= @xright
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @fade == 0
if @opacity <= 0
@opacity = @originalopacity
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
else
if @opacity <= 0
@opacity = 250
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
end
if @randomhue == 1
if @hue == 360
@hue = 0
end
@hue = @hue + 0.5
@particles.bitmap = RPG::Cache.fog("particle", @hue)
else
end
@opacity = @opacity - rand(30)
@leftright = rand(2)
if @leftright == 1
@particles.x = (@particles.x - (@xgravity / @slowdown)) + offsetx
else
@particles.x = (@particles.x + (@xgravity / @slowdown)) + offsetx
end
@particles.y = (@particles.y - (@ygravity / @slowdown)) + offsety
@particles.opacity = @opacity
end
end
#------------------------------------------------------------------------
def dispose
for particle in @particles
particle.dispose
end
@particles = []
end
end
#===========================================================================
class Particle_Engine::Aura
#------------------------------------------------------------------------
def initialize(event, viewport)
@event = event
@s = 0 # Just a variable to save the math
@randomhue = 0 # Should the hue change ranomly 0 no 1 yes
@leftright = 0 # This is made to help the "fire" effect
@maxparticless = 20 # Wouldnt suggest going any higher then 478
@particles = [] # This just hold all of the sprites
@hue = 0 # Starting hue color
@slowdown = 0.5 # This will slow down the particless
@ytop = 0 # Top half of the screen pixel
@ybottom = 480 # Screen Height
@xleft = 0 # First pixel to the left
@xright = 640 # Screen Width
@xgravity = 0.5 # Gravity for x axis (goes by tens)
@ygravity = 0.10 # Gravity for y axis (goes by tens)
@opacity = [] # This is the opacity for every particles
@xoffset = -5 # offset for the x
@yoffset = -13 # offset for the y
@particles = []
@opacity = []
@startingx = @event.screen_x + @xoffset
@startingy = @event.screen_y + @yoffset
@screen_x = @event.screen_x
@screen_y = @event.screen_y
for i in 0...@maxparticless
@particles = Sprite.new(viewport)
@particles.bitmap = RPG::Cache.fog("particle", @hue)
@particles.blend_type = 1
@particles.y = @startingy
@particles.x = @startingx
@particles.z = @event.screen_z
@opacity = 250
end
end
#------------------------------------------------------------------------
def update
@startingx = @event.screen_x + @xoffset
@startingy = @event.screen_y + @yoffset
offsetx = @event.screen_x - @screen_x
@screen_x = @event.screen_x
offsety = @event.screen_y - @screen_y
@screen_y = @event.screen_y
for i in 0...@maxparticless
@particles.z = @event.screen_z
if @particles.y <= @ytop
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.x <= @xleft
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.y >= @ybottom
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @particles.x >= @xright
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
if @fade == 0
if @opacity <= 0
@opacity = @originalopacity
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
else
if @opacity <= 0
@opacity = 250
@particles.y = @startingy + @yoffset
@particles.x = @startingx + @xoffset
end
end
if @randomhue == 1
if @hue == 360
@hue = 0
end
@hue = @hue + 0.5
@particles.bitmap = RPG::Cache.fog("particle", @hue)
else
end
@opacity = @opacity - rand(30)
@leftright = rand(2)
if @leftright == 1
@particles.x = (@particles.x - 2) + offsetx
@particles.y = (@particles.y - 2) + offsety
else
@particles.x = (@particles.x + 2) + offsetx
@particles.y = (@particles.y - 2) + offsety
end
#@particles.angle = @particles.angle + 1
@particles.opacity = @opacity
end
end
#------------------------------------------------------------------------
def dispose
for particle in @particles
particle.dispose
end
@particles = []
end
end
#===========================================================================
end
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
# This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
attr_accessor :pe_refresh
#--------------------------------------------------------------------------
alias nf_particles_game_map_initialize initialize
alias nf_particles_game_map_refresh refresh
#--------------------------------------------------------------------------
def initialize(map_id, event)
@pe_refresh = false
nf_particles_game_map_initialize(map_id, event)
end
#--------------------------------------------------------------------------
def refresh
nf_particles_game_map_refresh
@pe_refresh = true
end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc.
# It's used within the Scene_Map class.
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
alias nf_particles_spriteset_map_init_viewports init_viewports
alias nf_particles_spriteset_map_dispose dispose
alias nf_particles_spriteset_map_update_character_sprites update_character_sprites
alias nf_particles_spriteset_map_update update
#--------------------------------------------------------------------------
def init_viewports
nf_particles_spriteset_map_init_viewports
@particle_engine = Particle_Engine.new(@viewport1)
end
#--------------------------------------------------------------------------
def dispose
nf_particles_spriteset_map_dispose
@particle_engine.dispose
end
#--------------------------------------------------------------------------
def update_character_sprites
nf_particles_spriteset_map_update_character_sprites
for sprite in @character_sprites
next unless sprite.character.is_a?(Game_Event)
if sprite.character.pe_refresh == true
sprite.character.pe_refresh = false
@particle_engine.remove_effect(sprite.character)
@particle_engine.add_effect(sprite.character)
end
end
end
#--------------------------------------------------------------------------
def update
nf_particles_spriteset_map_update
@particle_engine.update
end
end
#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end
-----------------------------------------
Pra usar esse script e fazer os efeitos de luz é muito fácil. Primeiramente você deve pegar o pacote dessas imagens e colocar todas na pasta Graphics/Fogs: http://rapidshare.de/files/10553010/fogs.rar.html
E para fazer com que as luzes apareçam e sigam o evento também é muito fácil. É só você ir no evento que deseja e colocar 2 comentários, Particle Engine Type e "Tipo". Sendo que os Tipos podem ser 6 (obedeçam as letras minúsculas):
- fire
efeito de fogo
- smoke
efeito de fumaça
- teleport
um efeito de luz bastante interessante que muda de cor
- spirit
aquele efeito de luz que aparece na primeira screen
- explosion
explosões
- aura
parecido com o spirit so que mais rápido
Então, por exemplo, se você quer fazer um foqueira, o evento ficara simplesmente assim:
Boa diversão.