질문과 답변

Extra Form
#==============================================================================
# ■ Light Effects VX 1.1
#     5.21.2008
#------------------------------------------------------------------------------
#  Script by: Kylock (originally for RMXP by Near Fantastica)
#==============================================================================
#   To make an event glow, give it a Comment: with any of the supported light
# modes.
#   The SWITCH setting below will disable light effects from updating with the
# switch is on.
#==============================================================================
# ● Change Log
#------------------------------------------------------------------------------
# 1.0 - Original Release
# 1.1 - New light modes added: LIGHT2, TORCH, TORCH2
#     - Changed sprite blend mode to ADD (looks slightly better)
#     - Fire-based lights are now red in color
#==============================================================================
# ● Light Modes
#------------------------------------------------------------------------------
#   GROUND - Medium steady white light.
#   FIRE   - Large red light with a slight flicker.
#   LIGHT  - Small steady white light.
#   LIGHT2 - X-Large steady white light.
#   TORCH  - X-Large red light with a heavy flicker.
#   TORCH2 - X-Large red light with a sleight flicker.
#==============================================================================

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
        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
      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
      end
    end
  end
  def update_light_effects
    if $game_switches[1]
      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 - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
      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.opacity = rand(10) + 90
      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
      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
      when "TORCH"
        effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20 + rand(20) - 10
        effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8 + rand(20) - 10
        effect.light.opacity = rand(30) + 70
      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.opacity = rand(10) + 90
      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 = Cache.picture("le.png")
    @light.visible = true
    @light.z = 1000
    @event = event
    @type = type
  end
end









이 빛스크립트를 스위치나 주석으로 turn/off할수있게 편집해주세요 부탁드립니다,

Comment '2'
  • ?
    AltusZeon 2014.08.03 03:00

    설명 읽어보시면 아시겠지만 이미 있는 기능입니다.
    The SWITCH setting below will disable light effects from updating with the switch is on.
    (아래의 스위치 설정은 광원 효과를 켜고 끌 수 있게 해줍니다.)

    스크립트 내에 $game_switches[1]이라고 적힌 부분이 있습니다. (찾기 어려우시면 검색 기능 Ctrl+F로 찾으시길 바랍니다.)
    1이라는 숫자를 원하시는 스위치의 ID로 바꾸셔서 사용하시면 될 것 같습니다.


    스크립트 설명에는 안 나와있지만, 광원 모드가 FIRE와 TORCH일 때는

    스위치를 이용한 광원 효과 켜고 끄기가 안 되는 걸로 보입니다.

  • ?
    붉은 원숭이 2014.08.03 22:34
    아하 제가 FIRE을 써서 켜고끄기가 않됀거였군요 감사합니다!

List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12391
RMVX TileE부분에 있는 맵칩이 전부 안보입니다 file Zombang 2014.08.07 601
RMVX 다운받은 타일을 같이사용하면 파란색부분이남네요.. 1 chol4723 2014.08.05 556
RMVX 주인공주위만밝게하고 어둡게하는 강의를봤는데요 질문이있습니다 1 chol4723 2014.08.05 576
RMVX 포토샵을이용해서 맵을 어둡게하는거 어떻게하죠? 3 chol4723 2014.08.03 704
RMVX 빛스크립트좀 편집해주세요 2 붉은 원숭이 2014.08.03 576
RMVX 타이틀 메뉴 글꼴이나 글씨색은 어떻게바꾸죠? chol4723 2014.08.02 1215
RMVX 그.. 죽으면 돈&경험치 감소하는거 어떻게하나요? 1 sakuragi 2014.07.30 657
RMVX rvdata 데이터 파일 읽는 법 아시나요?? 1 file sojena 2014.07.29 1524
RMVX 몬스터가 사라지는 이벤트 1 rad 2014.07.29 492
RMVX 특정 스크립트를 같이 넣으면 오류가 생깁니다. MMM 2014.07.29 534
RMVX 데이터 파일 -> 텍스트 파일 변환 file sojena 2014.07.27 701
RMVX 게임을 할 때 특정 키로 대사 불러오는 스크립트를 작성할 때 그 대사가 담긴 <대사 데이터> 만드는 방법 질문.. 1 file sojena 2014.07.26 805
RMVX RPG VX로 제작된 게임들의 배경음이 안나오네요 ehfhfh4 2014.07.24 653
RMVX 적을 쓰러뜨려도 배틀러 이미지가 사라지질 않습니다. MMM 2014.07.23 536
RMVX 메뉴창들을 투명하게 할 수 있는 스크립트 위치를 모르겠습니다. 4 file 1년이지났네 2014.07.22 1181
RMVX 아이템을 선택했을 때만 작동하게 하는 방법 1 파프리카 2014.07.21 596
RMVX 장비 옵션이 설정한 것과 다르게 적용되는데, 왜 그런걸까요 MMM 2014.07.20 580
RMVX 저장 제한 1 파프리카 2014.07.20 556
RMVX 주인공이 1명인 게임인데 액터 고르는 메뉴스테이터스 안 나오도록 4 gyro2du 2014.07.18 936
RMVX RPGVX 이름 띄우기 스크립트 겜제작광 2014.07.15 896
Board Pagination Prev 1 ... 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 ... 127 Next
/ 127