질문과 답변

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 12390
RMVXA 혹시 마을채로 공유하는 곳도 있나요? 4 비비드 2012.02.18 2007
RMXP xp에서 조작키 바꾸기 2 난현이라는 2012.02.18 2214
RMVX 낮과 밤과 빛 스크립트 응용 1 Raychel 2012.02.18 2046
RMVX 파티원 따라다니기 스크립트, 전투후 파티원들이 사라짐 현상. 9 네이피어 2012.02.18 1526
RMVX RPG Tankentai SBS 3.4d + ATB 1.2c Kaduki 관련 질문입니다. 1 투플 2012.02.18 2494
기타 아이콘... 2 굿닝 2012.02.18 2739
RMVX VX 강좌에 있는 프롤로그를 시도했지만 실패했습니다. 8 file 지나가는떡꼬치 2012.02.17 1974
RMVX VampYr ABS 조건분기 , 변수조작오류? 2 초보제작가뉴센 2012.02.17 1915
RMVX 시야에 관한 스크립트 질문이요. 3 file 네이피어 2012.02.17 1603
RMVX 이벤트로 몬스터와 나와의 거리계산 4 황금시계 2012.02.17 2049
RMVXA 특수 플래그 '대리'가 발동이 되지 않습니다 3 빙룡군 2012.02.16 2040
RM2k 데미지 수치화 ,(화면에 표시 )( 이벤트 )(액터 , 몬스터 능력치 액알) 5 쉰라면블랙 2012.02.16 2171
기타 타일셋 질문요 ^^ 2 Raychel 2012.02.16 2569
RMXP 맵배치 1 i스폰지밥 2012.02.16 2252
툴선택 rpg만들기vx 랑 rpg만들기xp중에 어떤것이 더 좋을까요? 9 2012.02.16 2374
RMVX 구름? 안개? 뿌연효과 2 file 황금시계 2012.02.16 2323
RMXP 스크립트로 메뉴를 바꿨더니 픽쳐에 묻히네요. 1 모르모트 2012.02.15 2412
기타 도트 캐릭'만' 이미지 저장하는 방법 5 펜슬 2012.02.15 2658
RMVX 보행 그래픽 짤림 1 file 124867960 2012.02.15 2323
기타 페이스 메이커 질문이요 2 Raychel 2012.02.15 2195
Board Pagination Prev 1 ... 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 ... 516 Next
/ 516