질문과 답변

Extra Form
Comment '3'
  • profile
    Lighna 2012.02.17 20:07

    그림의 표시로 하신거 같은데, 표시하실때 "가산 보통 감산" 세가지중 어느걸로 하셨는지 채크해보세요.

  • ?
    네이피어 2012.02.17 22:06

    $imported = {} if $imported == nil
    $imported["ReiLimitedVision"] = true

    #---------------------------------------------------------------------------
    # ** Rei Module
    #---------------------------------------------------------------------------
    module Rei
      module LimitedVision
      TOG = 11   # Switch Id to activate this script
      HFR = 72   # How far is the picture's placement from the player
                 # 0 is on the player , negative is behind, positive is in front
      IZX = 130  # Initial horizontal zoom % of the visibility
      IZY = 130  # Initial vertical zoom % of the visibility
      # negative = reduce, positive = add
      RUN = -30  # When player's running, visibility will be added/reduced to this %
      STD = 50   # When player's didn't running, visibility will be added/reduced to
                 # this %
      LGT = 15   # Switch Id to activate "player has a flashlight" that can increase
                 # or reduce visibility when flashlight is active
      BUT = Input::F5 # Player must press this button to activate the flashlight
      RWL = 20   # When player's running (flashlight on), visibility will be
                 # added/reduced to this %
      SWL = 80   # When player's didn't running (flashlight on), visibility will be
                 # added/reduced to this %
      DLY = 20   # Delay to change visibility in frames (60frames=1sec)
                 # Higher values are smoother, but may looks weird when running..
                
                
      KTS = false # true = Using KTS, false = not using KTS
      KGC = false  # true = Using KGC's DayNight, false = no   (V.1.2)
     
      # Below is only usable if KTS = true or KGC = true
     
      # Above percentage will be added with these..
     
      # -- For Indoor Maps (Maps without [KTS] OR maps WITH [DN_VOID]) --
      INT = -50  # At the night, visibility will be added/reduced to this %
      IMN = 50   # At the morning, visibility will be added/reduced to this %
      IDY = 75   # At the day, visibility will be added/reduced to this %
      IEN = -25  # At the evening, visibility will be added/reduced to this %
     
      # -- For Outdoor Maps (Maps with [KTS] OR maps WITHOUT [DN_VOID] ) --
      ONT = -30  # At the night, visibility will be added/reduced to this %
      OMN = 75   # At the morning, visibility will be added/reduced to this %
      ODY = 100  # At the day, visibility will be added/reduced to this %
      OEN = -10  # At the evening, visibility will be added/reduced to this %
     
      # V.1.1
      #----
      VSP = []      # < Don't edit or remove this
      #----
     
      USV = 1       # Variable Id used to change visibility.
                    # To change it, just set variable value to one of the number below

      VSP[0] = "av"  # < Visibility picture no.0
      VSP[1] = "av1" # < Visibility picture no.1
      VSP[2] = "av2" # < Visibility picture no.2
      VSP[3] = "av3" # < Visibility picture no.3
      VSP[4] = "av4" # < Visibility picture no.4
      # Add as many as you want
     
      SET = 1        # Set this switch Id on if you want the visibility picture's
                     # tone to be changed with the one below.
                    
      TON = Tone.new(255,255,255,255)
      # To change TON variable in game,
      # use REI::LIMITEDVISION::TON = Tone.new(r,g,b,a)
      # Example : REI::LIMITEDVISION::TON = Tone.new(255,0,0,255)
      # r = red, g = green, b = blue, a = alpha/grey
      end
    end

    #------------------------------------------------------------------------------
    # Module RPG
    #------------------------------------------------------------------------------
    module RPG
      class State
        def mod_vis
          self.note.each_line {|line|
          return line.gsub!('%mod ', '').chomp.to_i if line.include?('%mod ')
          }
          return 0
        end
      end
    end
    #==============================================================================
    # ** Scene_Map
    #------------------------------------------------------------------------------
    #  This class performs the map screen processing.
    #==============================================================================
    class Scene_Map < Scene_Base
      # Alias things
      alias reilimitedvisioninit initialize unless method_defined?('reilimitedvisioninit')
      alias reilimitedvisionstart start unless method_defined?('reilimitedvisionstart')
      alias reilimitedvisionupdate update unless method_defined?('reilimitedvisionupdate')
      alias reilimitedvisionterminate terminate unless method_defined?('reilimitedvisionterminate')
      #--------------------------------------------------------------------------
      # * Initialize
      #--------------------------------------------------------------------------
      def initialize
        $reivisibility_sprite = Game_Picture.new(21)
        reilimitedvisioninit
      end
      #--------------------------------------------------------------------------
      # * Start processing
      #--------------------------------------------------------------------------
      def start
        if $game_switches[Rei::LimitedVision::TOG]
          index = $game_variables[Rei::LimitedVision::USV]
          @pic = Rei::LimitedVision::VSP[index]
          $reivisibility_sprite.show(@pic,1,getvis[0],getvis[1],
          Rei::LimitedVision::IZX+Rei::LimitedVision::STD+mod_state_range[0],
          Rei::LimitedVision::IZY+Rei::LimitedVision::STD+mod_state_range[1],255, 0)
          dovisibilitythingy(1)
          @showed = true
        end
        reilimitedvisionstart
      end
      #--------------------------------------------------------------------------
      # * Get modified range by states
      #--------------------------------------------------------------------------
      def mod_state_range
        result = [0,0]
        for actor in $game_party.members
          next if actor.states.empty?
          for state in actor.states
            next if state.nil? or state.mod_vis == 0
            zoomx = state.mod_vis
            zoomy = state.mod_vis
            result = [zoomx,zoomy]
          end
        end
      return result
      end
      #--------------------------------------------------------------------------
      # * Setup visibility coordinate
      #--------------------------------------------------------------------------
      def getvis
        result = []
          case $game_player.direction
          when 2
            x = $game_player.screen_x
            y = $game_player.screen_y + Rei::LimitedVision::HFR
          when 4
            x = $game_player.screen_x - Rei::LimitedVision::HFR
            y = $game_player.screen_y
          when 6
            x = $game_player.screen_x + Rei::LimitedVision::HFR
            y = $game_player.screen_y
          when 8
            x = $game_player.screen_x
            y = $game_player.screen_y - Rei::LimitedVision::HFR
          end
        result = [x,y]
        return result
      end
      #--------------------------------------------------------------------------
      # * Setup visibility
      #--------------------------------------------------------------------------
      def dovisibilitythingy(dur = Rei::LimitedVision::DLY)
        zoomx = Rei::LimitedVision::IZX + mod_state_range[0]
        zoomy = Rei::LimitedVision::IZY + mod_state_range[1]
        opa = 255
        if Rei::LimitedVision::KTS == true
          if $kts_map_data[$game_map.map_id].outside_tint?
            zoomx += Rei::LimitedVision::ONT if $game_switches[KTS::NIGHT]
            zoomy += Rei::LimitedVision::ONT if $game_switches[KTS::NIGHT]
            zoomx += Rei::LimitedVision::OMN if $game_switches[KTS::DAWN]
            zoomy += Rei::LimitedVision::OMN if $game_switches[KTS::DAWN]
            zoomx += Rei::LimitedVision::ODY if $game_switches[KTS::DAY]
            zoomy += Rei::LimitedVision::ODY if $game_switches[KTS::DAY]
            zoomx += Rei::LimitedVision::OEN if $game_switches[KTS::SUNSET]
            zoomy += Rei::LimitedVision::OEN if $game_switches[KTS::SUNSET]
          else
            zoomx += Rei::LimitedVision::INT if $game_switches[KTS::NIGHT]
            zoomy += Rei::LimitedVision::INT if $game_switches[KTS::NIGHT]
            zoomx += Rei::LimitedVision::IMN if $game_switches[KTS::DAWN]
            zoomy += Rei::LimitedVision::IMN if $game_switches[KTS::DAWN]
            zoomx += Rei::LimitedVision::IDY if $game_switches[KTS::DAY]
            zoomy += Rei::LimitedVision::IDY if $game_switches[KTS::DAY]
            zoomx += Rei::LimitedVision::IEN if $game_switches[KTS::SUNSET]
            zoomy += Rei::LimitedVision::IEN if $game_switches[KTS::SUNSET]
          end
        elsif Rei::LimitedVision::KGC == true
          if $game_map.daynight_void?
            phase = KGC::DayNight::PHASE_VARIABLE
            zoomx += Rei::LimitedVision::ODY if phase == 0
            zoomy += Rei::LimitedVision::ODY if phase == 0
            zoomx += Rei::LimitedVision::OEN if phase == 1
            zoomy += Rei::LimitedVision::OEN if phase == 1
            zoomx += Rei::LimitedVision::ONT if phase == 2
            zoomy += Rei::LimitedVision::ONT if phase == 2
            zoomx += Rei::LimitedVision::OMN if phase == 3
            zoomy += Rei::LimitedVision::OMN if phase == 3
          else
            phase = KGC::DayNight::PHASE_VARIABLE
            zoomx += Rei::LimitedVision::IDY if phase == 0
            zoomy += Rei::LimitedVision::IDY if phase == 0
            zoomx += Rei::LimitedVision::IEN if phase == 1
            zoomy += Rei::LimitedVision::IEN if phase == 1
            zoomx += Rei::LimitedVision::INT if phase == 2
            zoomy += Rei::LimitedVision::INT if phase == 2
            zoomx += Rei::LimitedVision::IMN if phase == 3
            zoomy += Rei::LimitedVision::IMN if phase == 3
          end
        end
        if $game_player.moving? and $game_player.dash?
          zoomx += Rei::LimitedVision::RUN
          zoomy += Rei::LimitedVision::RUN
        else
          zoomx += Rei::LimitedVision::STD
          zoomy += Rei::LimitedVision::STD
        end
        if Input.press?(Rei::LimitedVision::BUT) and $game_switches[Rei::LimitedVision::LGT]
          if $game_player.moving? and $game_player.dash?
            zoomx += Rei::LimitedVision::RWL
            zoomy += Rei::LimitedVision::RWL
          else
            zoomx += Rei::LimitedVision::SWL
            zoomy += Rei::LimitedVision::SWL
          end
        end
        if $game_switches[Rei::LimitedVision::SET]
          $reivisibility_sprite.start_tone_change(Rei::LimitedVision::TON,0)
        else
          $reivisibility_sprite.start_tone_change(Tone.new(0,0,0,0),0)
        end
        $reivisibility_sprite.move(1, getvis[0], getvis[1], zoomx,zoomy,opa, 0, dur)
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        reilimitedvisionupdate
        if $game_switches[Rei::LimitedVision::TOG]
          if @showed == true
            if  @pic != Rei::LimitedVision::VSP[$game_variables[Rei::LimitedVision::USV]]
              @pic = Rei::LimitedVision::VSP[$game_variables[Rei::LimitedVision::USV]]
              @showed = false
            end
            dovisibilitythingy
            $reivisibility_sprite.update
          else
            if  @pic != Rei::LimitedVision::VSP[$game_variables[Rei::LimitedVision::USV]]
              @pic = Rei::LimitedVision::VSP[$game_variables[Rei::LimitedVision::USV]]
            end
            $reivisibility_sprite.show(@pic,1,getvis[0],getvis[1],
            Rei::LimitedVision::IZX+Rei::LimitedVision::STD+mod_state_range[0],
            Rei::LimitedVision::IZY+Rei::LimitedVision::STD+mod_state_range[1],255, 0)
            @showed = true
            dovisibilitythingy(1)
          end
        else
          if $reivisibility_sprite.name != ""
            $reivisibility_sprite.erase
            @showed = false
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Termination Processing
      #--------------------------------------------------------------------------
      def terminate
        $reivisibility_sprite.erase
        @showed = false
        reilimitedvisionterminate
      end
    end
    #==============================================================================
    #------------------------------------------------------------------------------
    # Woratana script, my version
    #------------------------------------------------------------------------------
    class Spriteset_Map
      alias reicreatepic create_pictures unless method_defined?('reicreatepic')
      #--------------------------------------------------------------------------
      # * Create Picture Sprite
      #--------------------------------------------------------------------------
      def create_pictures(*args);reicreatepic(*args)
        @picture_sprites.push(Sprite_Picture.new(@viewport1,$reivisibility_sprite))
      end
    end
    class Sprite_Picture < Sprite
      alias reipic_upd update unless method_defined?('reipic_upd')
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update(*args);reipic_upd(*args)
        self.z = $game_player.screen_z + 125 if @picture.number == 21;end
    end
    이 스크립트 따와서 고대로 쓴겁니다.

    그림도 따서 하나도 안고치고요.

  • ?
    네이피어 2012.02.17 23:56

    아이고 됬습니다.

    스크립트에서 색조를 (255,255,255,255)인걸 0으로 바꿔주니 됬습니다.

    (내가 왜 이생각을 못했지.)

     

    데모 프로젝트에선 255해도 잘만 되던데 제 스크립트에선 0으로 해야하는군요.

    왜그럴까요 ㅎㅎ


List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12448
RMVXA ^^ 이름 처리 질문 좀 하겠습니다 3 유한소수 2017.02.14 122
RMMV 전투에 참가하지 않는 플레이어를 만들고 싶습니다. padarkbot 2017.01.14 122
RMMV 사이드뷰 스킬 사용시 무기 들게 어떻게 하죠? 1 경하 2017.09.02 122
RMVXA vx ace 계산식 질문 Tine 2016.07.17 122
RMMV RPG 게임 구상 중입니다. 투척민 2016.05.05 122
RMVXA 이벤트 중에서 파티원이 습격을 받는 이벤트 2 소드 2016.01.01 122
RMVXA RMVXA XAS 스크립트에서 탄의 패턴을 좀더 다양하게 할수 없을까요? file 데크크래프트 2015.12.12 122
이벤트 작성 RMVXA 이벤트 시에 그림이 반복으로 움직이면서 다음 행이나 선택지가 나오게 하는 것이 궁금합니다. file laneas 2020.08.01 122
RMVXA 연계 스킬 질문 1 체력을가르다. 2015.11.05 122
RMVXA 동물 페이스칩을 찾고있습니다. 머그컵 2015.06.19 122
RMVXA [미해결] 메세지를 주고받는 중이라면 자동으로 스위치가 OFF되게 설정할 수 있을까요? 2 반내림 2017.03.01 122
RMVXA 메시지 출력 중에 계쏙 오류가 나옵니다 1 file Plossom 2015.08.09 122
RMMV 장소 이동시 id:002와 id:003중 랜덤으로 이동 하는법이 뭔가요? 2 직작족 2018.05.06 122
RMMV 리소스 매니저에는 bgm이 들어가 있는데 사운드 테스트에는 없어요 ㅠㅠ 2 러브굿 2018.06.02 122
턴제 전투 RMMV mv 프론트뷰 질문 직작족 2019.08.06 122
RMXP 게임 만들때 필요한 도트는 어떻게 구하나요?(혹시 만드는 법이라도 있나요?) rkdalswjd12 2018.07.01 122
기타 RMVXA 윈도우 스킨이 이상하게 나와요 file 둣녀 2022.01.05 121
기본툴 사용법 RMMV 특성-능력치-특수능력치 칸 내용 관련 PPPL 2020.04.24 121
기본툴 사용법 RMVX NPC에게 20번말걸으면 갑자기 다른말을 할수있게 하는법을알려주세요.;. 1 김정은죽이기게임개발자! 2019.09.25 121
스크립트 작성 RMMV [mv] 능력치 + -, 스크립트의 어디를 건들여야 할까요? 2 비형 2019.05.16 121
Board Pagination Prev 1 ... 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 ... 516 Next
/ 516