질문과 답변

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 12392
RMVXA 전투 스크립트 에러 질문입니다. 1 file 네트 2014.11.19 367
RMVX 전투 스크립트를 찾습니다. 1 나오프 2014.10.09 436
RMXP 전투 스크립트에 조건에 이름을 대입시키고 싶습니다. Ringccubus 2015.06.12 153
RMVX 전투 스테이터스 UI 질문입니다. 3 니노미야 2010.10.06 567
RMVXA 전투 시 그림을 대화창보다 위에 출력하는 방법? 1 젠쥬 2016.09.16 166
RMVXA 전투 시 대화창이 뚝뚝 끊기는 문제를 해결하고 싶습니다 첸멜 2016.09.17 75
RMMV 전투 시 문제... 6 file 지혈이 2017.05.06 174
RMMV 전투 시 스킬 사용 2 이깅 2018.03.10 121
턴제 전투 RMMV 전투 시 스킬이 활성화가 되지 않습니다. 4 유키오모찌 2023.07.07 35
RMMV 전투 시 적 캐릭터와 액터 캐릭터의 위치를 조정할 수 있는 플러그인이 있나요? 데아곤 2017.12.04 173
RM2k 전투 시 죽으면 다시 살아나게 하는 법. 1 shagas 2010.11.13 1380
RMVXA 전투 시 프론트뷰에 캐릭터 얼굴표시되게 하려면 어떻게 해야하나요? 1 들개 2016.07.29 162
RMVXA 전투 시스템에 대해 1 만땅몬 2016.03.15 166
RM2k3 전투 시스템에 대해서 꼭 알고싶은것이 있습니다. 2 디시플 2014.03.25 800
RMVX 전투 시에 나오는 대사 어떻게 설정하나요? 3 전학생 2013.09.15 1074
RMVX 전투 시에 적의 모습 뿐 아니라 하단에 자기캐릭터 모습 나오게끔.. 1 아루쿠 2011.09.29 1489
턴제 전투 RMMV 전투 시작 시 나오는 화면전환 효과를 바꾸고 싶습니다. 마이럼 2022.06.27 203
이벤트 작성 RMVXA 전투 시작시 캐릭터 목소리(혹은 효과음) 나오게 하는 법 1 초보노인 2022.05.30 258
RMVX 전투 시작할 때 도망치다 나타나게 하는 법 좀 가르쳐주세요. 1 용발2 2011.03.20 1283
RMVXA 전투 시작할때와 전투 중 커맨드를 좀 바꾸고 싶습니다 1 이스피나 2012.09.29 1613
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