질문과 답변

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 12389
이벤트 작성 RMVX 조사 이벤트가 하고싶습니다!!!!!!!이왕이면 아이템 획득도!!!!1 2 여랑밈 2019.07.22 90
이벤트 작성 RMMV 또..질문이여..ㅠㅠ 5개의 재료가 있어야 1개의 템이 만들어지게 하고싶습니다. 2 file 쿠우쿠우0 2019.07.23 82
이벤트 작성 RMMV 게임을 처음 시작할 때 아무것도 없는 검은 바탕에 텍스트만 나오도록 하고 싶어요. 9 퐁핑퐁 2019.07.26 206
이벤트 작성 RMMV 사다리를 통해 이동불가타일 지나가기에 대해서..여쭙니다~ 3 file 쿠우쿠우0 2019.08.01 76
이벤트 작성 RMVX 이벤트 중 캐릭터 등장시키고 싶은데 어떻게 해요? 2021.08.20 66
이벤트 작성 RMMV 게임 멈춤현상.. 6 file 쿠우쿠우0 2019.08.18 187
이벤트 작성 RMVXA (해결됨) 특정 지형에 있을 때 조사하면 이벤트 실행하게 하는 거 2 file 우좌 2019.09.15 48
이벤트 작성 RMMV 해당 이벤트가 이동중일때 다른 이벤트에 접촉하면, 다른곳으로 순간이동 하는 방법이 있나요??? 4 file 호구랑 2019.08.25 71
이벤트 작성 RMXP 맴버.....제거..... 1 로열젤리 2019.09.03 72
이벤트 작성 RMMV 특정 맵에서 세이브했던 파일을 불러오게 만들고 싶습니다. 물돼지맛 2019.08.28 93
이벤트 작성 RMMV 지도 그림 위에 플레이어 위치를 보이게 하는 법 2 file 소녀160 2019.09.09 108
이벤트 작성 RMMV 움짤처럼 픽셀이 깨져서 흩어지는 듯한 연출을 만들고 싶어요 3 file 물돼지맛 2019.09.14 189
이벤트 작성 RMMV 대기 애니메이션 만들기 2 무명시절 2020.08.23 127
이벤트 작성 RMMV 선생님들 도와주세요! 7 file 지탁 2020.02.12 124
이벤트 작성 RMVXA 확인버튼 눌렀을때 그림 삭제하기 2 MAYO 2019.09.20 350
이벤트 작성 RMXP 100% 적이나 아군에게 상태변화를 부여하는 법을 알려주세요 1 장부호 2019.09.23 32
이벤트 작성 RMVXA 하루에 할 수 있는 활동에 제약을 주고싶어요 3 테티 2020.06.14 132
이벤트 작성 RMMV 주석(노트)를 인게임에서 수정하는 방법 4 무명시절 2020.06.14 220
이벤트 작성 RMMV 캐릭터 이동 경로중에 셀프스위치가 눌리게 할 수 있나요? 6 PPPL 2019.10.07 132
이벤트 작성 RMVXA 액터 파티를 수시로 변경 하는 법 6 MAYO 2019.10.07 103
Board Pagination Prev 1 ... 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ... 82 Next
/ 82