질문과 답변

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 12391
RMVX 스크립트 입문, 문법에 관한 질문 3 딸기뱀 2012.02.02 1671
RMVXA VXA의 최대 해상도 2 TheEK 2012.12.03 1671
RMXP XP 게임 합체? 도와주세요;; 2 PTRS 2011.08.28 1672
RMVX VX 자료실에 있는 Templates 캐리터 뼈대 그래픽 XP 용 아닌가요 ? 2 시꺼 2011.08.02 1673
RMXP 습작님 이벤트접촉 이벤트발생 스크립트 12 file 조석진 2012.08.27 1673
RMVX 스크립트 질문 3 file Skeleton's bone 2011.09.05 1674
RMVX 도감 스크립트 추가질문입니다. 1 라스트루마 2011.10.10 1675
RMVX 프로세스 작성 실패하엿습니다..? 2 어쩌구 2011.08.15 1676
RMVX 타이틀 없앤후에 윈도우로 나가기 만들기. 6 file 하늘바라KSND 2011.09.02 1676
RMXP 케릭터만들고 xp에 어떻게 적용하나요? 1 오매갓 2011.12.14 1676
RMVXA RPF VX ACE 타일셋 재질문 3 임벌 2013.12.03 1676
RMVXA 알만툴로 미연시 같은 느낌의 대화형식 이루는 법? 2 늄늄이 2015.03.17 1676
RMVX 훈덕 님이 올리신 스킬 사용 조건(번역) 사용방법 file 엿데브 2011.06.07 1677
RMXP 스크립트 고수분들 부탁드립니다 ; 3 동망새 2011.11.16 1677
RMVX 피하기게임에서 보스를 구현할랍니다! 1 냉혈한도라지 2011.12.06 1677
RMVXA 흔들림 효과 질문 3 달밤에왈츠 2012.07.03 1677
RMVX VX의 윈도우크기 조절 2 케이나인 2011.05.01 1679
RMVX 타일셋...... 1 hareun 2011.07.20 1679
RMXP 윈도우7에서 rpgxp쓰고있는데요 맵배치후 게임에서 문제가생기네요! 도와주세요 3 file 모험소년 2013.07.15 1679
RMVX 만렙설정법좀요 2 dklqwer123 2011.09.08 1680
Board Pagination Prev 1 ... 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 ... 516 Next
/ 516