질문과 답변

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 12392
RMVX 직접 제작한 BGM 게임내 재생 속도 오류 1 KingRynn 2013.08.15 1083
RMVX 직업의 따른 아이템 사용 가능 여부 4 겜제작광 2013.12.24 659
RMVX 직업변경 질문점 2 seamo 2011.01.26 691
RMVX 직업 질문이요!! ㅜ 2 반나드람 2011.02.18 538
RMVX 직업 질문... 초보 살려 3 반나드람 2011.02.23 669
RMVX 직업 전직 할때 렙제 거는법 2 dksrlxo46 2010.10.25 996
RMVX 지형 지우는거 어떻게 하죠? 1 후라이팬샷 2013.07.29 639
RMVX 지형 무시하고 이동이 됩니다 4 후라이팬샷 2013.08.22 925
RMVX 지진이나 화면 흔들림 효과 2 후라이팬샷 2013.08.23 1363
RMVX 지정위치의지형설정ID취득 1 다탄감자 2011.05.31 840
RMVX 지붕에 있는 그림자 없애는 방법좀요!! 3 file 오그리토그리 2011.07.27 1381
RMVX 지금 미치겠습니다........................ 2 file 아쳐 2015.05.28 214
RMVX 죽은 엑터 시로네 2012.01.08 2515
RMVX 죽은 동료 파티에서 자동으로 빠지게 하려면 어떻게 해야 하나요? 4 존스노우 2012.07.04 1460
RMVX 죽은 동료 경험치 2 알사탕 2012.06.20 1177
RMVX 죽었을 때 게임오버 안당하고 특정한 곳으로 이동하는 방법 1 정말귀인★ 2013.10.21 984
RMVX 죽었거나 쓰러져있는 동물(특히 강아지) 어디서 얻죠? 2 2013.12.25 791
RMVX 주점 안으로 들어가면 안 움직여져요 ㅠㅠ 4 file 우르곳 2013.07.27 1088
RMVX 주인공캐릭터 2 아방스친구 2011.01.08 627
RMVX 주인공주위만밝게하고 어둡게하는 강의를봤는데요 질문이있습니다 1 chol4723 2014.08.05 576
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