질문과 답변

Extra Form

항상 도와주셔서 감사합니다 :)


EV002 이름을 [1]로 해놓고 EV002를 이벤트 1번에 다가가게 하니까 EV002 내용이 잘 실행이 되어요.  감사합니다 :)



그런데 이 경우와 반대로요, 이름이 바뀌지 않은 다른 이벤트들이 이름 [1] 인 이벤트에 닿았을때 이름바뀌지 않은 이벤트가 실행되게하는것이 있었으면 좋겠어요.  



제목 없음.jpg


틀린그림찾기게임엔 일단 크게 필요없지만 쉬면서 공부하면서 여러가지 다른 계획들이 떠올랐어요 ㅎㅎ


꼭 그런방법이 있었으면 좋겠어요.


정말 감사합니다! :)



Who's 조석진

profile


Image=======
싸움쟁이 Ssaumjangy
작가: 조석진 Author: Seokjin Cho
developing kids game

official website: http://www.seokjin.xo.st
game develop site: http://www.seokjin49.xo.st
facebook develop status site: http://www.facebook.com/seokjingame
Comment '12'
  • profile
    습작 2012.08.27 09:21

    0.


      일단 석진님께서 문의하신 내용에서 말하시는 스크립트가 무엇인지 모르시는 분들을 위해서 아래 첨부합니다. 질문에 대한 답변은 추가 댓글로 해드리도록 하겠습니다.


    class Game_Event < Game_Character

      #--------------------------------------------------------------------------

      def move_toward_player

        if @event.name[/\[(\d+)\]/]

          sx = @x - $game_map.events[$1.to_i].x

          sy = @y - $game_map.events[$1.to_i].y

        else

          sx = @x - $game_player.x

          sy = @y - $game_player.y

        end

        if sx == 0 and sy == 0

          return

        end

        abs_sx = sx.abs

        abs_sy = sy.abs

        if abs_sx == abs_sy

          rand(2) == 0 ? abs_sx += 1 : abs_sy += 1

        end

        if abs_sx > abs_sy

          sx > 0 ? move_left : move_right

          if not moving? and sy != 0

            sy > 0 ? move_up : move_down

          end

        else

          sy > 0 ? move_up : move_down

          if not moving? and sx != 0

            sx > 0 ? move_left : move_right

          end

        end

      end

      #--------------------------------------------------------------------------

      def move_away_from_player

        if @event.name[/\[(\d+)\]/]

          sx = @x - $game_map.events[$1.to_i].x

          sy = @y - $game_map.events[$1.to_i].y

        else

          sx = @x - $game_player.x

          sy = @y - $game_player.y

        end

        if sx == 0 and sy == 0

          return

        end

        abs_sx = sx.abs

        abs_sy = sy.abs

        if abs_sx == abs_sy

          rand(2) == 0 ? abs_sx += 1 : abs_sy += 1

        end

        if abs_sx > abs_sy

          sx > 0 ? move_right : move_left

          if not moving? and sy != 0

            sy > 0 ? move_down : move_up

          end

        else

          sy > 0 ? move_down : move_up

          if not moving? and sx != 0

            sx > 0 ? move_right : move_left

          end

        end

      end

      #--------------------------------------------------------------------------

      def turn_toward_player

        if @event.name[/\[(\d+)\]/]

          sx = @x - $game_map.events[$1.to_i].x

          sy = @y - $game_map.events[$1.to_i].y

        else

          sx = @x - $game_player.x

          sy = @y - $game_player.y

        end

        if sx == 0 and sy == 0

          return

        end

        if sx.abs > sy.abs

          sx > 0 ? turn_left : turn_right

        else

          sy > 0 ? turn_up : turn_down

        end

      end

      #--------------------------------------------------------------------------

      def turn_away_from_player

        if @event.name[/\[(\d+)\]/]

          sx = @x - $game_map.events[$1.to_i].x

          sy = @y - $game_map.events[$1.to_i].y

        else

          sx = @x - $game_player.x

          sy = @y - $game_player.y

        end

        if sx == 0 and sy == 0

          return

        end

        if sx.abs > sy.abs

          sx > 0 ? turn_right : turn_left

        else

          sy > 0 ? turn_down : turn_up

        end

      end

      #--------------------------------------------------------------------------

      def check_event_trigger_touch(x, y)

        if $game_system.map_interpreter.running?

          return

        end

        if @event.name[/\[(\d+)\]/]

          if @trigger == 2 and x == $game_map.events[$1.to_i].x and y == $game_map.events[$1.to_i].y

            if not jumping? and not over_trigger?

              start

            end

          end

        else

          if @trigger == 2 and x == $game_player.x and y == $game_player.y

            if not jumping? and not over_trigger?

              start

            end

          end

        end

      end

      #--------------------------------------------------------------------------

      def check_event_trigger_auto

        if @event.name[/\[(\d+)\]/]

          begin

            if @trigger == 2 and @x == $game_map.events[$1.to_i].x and @y == $game_map.events[$1.to_i].y

              if not jumping? and not over_trigger?

                start

              end

            end

          rescue

          end

        else

          if @trigger == 2 and @x == $game_player.x and @y == $game_player.y

            if not jumping? and over_trigger?

              start

            end

          end

        end

        if @trigger == 3

          start

        end

      end

      #--------------------------------------------------------------------------

    end



  • ?
    이상훈 2012.09.02 12:58
    저도 써도 되나요?
  • profile
    습작 2012.09.02 14:52
    네, 됩니다.^^
  • profile
    습작 2012.08.27 09:41

    1.


      질문 내용에 따라서 수정된 스크립트입니다. 이름이 변경되지 않은 스크립트가, 이름이 변경된 스크립트와 접촉하였을 경우, 해당 이벤트가 '이벤트가 접촉'일 경우 해당 이벤트가 실행됩니다. 그럼 수고하세요.^^


    class Game_Event < Game_Character

      #--------------------------------------------------------------------------

      def move_toward_player

        if @event.name[/\[(\d+)\]/]

          sx = @x - $game_map.events[$1.to_i].x

          sy = @y - $game_map.events[$1.to_i].y

        else

          sx = @x - $game_player.x

          sy = @y - $game_player.y

        end

        if sx == 0 and sy == 0

          return

        end

        abs_sx = sx.abs

        abs_sy = sy.abs

        if abs_sx == abs_sy

          rand(2) == 0 ? abs_sx += 1 : abs_sy += 1

        end

        if abs_sx > abs_sy

          sx > 0 ? move_left : move_right

          if not moving? and sy != 0

            sy > 0 ? move_up : move_down

          end

        else

          sy > 0 ? move_up : move_down

          if not moving? and sx != 0

            sx > 0 ? move_left : move_right

          end

        end

      end

      #--------------------------------------------------------------------------

      def move_away_from_player

        if @event.name[/\[(\d+)\]/]

          sx = @x - $game_map.events[$1.to_i].x

          sy = @y - $game_map.events[$1.to_i].y

        else

          sx = @x - $game_player.x

          sy = @y - $game_player.y

        end

        if sx == 0 and sy == 0

          return

        end

        abs_sx = sx.abs

        abs_sy = sy.abs

        if abs_sx == abs_sy

          rand(2) == 0 ? abs_sx += 1 : abs_sy += 1

        end

        if abs_sx > abs_sy

          sx > 0 ? move_right : move_left

          if not moving? and sy != 0

            sy > 0 ? move_down : move_up

          end

        else

          sy > 0 ? move_down : move_up

          if not moving? and sx != 0

            sx > 0 ? move_right : move_left

          end

        end

      end

      #--------------------------------------------------------------------------

      def turn_toward_player

        if @event.name[/\[(\d+)\]/]

          sx = @x - $game_map.events[$1.to_i].x

          sy = @y - $game_map.events[$1.to_i].y

        else

          sx = @x - $game_player.x

          sy = @y - $game_player.y

        end

        if sx == 0 and sy == 0

          return

        end

        if sx.abs > sy.abs

          sx > 0 ? turn_left : turn_right

        else

          sy > 0 ? turn_up : turn_down

        end

      end

      #--------------------------------------------------------------------------

      def turn_away_from_player

        if @event.name[/\[(\d+)\]/]

          sx = @x - $game_map.events[$1.to_i].x

          sy = @y - $game_map.events[$1.to_i].y

        else

          sx = @x - $game_player.x

          sy = @y - $game_player.y

        end

        if sx == 0 and sy == 0

          return

        end

        if sx.abs > sy.abs

          sx > 0 ? turn_right : turn_left

        else

          sy > 0 ? turn_down : turn_up

        end

      end

      #--------------------------------------------------------------------------

      def check_event_trigger_touch(x, y)

        if $game_system.map_interpreter.running?

          return

        end

        if @event.name[/\[(\d+)\]/]

          if @trigger == 2 and x == $game_map.events[$1.to_i].x and y == $game_map.events[$1.to_i].y

            if not jumping? and not over_trigger?

              start

            end

          end

          for event in $game_map.events.values

            next if event.id == @id

            if event.trigger == 2 and x == event.x and y == event.y

              if not event.jumping? and not event.over_trigger?

                event.start

              end

            end

          end

        else

          if @trigger == 2 and x == $game_player.x and y == $game_player.y

            if not jumping? and not over_trigger?

              start

            end

          end

        end

      end

      #--------------------------------------------------------------------------

      def check_event_trigger_auto

        if @event.name[/\[(\d+)\]/]

          begin

            if @trigger == 2 and @x == $game_map.events[$1.to_i].x and @y == $game_map.events[$1.to_i].y

              if not jumping? and not over_trigger?

                start

              end

            end

          rescue

          end

          for event in $game_map.events.values

            next if event.id == @id

            if event.trigger == 2 and @x == event.x and @y == event.y

              if not event.jumping? and not event.over_trigger?

                event.start

              end

            end

          end

        else

          if @trigger == 2 and @x == $game_player.x and @y == $game_player.y

            if not jumping? and over_trigger?

              start

            end

          end

        end

        if @trigger == 3

          start

        end

      end

      #--------------------------------------------------------------------------

    end

     


  • profile
    조석진 2012.08.28 11:21
    항상 감사합니다 습작님 ㅎㅎ 오늘도 습작님때문에 게임제작을 놓지않습니다 ㅎㅎ
  • ?
    키바 2012.09.15 18:52

    저도 가능하면 써도 될까요? 찾던건데ㅎ

  • profile
    습작 2012.09.15 19:42
    네, 됩니다.^^
  • ?
    키바 2012.09.15 21:38
    근데 사용법을 모른다는게 함정ㅠㅠ

    이름을 변경한다는건 어떤거죠?ㅜ

    저는 ev001의 이름을 [2]
    ev002의 이름을 없애고

    ev002를 ev001에다 충돌(?)시켰는데...
    (둘다 "이벤트가 접촉" 상태.)

    아무 일이 일어나지 않아요ㅠㅠ

    석진님은 어떻게 하신거지...ㅜ
  • profile
    습작 2012.09.15 23:18
    EV001에 작성된 내용의 경우 이벤트 이름을 [2]로 하였을때, EV002에 닿으면 작동합니다.
  • ?
    키바 2012.11.25 15:58
    되...되..되.돼.돼돼돼돼돼돼 됐다!!!!만쉐이!!!!!!!!
    아 감사합니다ㅠㅠ 너무 편리하군요 존경합니다 ㅠ
  • profile
    블루하와이 2016.10.22 05:08
    안녕하세요 습작님 이 스크립트대로 적용했는데 이벤트가 절 쫓아오는 순간
    Script " line 20: NameError occurred.
    undefined local variable or method 'move_right' for
    #<Game_Event:0x840e298>
    라는 오류메세지가 뜹니다
    쫒아오는 스크립트의 이름만 바꿨고, 이벤트에 접속하면 실행이라는 설정을 했는데
    뭐가 문젠지 모르겠어요 ㅠ 도와주세요
  • profile
    습작 2016.10.23 17:52
    빈프로젝트에 삽입하여 테스트 해보세요. 만약 문제 없이 작동한다면 그것은 다른 스크립트와의 충돌이 문제일 수 있습니다.

List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12387
이벤트 작성 RMMV 맵 이동 반복 이벤트 6 HYUNWOL 2022.04.17 209
플러그인 사용 RMMV 텍스트 출력 정렬하는 법. 2 file HYUNWOL 2022.04.14 209
기타 RMVXA 비와 발자국 2 현작가 2022.04.10 205
기본툴 사용법 RMMV 같은 타일을 분리시켜서 배치하는 방법이 있나요? 타일 배치에 대한 이해가 필요합니다 2 file Mew 2022.04.07 204
기타 RMMV 알만툴 애니메이션 어떻게 적용 시키나요 1 11223232 2022.04.07 426
이벤트 작성 RMMV 아이템(포션)을 거부하는 이벤트 Nix 2022.04.06 182
이벤트 작성 RM2k3 간단한 메일함 기능을 구현하고 싶어요 2 file wl 2022.04.04 234
턴제 전투 RMVXA 버프, 디버프 적용시 자동 효과음을 추가하고 싶습니다. 무해 2022.04.01 158
에러 해결 RM2k3 테스트 플레이 실행하면 이상한 화면하고 오류만 떠요 ㅠㅠ(급) file 호소지 2022.03.31 188
기타 기타 타일셋은 어디서 구할수있나요? 1 먹사 2022.03.30 202
기본툴 사용법 기타 타일셋에 B2라고 적혀있는건 어디에다가 설정하나요 3 file 먹사 2022.03.30 151
에러 해결 RMMV MV 줌 플러그인 고쳐주실 구원자분!! file 이시리즈 2022.03.27 236
이벤트 작성 RMVXA 호로로의 산소같은 게이지 만들기 2 넹글 2022.03.25 210
스크립트 작성 RMVXA 해상도 제한을 푸는 스크립트를 도저히 찾을 수가 없습니다. 1 zx히어로zx 2022.03.20 232
기타 RMVXA 미니게임제작 2 현작가 2022.03.13 274
기타 RMVXA 그 게임시작하자마자 맵이 어두운상태에서 문장표시하는거 어떻게하나요? 1 krmojo 2022.03.12 167
이벤트 작성 RMVXA 숫자입력해서 잠긴상자열게하는 이벤트는 어떻게하나요? 2 krmojo 2022.03.10 188
맵배치 RMXP 맵칩 이거저거 쓰고 싶어서 다른 타일셋의 칩을 합성하고 싶어요 1 아스리테 2022.03.04 224
맵배치 RMVXA 패럴랙스 맵핑하려고 하는데 이동할 수 없는 타일은 어떻게 설정해야 하나요? 4 싱거운소금 2022.03.03 267
턴제 전투 RMVXA 한글패치후 턴제전투시 번역되지 않은 を倒した!위치가 궁금합니다. 2 file 유리컵 2022.02.26 269
Board Pagination Prev 1 ... 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ... 516 Next
/ 516