질문과 답변

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 12397
RMVX 다운받은 타일을 같이사용하면 파란색부분이남네요.. 1 chol4723 2014.08.05 557
RMVX 주인공주위만밝게하고 어둡게하는 강의를봤는데요 질문이있습니다 1 chol4723 2014.08.05 576
RMVXA 병렬처리한 이벤트를 스위치로 불러오면 대기를 했을 때 그냥 거기서 멈춰버리네요 2 Rebiart 2014.08.04 571
RMXP 메시지 창 위치를 게임 아래쪽에 바싹 붙이고 싶어요 3 file 모르모트 2014.08.04 652
RMVXA 자동대쉬 어떻게 하나요? 1 작삼 2014.08.04 1098
RMVXA 타일을 어떻게 그려야할지 모르겠네요. 2 file q평e평rq평e평 2014.08.04 493
게임찾기 옛날에 하던 게임 찾습니다 ~ 광대버섯 2014.08.04 829
RMVX 포토샵을이용해서 맵을 어둡게하는거 어떻게하죠? 3 chol4723 2014.08.03 704
RMVXA 합성스크립트 유키히로 2014.08.03 564
RMVXA 파티 멤버에 추가하려는 파티원의 레벨을 미리 지정해놓는 방법은 없나요? 2 바크지누크 2014.08.03 611
RMVX 빛스크립트좀 편집해주세요 2 붉은 원숭이 2014.08.03 576
RMVXA 혹시 이런식으로 배틀 못하나요 ? ㅠㅠ Zombang 2014.08.03 531
RMVX 타이틀 메뉴 글꼴이나 글씨색은 어떻게바꾸죠? chol4723 2014.08.02 1215
RMVXA 배틀스크립트.... 궳둟쉟뤯 2014.08.01 459
RMVXA ACE사이드뷰 스크립트 질문 메이133 2014.08.01 725
RMXP xp는 앨범 스크립트가 없을까요? Amaranth 2014.08.01 515
RMXP 액터의 시야 제한 1 아파트로 2014.07.30 720
RMVXA 이동 관련하여 질문드립니다. 2 쿠로이치니상시고로쿠시치하치큐 2014.07.30 603
RMVXA 정지상태의 캐릭터 칩설정 질문좀요. 3 file 메이133 2014.07.30 754
RMVX 그.. 죽으면 돈&경험치 감소하는거 어떻게하나요? 1 sakuragi 2014.07.30 657
Board Pagination Prev 1 ... 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 ... 516 Next
/ 516