O TEMA DO FÓRUM ESTÁ EM MANUTENÇÃO. FEEDBACKS AQUI: ACESSAR

Light Effects XP

Iniciado por Raizen, 16/12/2012 às 19:24

Light Effects XP

Compativel com: ]RMXP
Compatibilidade :média
Facilidade de uso: médio
Lag gerado: baixo
[box class=titlebg]
Condições de Uso
[/box]
  Não especificado pelo autor

[box class=titlebg]
Para que serve o script
[/box]
 
  Sistema de iluminação para RMXP, utilizando imagens


[box class=titlebg]
Script
[/box]

#==============================================================================
#========================== Light Effects XP 2.1 ==============================
#------------------------------------------------------------------------------
#  Script de: Kylock (originalmente para RMXP por Near Fantastica)
#  Tradução por Equipe Gemstone
#  Novos modos de luz da versão 2.0 por Kbça
#  Disponibilizado por Massakmkz
#==============================================================================
#   Para fazer com que um evento brilhe, escreva um Comentário: com qualquer um
#                dos modos de luz suportados abaixo.
#=============================== Versões ======================================
# 1.0 - Lançamento original
# 1.1 - Novos modos de luz adicionados: LIGHT2, TORCH, TORCH2.
#     - Mudou o modo de blend do sprite para Adicionar (parece um pouco melhor).
#     - Luzes de fogo agora estão com tonalidade vermelha.
# 2.0 - Novos modos de luz adicionados: (by Kbça)
#       XENON, BLOOD, GREEN, WHITE, CYAN, PINK e YELLOW
# 2.1 - Alguns bugs concertados: (by Massakmkz)
#============================= Modos de Luz ====================================
#   GROUND - Médio alcance e luz branca.
#   FIRE   - Luz vermelha que oscila levemente.
#   LIGHT  - Alcance curto e luz branca.
#   LIGHT2 - Longo alcance e luz branca.
#   TORCH  - Grande luz vermelha com muita oscilação.
#   TORCH2 - Grande luz vermelha que oscila levemente.
#   XENON  - Alcançe médio, luz azul imitando Xenon.
#   BLOOD  - Luz vermelho-sangue de alcançe médio, ideal para jogos de terror!
#   GREEN  - Luz verde de médio alcançe.
#   WHITE  - Luz branca de médio alcançe, porém mais forte que GROUND e LIGHT.
#   CYAN   - Alcançe médio, cor verde piscina e um tanto forte.
#   PINK   - Cor rosa, de médio alcançe.
#   YELLOW - Luz forte de médio alcançe de cor amarela.
#==============================================================================

class Spriteset_Map
  alias les_spriteset_map_initalize initialize
  alias les_spriteset_map_dispose dispose
  alias les_spriteset_map_update update
  def initialize
    @light_effects = []
    setup_lights
    les_spriteset_map_initalize
    update
  end
  def dispose
    les_spriteset_map_dispose
    for effect in @light_effects
      effect.light.dispose
    end
    @light_effects = []
  end
  def update
    les_spriteset_map_update
    update_light_effects
  end
  def setup_lights
    for event in $game_map.events.values
      next if event.list == nil
      for i in 0...event.list.size
        if event.list[i].code == 108 and event.list[i].parameters == ["GROUND"]
          type = "GROUND"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 2
          light_effects.light.zoom_y = 2
          light_effects.light.opacity = 100
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["FIRE"]
          type = "FIRE"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 300 / 100.0
          light_effects.light.zoom_y = 300 / 100.0
          light_effects.light.opacity = 100
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT"]
          type = "LIGHT"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 1
          light_effects.light.zoom_y = 1
          light_effects.light.opacity = 150
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT2"]
          type = "LIGHT2"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 6
          light_effects.light.zoom_y = 6
          light_effects.light.opacity = 150
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["TORCH"]
          type = "TORCH"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 6
          light_effects.light.zoom_y = 6
          light_effects.light.opacity = 150
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["TORCH2"]
          type = "TORCH2"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 6
          light_effects.light.zoom_y = 6
          light_effects.light.opacity = 150
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["XENON"]
          type = "XENON"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 2
          light_effects.light.zoom_y = 2
          light_effects.light.opacity = 150
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["BLOOD"]
          type = "BLOOD"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 2
          light_effects.light.zoom_y = 2
          light_effects.light.opacity = 150
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["GREEN"]
          type = "GREEN"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 2
          light_effects.light.zoom_y = 2
          light_effects.light.opacity = 150
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["WHITE"]
          type = "WHITE"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 2
          light_effects.light.zoom_y = 2
          light_effects.light.opacity = 180
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["CYAN"]
          type = "CYAN"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 2
          light_effects.light.zoom_y = 2
          light_effects.light.opacity = 180
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["PINK"]
          type = "PINK"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 2
          light_effects.light.zoom_y = 2
          light_effects.light.opacity = 180
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["YELLOW"]
          type = "YELLOW"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 2
          light_effects.light.zoom_y = 2
          light_effects.light.opacity = 180
          @light_effects.push(light_effects)
        end
      end
    end
    for effect in @light_effects
      case effect.type
      when "GROUND"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.blend_type = 1
      when "FIRE"
        effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
        effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
        effect.light.tone = Tone.new(255,-100,-255,   0)
        effect.light.blend_type = 1
      when "LIGHT"
        effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
        effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
        effect.light.blend_type = 1
      when "LIGHT2"
        effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
        effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
        effect.light.blend_type = 1
      when "TORCH"
        effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
        effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(255,-100,-255,   0)
        effect.light.blend_type = 1
      when "TORCH2"
        effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
        effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(255,-100,-255,   0)
        effect.light.blend_type = 1
      when "XENON"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(-200,-200,255,   0)
        effect.light.blend_type = 1
      when "BLOOD"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(255,-230,-230,   0)
        effect.light.blend_type = 1
      when "GREEN"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(-150,255,-150,   0)
        effect.light.blend_type = 1
      when "WHITE"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(255,255,255,   0)
        effect.light.blend_type = 1
      when "CYAN"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(-255,0,0,   0)
        effect.light.blend_type = 1
      when "PINK"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(0,-255,0,   0)
        effect.light.blend_type = 1
      when "YELLOW"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(0,0,-255,   0)
        effect.light.blend_type = 1
      end
    end
  end
  def update_light_effects
    if $game_switches[13]# Controle de luz (nome do switch)
      for effect in @light_effects
        next if effect.type == "FIRE" || effect.type == "TORCH"
        effect.light.visible = false
      end
    else
      for effect in @light_effects
        next if effect.type == "FIRE" || effect.type == "TORCH"
        effect.light.visible = true
      end
    end
    for effect in @light_effects
      case effect.type
      when "GROUND"
        effect.light.x = (effect.event.real_x - $game_map.display_x) / 4 -82
        effect.light.y = (effect.event.real_y - $game_map.display_y) / 4 -82
      when "FIRE"
        effect.light.x = (effect.event.real_x - $game_map.display_x) / 4 -82 + rand(6) - 3
        effect.light.y = (effect.event.real_y - $game_map.display_y) / 4 -82 + rand(6) - 3
        effect.light.opacity = rand(10) + 90
      when "LIGHT"
        effect.light.x = (-0.25 / 1 * $game_map.display_x) + (effect.event.x * 32) - 15
        effect.light.y = (-0.25 / 1 * $game_map.display_y) + (effect.event.y * 32) - 15
      when "LIGHT2"
        effect.light.x = (effect.event.real_x - $game_map.display_x) / 4 -82 - 20
        effect.light.y = (effect.event.real_y - $game_map.display_y) / 4 -82
      when "TORCH"
        effect.light.x = (effect.event.real_x - $game_map.display_x) / 4 -82 - 20 + rand(20) - 10
        effect.light.y = (effect.event.real_y - $game_map.display_y) / 4 + rand(20) - 10
        effect.light.opacity = rand(30) + 70
      when "TORCH2"
        effect.light.x = (effect.event.real_x - $game_map.display_x) / 4 -82 - 20
        effect.light.y = (effect.event.real_y - $game_map.display_y) / 4 -82
        effect.light.opacity = rand(10) + 90
      when "XENON"
        effect.light.x = (effect.event.real_x - $game_map.display_x) / 4 -82
        effect.light.y = (effect.event.real_y - $game_map.display_y) / 4 -82
      when "BLOOD"
        effect.light.x = (effect.event.real_x - $game_map.display_x) / 4 -82
        effect.light.y = (effect.event.real_y - $game_map.display_y) / 4 -82
      when "GREEN"
        effect.light.x = (effect.event.real_x - $game_map.display_x) / 4 -82
        effect.light.y = (effect.event.real_y - $game_map.display_y) / 4 -82
      when "WHITE"
        effect.light.x = (effect.event.real_x - $game_map.display_x) / 4 -82
        effect.light.y = (effect.event.real_y - $game_map.display_y) / 4 -82
      when "CYAN"
        effect.light.x = (effect.event.real_x - $game_map.display_x) / 4 -82
        effect.light.y = (effect.event.real_y - $game_map.display_y) / 4 -82
      when "PINK"
        effect.light.x = (effect.event.real_x - $game_map.display_x) / 4 -82
        effect.light.y = (effect.event.real_y - $game_map.display_y) / 4 -82
      when "YELLOW"
        effect.light.x = (effect.event.real_x - $game_map.display_x) / 4 -82
        effect.light.y = (effect.event.real_y - $game_map.display_y) / 4 -82
      end
    end
  end
end

class Light_Effect
  attr_accessor :light
  attr_accessor :event
  attr_accessor :type
  def initialize(event, type)
    @light = Sprite.new
    @light.bitmap = RPG::Cache.picture("le.png")
    @light.visible = true
    @light.z = 1000
    @event = event
    @type = type
  end
end


[box class=titlebg]
Download
[/box]
http://www.4shared.com/file/8tIHoDVk/Light_Effects_XP.html


[box class=titlebg]
Imagens
[/box]

Spoiler
[close]

[box class=titlebg]
Créditos e Avisos
[/box]

Near Fantastica
Kylock : Conversão

Nossa muito legal
Eu tentei aqui é muito show !  :o__o:
Até me "inspirei" a tentar criar um game de horror/terror......
............repitindo TENTAR
heuehuehueheuhuheu vlw !
Gabriel Nunes  :derp:

Melhor do que fazer cada sombra e luz manualmente no Photoshop :ok: