XP 스크립트

#===============================================================================
# 퀘스트 로그 시스템
# game_guy 가이 만듬
# 빗자루씨 번역
# Version 3.0
#-------------------------------------------------------------------------------
# 간략한 소개:
# 퀘스트를 만들수 있는 스크립트 입니다.
#
# 구성 요소:
# 퀘스트가 완료되었을때 이름을 노란색으로 표시합니다.
# 퀘스트를 만들기 쉬워집니다.
# 존나게 긴 퀘스트를 만들수 있습니다.
# 그림을 띄워서 설명할 수 있습니다.
# 퀘스트를 추가하고 쉽게 클리어 할수 있습니다.
# 다른 쉬운 버전보다 가볍습니다.
#
# 설치방법:
# 조금 아래를 내려다보면 # 이 보입니다. 아래에 있는 대로 하세요..
# 이벤트 설정에서 스크립트 실행으로 아래를 응용할수 있습니다.
#
# 스크립트 목록:
# Quest.add(id) ~ 퀘스트(id)를 리스트에 추가합니다.
# Quest.take(id) ~ 퀘스트(id)를 리스트에서 삭제합니다.
# Quest.complete(id) ~ 퀘스트(id)를 완료합니다.
# Quest.completed?(id) ~ 퀘스트(id)를 완료했을때 값을 true로 돌립니다..
# Quest.has?(id) ~ 퀘스트(id)를 받았는지 확인합니다.
# $scene = Scene_Quest.new ~ 퀘스트 메뉴를 엽니다.
#
# 주의사항 :
# 퀘스트가 하나도 없을시에는 에러가 납니다.
# 적어도 퀘스트가 하나라도 있을때 퀘스트 창을 열수 있게 해주세요.
#
# 크레딧:
# game_guy ~ 이거 만들었습니다.
# 베타 테스터 ~ Sally and Landith
# Blizzard ~ 이 사람의 코드에서 조금 배꼈다고 하는군요.
# 빗자루씨 ~ 이거 번역한사람입네다.
#===============================================================================
module GameGuy
  #==================================================
  # Begin Config
  # UsePicture ~ true값으로 지정되었을때 그림을
  #              퀘스트창에 표시합니다만 false일때는 안합니다.
  #==================================================
  UsePicture   = false
 
  def self.qreward(id)
    case id
    #==================================================
    # 퀘스트 보상
    # when x then return "보상"을 사용해서 보상을 추가합니다.
    # x = id, 보상 = quotes 안에 있는 보상
    #==================================================
    when 1 then return "100 골드"
    when 2 then return "3 포션"
    when 3 then return "힘의 반지"
    end
    return "????"
  end
 
  def self.qpicture(id)
    case id
    #==================================================
    # 퀘스트 그림
    # when x then return "그림" 방식으로 추가합니다.
    # x = id, 그림 = quotes 안에 있는 그림
    #==================================================
    when 1 then return "ghost"
    end
    return nil
  end
 
  def self.qname(id)
    case id
    #==================================================
    # 퀘스트 이름
    # when x then return "이름" 방식으로 추가합니다.
    # x = id, 이름 = quotes 안에 있는 이름
    #==================================================
    when 1 then return "빌리지 헌트"
    when 2 then return "페이 텝"
    when 3 then return "헌팅 나이프"
    end
    return ""
  end
 
  def self.qlocation(id)
    case id
    #==================================================
    # 퀘스트 장소
    # when x then return "장소" 방식으로 추가합니다.
    # x = id, 장소 = quotes 안에 있는 장소
    #==================================================
    when 1 then return "아톤 숲"
    when 2 then return "에카"
    when 3 then return "에카"
    end
    return "????"
  end
 
  def self.qdescription(id)
    case id
    #==================================================
    # 퀘스트 설명
    # when x then return "설명" 방식으로 추가합니다.
    # x = id, 설명 = quotes 안에 있는 설명
    #==================================================
    when 1 then return "엄청나게 기ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ인 퀘스트 소개입니다. 이거는 잠시동안만 볼수있습니다."
    when 2 then return "잔스의 방어를 위해서 그녀에게 돈을 기부하세요."
    when 3 then return "에카에게 헌팅 나이프를 전해주세요.
"
    end
    return ""
  end
 
end

module Quest
 
  def self.add(id)
    $game_party.add_quest(id)
  end
 
  def self.take(id)
    $game_party.take_quest(id)
  end
 
  def self.complete(id)
    $game_party.complete(id)
  end
 
  def self.completed?(id)
    return $game_party.completed?(id)
  end
 
  def self.has?(id)
    return $game_party.has_quest?(id)
  end
 
end
 
class Game_Party
 
  attr_accessor :quests
  attr_accessor :completed
 
  alias gg_quests_lat initialize
  def initialize
    @quests = []
    @completed = []
    gg_quests_lat
  end
 
  def add_quest(id)
    unless @quests.include?(id)
      @quests.push(id)
    end
  end
 
  def completed?(id)
    return @completed.include?(id)
  end
 
  def complete(id)
    unless @completed.include?(id)
      if @quests.include?(id)
        @completed.push(id)
      end
    end
  end
 
  def has_quest?(id)
    return @quests.include?(id)
  end
 
  def take_quest(id)
    @quests.delete(id)
    @completed.delete(id)
  end
 
end
class Scene_Quest
  def main
    @quests = []
    for i in $game_party.quests
      @quests.push(GameGuy.qname(i))
    end
    @map = Spriteset_Map.new
    @quests2 = []
    for i in $game_party.quests
      @quests2.push(i)
    end
    @quests_window = Window_Command.new(160, @quests)
    @quests_window.height = 480
    @quests_window.back_opacity = 110
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    @quests_window.dispose
    @quest_info.dispose if @quest_info != nil
    @map.dispose
  end
  def update
    @quests_window.update
    if @quests_window.active
      update_quests
      return
    end
    if @quest_info != nil
      update_info
      return
    end
  end
  def update_quests
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @quest_info = Window_QuestInfo.new(@quests2[@quests_window.index])
      @quest_info.back_opacity = 110
      @quests_window.active = false
      return
    end
  end
  def update_info
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @quests_window.active = true
      @quest_info.dispose
      @quest_info = nil
      return
    end
  end
end
class Window_QuestInfo < Window_Base
  def initialize(quest)
    super(160, 0, 480, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    @quest = quest
    refresh
  end
  def refresh
    self.contents.clear
    if GameGuy::UsePicture
      pic = GameGuy.qpicture(@quest)
      bitmap = RPG::Cache.picture(GameGuy.qpicture(@quest)) if pic != nil
      rect = Rect.new(0, 0, bitmap.width, bitmap.height) if pic != nil
      self.contents.blt(480-bitmap.width-32, 0, bitmap, rect) if pic != nil
    end
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 480, 32, "퀘스트:")
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 32, 480, 32, GameGuy.qname(@quest))
    self.contents.font.color = system_color
    self.contents.draw_text(0, 64, 480, 32, "보상:")
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 96, 480, 32, GameGuy.qreward(@quest))
    self.contents.font.color = system_color
    self.contents.draw_text(0, 128, 480, 32, "장소:")
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 160, 480, 32, GameGuy.qlocation(@quest))
    self.contents.font.color = system_color
    self.contents.draw_text(0, 192, 480, 32, "완료 여부:")
    self.contents.font.color = normal_color
    if $game_party.completed.include?(@quest)
      self.contents.font.color = crisis_color
      self.contents.draw_text(0, 224, 480, 32, "완료")
    else
      self.contents.font.color = normal_color
      self.contents.draw_text(0, 224, 480, 32, "진행중...")
    end
    self.contents.font.color = system_color
    self.contents.draw_text(0, 256, 480, 32, "퀘스트 설명:")
    self.contents.font.color = normal_color
    text = self.contents.slice_text(GameGuy.qdescription(@quest), 460)
    text.each_index {|i|
        self.contents.draw_text(0, 288 + i*32, 460, 32, text[i])}
  end
end
class Bitmap
 
  def slice_text(text, width)
    words = text.split(' ')
    return words if words.size == 1
    result, current_text = [], words.shift
    words.each_index {|i|
        if self.text_size("#{current_text} #{words[i]}").width > width
          result.push(current_text)
          current_text = words[i]
        else
          current_text = "#{current_text} #{words[i]}"
        end
        result.push(current_text) if i >= words.size - 1}
    return result
  end
 
end

사용 방법
1. 메뉴 스크립트에 끼워 넣는 방법이 있고요
2. 이벤트에서 '스크립트'가 있는데 거기서 만약에 퀘스트 1을 주고싶다면 Quest.add(1)을 쳐주시면 됩니다.

테스트 완료.
에러 없음.
진짜 없음.

주의사항만 따르면 에러 없어요

 

module GameGuy
  #==================================================
  # Begin Config
  # UsePicture ~ true값으로 지정되었을때 그림을
  #              퀘스트창에 표시합니다만 false일때는 안합니다.
  #==================================================
  UsePicture   = false
 
  def self.qreward(id)
    case id
    #==================================================
    # 퀘스트 보상
    # when x then return "보상"을 사용해서 보상을 추가합니다.
    # x = id, 보상 = quotes 안에 있는 보상
    #==================================================
    when 1 then return "예제 물건"
    when 2 then return "3 포션"
    when 3 then return "힘의 반지"
    end
    return "????"
  end
 
  def self.qpicture(id)
    case id
    #==================================================
    # 퀘스트 그림
    # when x then return "그림" 방식으로 추가합니다.
    # x = id, 그림 = quotes 안에 있는 그림
    #==================================================
    when 1 then return "ghost"
    end
    return nil
  end
 
  def self.qname(id)
    case id
    #==================================================
    # 퀘스트 이름
    # when x then return "이름" 방식으로 추가합니다.
    # x = id, 이름 = quotes 안에 있는 이름
    #==================================================
    when 1 then return "예제 퀘스트"
    when 2 then return "페이 텝"
    when 3 then return "헌팅 나이프"
    end
    return ""
  end
 
  def self.qlocation(id)
    case id
    #==================================================
    # 퀘스트 장소
    # when x then return "장소" 방식으로 추가합니다.
    # x = id, 장소 = quotes 안에 있는 장소
    #==================================================
    when 1 then return "예제 성"
    when 2 then return "에카"
    when 3 then return "에카"
    end
    return "????"
  end
 
  def self.qdescription(id)
    case id
    #==================================================
    # 퀘스트 설명
    # when x then return "설명" 방식으로 추가합니다.
    # x = id, 설명 = quotes 안에 있는 설명
    #==================================================
    when 1 then return "예제 입니다.."
    when 2 then return "잔스의 방어를 위해서 그녀에게 돈을 기부하세요."
    when 3 then return "에카에게 헌팅 나이프를 전해주세요.
"
    end
    return ""
  end
 
end

 

위 상황일때
이벤트에서 스크립트를 선택해서 Quest.add(1)을 해주면 퀘스트를 받습니다.
그리고 완료되었을때 Quest.complete(1)로 끝내는 겁니다.

또하나 예제
Quest.completed?(1) == true 를 조건분기로 두었을때
조건을 만족하는곳에 Quest.add(2)로 둔다면 퀘스트 1를 완료시에 퀘스트 2를 받을수 있고,

Quest.has?(2) == true 를 조건분기로 두었을때
조건을 만족하는곳에 메세지로 이미 받았다하면
받았다고 메세지를 보내줍니다.

Comment '24'
  • ?
    미토 2010.02.10 18:16

    우왕 성공했어효 ㅎㅎ 퀘스트 편리하군요 지금까지 스위치로 노가다질했는뎁 ㅎㅎ

  • profile
    Assault Meteoric Star 2010.02.10 19:37

    왜안되는지 모르겟군효

  • ?
    빗자루씨 2010.02.10 21:18

     $scene = Scene_Quest.new 이거 추가해보셨나요. 퀘스트창이 안뜨는것이라면 이것을 스크립트로 실행해주시면 괜찮고요, 에러가 뜨셨다면.. 다시 읽어보는것을 추천합니다.

     

  • profile
    퀸냐 2010.02.10 22:08

    예제없나요 ㅎ?

  • ?
    케나이 2010.02.11 18:16

    예제 가능할까요?

    왠만하면 기능은 모두 이용한 예제요

    그래야 잘 모르는 사람들이 쓰기 편하다는...<결론:날위해 허허허

  • ?
    내로미 2010.02.14 23:05

    메뉴에 어떻게 뛰우는 것인지??

  • ?
    내로미 2010.02.14 23:20

    메뉴에 뛰우려고 노력은 해봤으나 오류가 생기네요...

    이벤트로는 잘도 되는데...

  • ?
    내로미 2010.02.15 13:33

    오옷! 드디어 되네요!!

    앗싸~~!! 감사합니다~!!

    오류도 안돼고 정말 편리하네염!!

    감!!!!! 사!!!!!! 합!!!!! 니!!!!!! 다!!!!!

                                                                 사             사                 합합합

    감감감감감감      감                       사                 사            합합합합합합      합

                     감         감                   사  사              사사사             합합              합                                                                  다

                   감           감감감        사         사          사                 합        합          합합합          니          니       다다다다다   다

                 감             감              사                         사                 합        합          합                  니          니       다                   다다다

    감감감감감감      감                                                                    합합              합                  니니니  니       다다다다다   다

    감                감                                                                       합                    합                                     니                              다

    감감감감감감                                                                       합합합합합합합                                     니                                       점

                                                                                                   합                    합

                                                                                                   합합합합합합합

  • ?
    알피지GM 2010.02.15 22:07

    어 떻 게 게 게 게 사 사 사 사 용 용 용 용 합 합 합 합 니 니 니 니 까 까 까 까 까??

  • ?
    고자빵상아오오니 2010.02.18 12:58
    □□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□
    □■■■■■■■□■□□□□■■■□□■□■□□□■■■■■■□□■□□□■■■■■■□□■□□□□□□□■□□□□□□■□□□■■■■■■□□■□□□□■■■□□□□■□□□
    □□□□■□□□□■□□□□□□□□□■□■□□□□□□□□■□□■□□□□□□□□■□□■□□□□□□□■□□□□□□■□□□■□□□□□□□■□□□□□□□□□□□■□□□
    □□□□■□□■■■□□□■■■■■□■□■□□□□□□□□■□□■□□□■■■■■■□□■■■□□□□□■■■■■■■■□□□■□□□□□□□■□□■■■■■■■□□■□□□
    □□□■□■□□□■□□□□□■□□□■□■□□□□□□□□■□□■□□□■□□□□□□□■□□□□□□□■□□□□□□■□□□■□□□□□□□■□□□□■□■□□□□■□□□
    □□□■□□■□□■□□□□□■□□□■□■□□□■■■■■■□□■□□□■□□□□□□□■□□□□□□□■■■■■■■■□□□■■■■■■■□■□□□■□□□■□□□■□□□
    □□■□□□□■□■□□□□□■□■■■□■□□□□□□□■□□□■□□□■■■■■■■□■□□□□□□□□□□□□□□□□□□□□□□□□□□■□□□■□□□■□□□■□□□
    □■□□□□□□□■□□□□□■□□□■□■□□□□□□□■□□□■□□□□□□□□□□□■□□□□□□□□□□□□□□□□□□□□□■■■■□□□□□□■■■□□□□■□□□
    □□□□□□□□□■□□□□■□■□□■□■□□□□□□■□□□□■□□□□□■■■■■■□□□□□□□■■■■■■■■■■□□□□□□□□□□□□□□□□□□□□□□□□□□
    □□■□□□□□□□□□□□■□■□□■□■□□□□□■□□□□□■□□□□■□□□□□□■□□□□□□□□□□□■□□□□□□□■■■■■■■■□□□□■■■■■■■■□□□
    □□■□□□□□□□□□□■□□□■□■□■□□□■■□□□□□□■□□□□■□□□□□□■□□□□□□□□□□□■□□□□□□□□□□■■□□□□□□□■□□□□□□■□□□
    □□■■■■■■■■□□□□□□□□□■□■□□□□□□□□□□□■□□□□□■■■■■■□□□□□□□□□□□□■□□□□□□□■■■□□■■■□□□□■■■■■■■■□□□
    □□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□
  • ?
    볼펜 2010.02.18 12:59

    잘모르겠지만 감사합니다 ㅎㅎ

  • profile
    Assault Meteoric Star 2010.02.18 15:34

    메뉴에서 퀘스트창이 안나오는군요

  • ?
    Krrrr7 2010.02.19 11:03 SECRET

    "비밀글입니다."

  • ?
    케나이 2010.02.18 19:41

    1.이 퀘스트창닫을때 자동으로 메뉴가 열리는데 이거 어떻게 안열리게 하나요?

    2.저 when 1 return "" 에 변수 1을 넣어서 변수 1을 표시하게 하려는데요..

    $어쩌고 저쩌고[1]<- 이거 안되고요 v[1]도 안되요 어떻게 하죠?


    이거 둘은 제 능력으론 처리가 안되서...

  • ?
    생파 2012.02.12 12:09

    223번째 줄을

    $scene = Scene_Map.new 로 바꾸심 1번 문제는 해결됨

  • ?
    Krrrr7 2010.02.19 10:17

    정말 유용하네요

    처음에 나와있는 스크립트 목록같은거 찾고있었음

    이벤트에 쓸 수 있는 스크립트

    #Quest.add(id) ~ 퀘스트(id)를 리스트에 추가합니다.
    # Quest.take(id) ~ 퀘스트(id)를 리스트에서 삭제합니다.
    # Quest.complete(id) ~ 퀘스트(id)를 완료합니다.
    # Quest.completed?(id) ~ 퀘스트(id)를 완료했을때 값을 true로 돌립니다..
    # Quest.has?(id) ~ 퀘스트(id)를 받았는지 확인합니다.
    # $scene = Scene_Quest.new ~ 퀘스트 메뉴를 엽니다.

  • ?
    가빙 2010.02.21 10:43

    정말 감사합니다 계속 해보니까 작동 되네요

  • ?
    白月のはる 2010.02.23 15:58

    전 이거 안되던데 ㄱ- ㅠㅠ

    대충 모험일기로 때움 ㄱ-;

    어차피 완료여부 필요없구 ㅋ;

  • ?
    종이씨 2010.02.24 12:03
                                                                사             사                 합합합

    감감감감감감      감                       사                 사            합합합합합합      합

                     감         감                   사  사              사사사             합합              합                                                                  다

                   감           감감감        사         사          사                 합        합          합합합          니          니       다다다다다   다

                 감             감              사                         사                 합        합          합                  니          니       다                   다다다

    감감감감감감      감                                                                    합합              합                  니니니  니       다다다다다   다

    감                감                                                                       합                    합                                     니                              다

    감감감감감감                                                                       합합합합합합합                                     니                                       점

                                                                                                   합                    합

                                                                                                   합합합합합합합

  • ?
    frogonce 2010.02.25 00:58

    ㅋㅋㅋ

  • ?
    frogonce 2010.02.25 00:59

    감사합니ㅏ~

  • ?
    L Triple 2010.02.27 10:56

    도전해보겠습니다,

    스크립트가 90개가 넘어서

    오류가 날지 .,,

     

  • ?
    L Triple 2010.02.27 11:34

    스크립트는

    잘된거같은데,

    이벤트에 오류가 있나, 이벤트와 말을 걸시에

    팅기는 현상이있네요,

    예제를 한번만 올려주시면 감사하겠습니다만...

  • ?
    RPG-VXAce 2014.05.05 16:18
    오오오옷!! 첨에 '이게 뭥미 어캐하지?'라고 생각했다가 계속해보니까 잘되네요!
    제가 쓸때는 약간의 수정을해서 글에 색을넣는다던지 등등해도 되죠?
    그리고 지금 이 스크립트로는 1~3개만 있잖아요? 이것을 1~~ 늘리면 다 되는거죠?
    이 한개의 스크립트말고 개별로 쉽게 퀘스트를 만들 방법이 있나요?