질문과 답변

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 12392
스크립트 사용 RMXP 컨트롤 누를시 맵통과가됩니다. 1 별의커비DX 2020.02.28 67
이벤트 작성 RMMV (1개 해결 다른 이름으로 다시 올림)게임을 처음 시작할때 3 미이인트 2019.01.25 68
이벤트 작성 RMVX 어떻게 작성하나요? 2 어성초 2020.02.13 68
RMVXA vxace의 파티체인저 비밀의회원 2018.06.15 68
이벤트 작성 RMVXA bgm 종료 시키는 법 삼오035 2020.07.31 68
기타 RMMV 전투시 선택지 변경 4 file gvqwera 2023.01.18 68
기타 우디타 질문입니다 file 줄기 2016.09.24 68
RMVXA 완성이 다가와 질문을 많이 하네요 ㅠㅠ 활쏘기 엑알 질문입니다 유한소수 2017.02.16 68
이벤트 작성 RMVXA 특정 이벤트때 물체가 움직이게 하고 싶습니다 3 노드러브 2020.06.10 68
RMMV 배틀에서 상대방과 사용자 둘 다 상태이상 걸리게 하는법 2 고르고르고 2018.12.21 68
스크립트 작성 RMVXA 특정 위치 위에 있을 때 방향키나 기타 특정 키를 입력받았을때 정해진 기능이 실행되게 하려고 합니다. 1 무명유실 2019.12.09 68
에러 해결 RMMV 배틀 화면이 이상합니다 1 야느와르 2020.01.01 68
기타 기타 쯔꾸르 게임 방향키 먹통 와방스dkdkdkdkr 2023.02.03 68
기타 RMVXA 아이콘을 직접 만들어 보고싶습니다 겜만들고싶다앙 2020.11.22 68
이벤트 작성 RMVX 캐릭터 모션 이벤트중 어떻게 바꿔요? 1 file 2021.08.20 68
스크립트 추천 RMVX 스크립트로 인벤토리 조합 어케해요 2021.08.20 68
이벤트 작성 RMMV 적 AI 관련 질문 6 file pokapoka 2023.08.11 68
플러그인 사용 RMMV 안녕하세요 Skill Cooldowns(YEP) 플러그인이 작동을 하지 않아서 질문 드립니다. 9 sakuragi 2023.04.10 68
RMVXA 전투중에 상태이상에 걸릴시 아이템 사용금지 FairyLover 2016.06.04 69
기타 RMMV 파티원이 죽으면 자동으로 파티에서 이탈처리되도록 구현하고 싶습니다. 2 프랑도르 2021.11.09 69
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