질문과 답변

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
스크립트 사용 RMVXA 그림 각도 회전 스크립트 질문 file slieun 2022.10.03 50
맵배치 RMVXA 이거 왜이럴까요..?? 2 file arthurk 2022.10.02 120
기본툴 사용법 RMMV rpgproject파일 연결 관련 3 새알만두 2022.10.02 168
기타 RMMV 마우스 클릭 시 애니메이션 어떻게 없애나요? 3 file maa4923 2022.10.01 140
플러그인 생성 RMMV ESC키가 메뉴/취소버튼을 쓰지않게하고싶습니다/ESC키는 취소만되게 하고싶습니다. 쌩촙제작자 2022.09.23 150
이벤트 작성 RMVXA 상점에서 돈이 있어도 아이템을 딱 하나만 살 수 있게 바꿀 수 있나요? 4 유리컵 2022.09.22 243
기본툴 사용법 RMVXA vx ace 이벤트 수정하는 창이 안 떠요.... 바퀴벌레의질긴생명력 2022.09.21 128
기본툴 사용법 RMMV MV메뉴이미지를 변경하는 방법 아시는분,,ㅠㅠ 4 쌩촙제작자 2022.09.21 579
기타 RMVXA 아이템창의 아이템이 한줄에 한개씩 나오게 하는법 1 지박령귀목 2022.09.19 149
플러그인 사용 RMMV RPG Maker MV 폰트 변경 질문 1 file 레부 2022.09.18 294
기본툴 사용법 RMVXA 문장 표시할 때 '배경' 설정 file 머리큰두두 2022.09.10 110
에러 해결 RMMV 이 플러그인 루프가 왜 안돼는지 아시는 분 계신 가요? 무명시절 2022.09.05 145
턴제 전투 RMMV 스킬을 적과 아군에게 동시에 적용할 순 없나요? 4 오브투수스 2022.09.04 233
이벤트 작성 RMVXA 엔딩 후 타이틀 화면이 변경되게 하는 방법 1 넹글 2022.09.02 485
이벤트 작성 RMMZ 인벤토리에 아이템 이미지 순서대로 채워지는 시스템 이벤트로 작성이 가능할까요? file yellowcat 2022.09.02 133
기본툴 사용법 RMMV 타일셋(맵칩) 적용할때 타일 A와 B가 한 png 파일에 있을 경우 6 file 선유을 2022.08.30 270
이벤트 작성 RMMV 안녕하세요! 클리커 게임을 만드려고 해요 1 file 따르르응 2022.08.27 223
라이선스 RMMV 알만툴 타일셋 리터칭 가능한가요? 1 어어아아어아 2022.08.24 206
기본툴 사용법 RMMV Animation.json 파일을 읽을 수 없습니다 1 file nachthexen 2022.08.21 192
스크립트 추천 RMMV 횡스크롤 좌우 이동 2 sssbbbb 2022.08.20 285
Board Pagination Prev 1 ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ... 516 Next
/ 516