UltimaForum

Skrypty [XP] - [RGSS] HellKiller's QuestLog

HellKiller - Wto 03 Sie, 2010 07:18
Temat postu: [RGSS] HellKiller's QuestLog
Witam przedstawiam wam QuestLog, mojego autorstwa, wygląd "zgapiłem" z Melvina QuestLoga, więc dla niego podziękowania.

Screen:
Spoiler:



Sorry za jakość, ale chciałem żeby mniej ważyło.

Skrypt wymaga ATP by Samo, The thief.

ATP:
Spoiler:


Kod:
=begin

ATP(Advanced Text Paragrapher) V1.0 by Samo, The thief

Ok, Something of The Scripters do normally to draw a text in form of a paragraph is
doing an array [] that contains each line. The Time Has come For
This Microsoft Word Effect!
This Script Just need a Long String and it will paragraph it!

How to call it?

paragraph = str_paragraph(string, width of the paragraph.)

Example :

@my_paragraph = str_paragraph("La la la la la la la la la , This is a Looooong Strriiiing!", 120)


Returns an Array with each line separately.

How to draw it?

draw_paragraph(x,y,width,height, paragraph)

width and height for each line, not for the paragraph.

.::-NOTE-::.

If you put a ' ^ '(must be between spaces), the text will pass to the next line.
This Symbol Won't be drawed.

Reminder: Always use '' instead of ""! It works faster!

=end


class Window_Base < Window
#--------------------------------------------------
  def str_paragraph(str_old, width)
    temp_str = ''
    str = '' + str_old
    words = []
    size = 0
    str_size = 0
    #
    while ((c = str.slice!(/./m)) != nil)
      temp_str += c
      str_size += 1
      if c == ' '
        words.push(temp_str)
        temp_str = ''
      end
      if str.size == 0
        words.push(temp_str)
        temp_str = ''
      end
    end
    lines = []
    for i in 0...words.size
      word = words[i]
      if word == '^ '
        lines.push(temp_str)
        temp_str = ''
        next
      end
      temp_str += word
      size = contents.text_size(temp_str).width
      if size > width - contents.text_size(' ').width
        for i in 1..word.size
          temp_str = temp_str.chop
        end
        lines.push(temp_str)
        temp_str = ''
        temp_str += word
      end
    end
    words = words.compact
    if temp_str != ''
      lines.push(temp_str)
    end
    return lines
  end
#---------------------------------------------------------------------
  def draw_paragraph(x,y,width,height,lines,align = 0)
    for i in 0...lines.size
      self.contents.draw_text(x, y + i * self.contents.font.size + 1, width, height, lines[i], align)
    end
  end
#-----------------------------------------------------------------
end



QuestLog wersja poprawiona:
Spoiler:


Kod:

=begin
Author: HellKiller
Version: 1.01
=end

Ikona = "032-item01"

class Game_Party
  alias :questlog_hellkiller_initialize :initialize
  attr_accessor :all_quest
  def initialize
    questlog_hellkiller_initialize
    # $quest = ["nazwa", "opis", kasa, "nagroda", trudnosc]
    @quest = []
    @quest_done = []
    @all_quest = 1
  end
  def quest
    return @quest
  end
  def quest_done
    return @quest_done
  end
  def add_quest(quest)
    @quest.push(quest) if not @quest.include?(quest)
  end
    def add_quest_done(quest)
    @quest_done.push(quest) if @quest.include?(quest)
    @quest.delete(quest)
    end
  end
 
class Quest_Command < Window_Selectable
 
  def initialize
    super(0, 64, 180, 320)
    @column_max = 1
    refresh
    self.index = 0
  end
 
  def item
    return @data[self.index]
  end
 
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...$game_party.quest.size
        @data.push($game_party.quest[i])
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = $defaultfonttype  # "Items" window font
      self.contents.font.size = $defaultfontsize
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
 
  def draw_item(index)
    item = @data[index]
    x = 8
    y = index * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(x , y, 212, 32, item[0], 0)
  end
end

class QuestLog
  def initialize
    @quest = $game_party.quest
  end
 
  def main
    @command_window = Quest_Command.new
    @command_window.x = 0
    @command_window.y = 0
    @index = @command_window.index
    @window_qd = Window_Quest_Done.new
    @window_qd.y = 320
    @window_qu = Window_Quest_Unlock.new
    @window_qu.y = 400
    if @quest.size > 0
    @opis = @quest[@index][1]
    @money = @quest[@index][2]
    @prize = @quest[@index][3]
    @dificulty = @quest[@index][4]
  else
    @opis = ""
    @money = 0
    @prize = ""
    @dificulty = 0
    end
    @window_quest_description = Window_Quest_Description.new(@opis)
    @window_quest_description.x = 180
    @window_qm = Window_Quest_Money.new(@money)
    @window_qm.x = 180
    @window_qm.y = 400
    @window_qp = Window_Quest_Prize.new(@prize)
    @window_qp.x = 180
    @window_qp.y = 320
    @window_qt = Window_Quest_Dificulty.new(@dificulty)
    @window_qt.y = 400
    @window_qt.x = 360
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
   
    @command_window.dispose
    @window_qd.dispose
    @window_qu.dispose
    @window_quest_description.dispose
    @window_qm.dispose
    @window_qp.dispose
    @window_qt.dispose
   
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end
  end
 
  def update
    @window_qd.update
    @command_window.update
    @window_qu.update
   
    @window_qp.dispose
    @window_qt.dispose
    @window_qd.dispose
    @window_qu.dispose
    @window_quest_description.dispose
    @window_qm.dispose
    @index = @command_window.index
    @window_qd = Window_Quest_Done.new
    @window_qd.y = 320
    @window_qu = Window_Quest_Unlock.new
    @window_qu.y = 400
    if @quest.size > 0
    @opis = @quest[@index][1]
    @money = @quest[@index][2]
    @prize = @quest[@index][3]
    @dificulty = @quest[@index][4]
  else
    @opis = ""
    @money = 0
    @prize = ""
    @dificulty = 0
    end
    @window_quest_description = Window_Quest_Description.new(@opis)
    @window_quest_description.x = 180
    @window_qm = Window_Quest_Money.new(@money)
    @window_qm.x = 180
    @window_qm.y = 400
    @window_qp = Window_Quest_Prize.new(@prize)
    @window_qp.x = 180
    @window_qp.y = 320
    @window_qt = Window_Quest_Dificulty.new(@dificulty)
    @window_qt.y = 400
    @window_qt.x = 360
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
  end
end


class Window_Quest_Done < Window_Base
 
  def initialize
    super(0, 0, 180, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 16
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, "Ukończone")
    self.contents.font.color = normal_color
    self.contents.draw_text(20, 0, 120, 32, $game_party.quest_done.size.to_s + " / " + $game_party.all_quest.to_s, 2)
  end
  def update
    refresh
  end
end

class Window_Quest_Unlock < Window_Base
 
  def initialize
    super(0, 0, 180, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 16
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, "Odblokowano")
    self.contents.font.color = normal_color
    self.contents.draw_text(20, 0, 120, 32, $game_party.quest.size.to_s + " / " + $game_party.all_quest.to_s, 2)
  end
  def update
    refresh
  end
end

class Window_Quest_Description < Window_Base
 
  def initialize(quest)
    super(0, 0, 460, 320)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 16
    @quest = quest
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 0, 120, 32, "Opis")
    self.contents.font.color = system_color
    paragraph = str_paragraph(@quest,430)
    draw_paragraph(0,-110,430,290, paragraph)
  end
  def update
    refresh
  end
end

class Window_Quest_Money < Window_Base
 
  def initialize(quest)
    super(0, 0, 180, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 16
    @quest = quest
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    bitmap = RPG::Cache.icon(Ikona)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.font.color = normal_color
    self.contents.draw_text(60, 0, 120, 32, @quest.to_s)
  end
  def update
    refresh
  end
end

class Window_Quest_Prize < Window_Base
 
  def initialize(quest)
    super(0, 0, 460, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 16
    @quest = quest
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 80, 32, "Nagroda:")
    self.contents.font.color = normal_color
    self.contents.draw_text(30, 0, 120, 32, @quest)
  end
  def update
    refresh
  end
end

class Window_Quest_Dificulty < Window_Base
 
  def initialize(quest)
    super(0, 0, 300, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 16
    @quest = quest
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 80, 32, "Trudnosc:")
    self.contents.font.color = normal_color
    self.contents.draw_text(90, 0, 120, 32, "Bardzo łatwy") if @quest == 0
    self.contents.draw_text(90, 0, 120, 32, "Łatwy") if @quest == 1
    self.contents.draw_text(90, 0, 120, 32, "Średni") if @quest == 2
    self.contents.draw_text(90, 0, 120, 32, "Trudny") if @quest == 3
    self.contents.draw_text(90, 0, 120, 32, "Bardzo trudny") if @quest == 4
    self.contents.draw_text(90, 0, 120, 32, "Hiper Trudny") if @quest == 5
  end
  def update
    refresh
  end
end


Żeby zadziałało potrzeba wkleić do main:
Kod:
    $defaultfonttype = "Times New Roman"
  $defaultfontsize = 26


FAQ:
1: "Jak dodajemy zadania" ?
- dodajemy je poprzez wywołanie skryptu i wpisaniu:
Kod:
$game_party.add_quest(quest)
, gdzie quest w nawiasie oznacza nazwę zadania
2: "Jak robić zadania" ?
- dobrze jest założyć pustą kartę i w niej wpisywać, według wzoru:
Kod:
$quest = ["nazwa", "opis", kasa, "nagroda", trudnosc]

$quest należy zmieniać na np. $quest1, $quest2 itd., żeby nie nastąpiły jakieś komplikacje.
3 "Jak zmienić ikonę" ?
- w jednej z pierwszych linijek jest
Kod:
Ikona
w niej jest podana nazwa ikony, zmień ją i ciesz się nową ikoną.

Credits:
HellKiller
Melvin - wzorowałem się wyglądowo na jego skrypcie (nie wiem czy go dawać, ale ,żeby nie było :D)

SonyPL - Czw 09 Wrz, 2010 19:49

Można prosić o demko?
PaKiTos - Pią 10 Wrz, 2010 15:16

na co ci? :lol: skrypt fajny i łatwy w obsłudze!
SonyPL - Pią 10 Wrz, 2010 16:36

PaKiTos chcę demko ponieważ gdy dodaje questa nie ma go w dzienniku
HellKiller - Sob 25 Wrz, 2010 11:08

Witam przedstawiam wam QuestLog, mojego autorstwa.

[size=14pt]Zmiany w 1.5:[/size]
- możliwość wyłączenia dwóch okienek odpowiedzialne za informowanie o wszystkich zadaniach i o ilości ukończonych zadaniach
- zmieniony wygląd
- pokazywanie obrazka
- poprawione błędy
- zmienione tworzenie zadań - szczegóły FAQ pytanie #2


Skrypt od czasu do czasu będzie ulepszany.

Screen z wersji 1.0:

Przepraszam za stary screen ,ale nie mam możliwości wrzucić nowego.

Skrypt wymaga ATP by Samo, The thief.

ATP:
Spoiler:

Kod:
=begin

ATP(Advanced Text Paragrapher) V1.0 by Samo, The thief

Ok, Something of The Scripters do normally to draw a text in form of a paragraph is
doing an array [] that contains each line. The Time Has come For
This Microsoft Word Effect!
This Script Just need a Long String and it will paragraph it!

How to call it?

paragraph = str_paragraph(string, width of the paragraph.)

Example :

@my_paragraph = str_paragraph("La la la la la la la la la , This is a Looooong Strriiiing!", 120)


Returns an Array with each line separately.

How to draw it?

draw_paragraph(x,y,width,height, paragraph)

width and height for each line, not for the paragraph.

.::-NOTE-::.

If you put a ' ^ '(must be between spaces), the text will pass to the next line.
This Symbol Won't be drawed.

Reminder: Always use '' instead of ""! It works faster!

=end


class Window_Base < Window
#--------------------------------------------------
  def str_paragraph(str_old, width)
    temp_str = ''
    str = '' + str_old
    words = []
    size = 0
    str_size = 0
    #
    while ((c = str.slice!(/./m)) != nil)
      temp_str += c
      str_size += 1
      if c == ' '
        words.push(temp_str)
        temp_str = ''
      end
      if str.size == 0
        words.push(temp_str)
        temp_str = ''
      end
    end
    lines = []
    for i in 0...words.size
      word = words[i]
      if word == '^ '
        lines.push(temp_str)
        temp_str = ''
        next
      end
      temp_str += word
      size = contents.text_size(temp_str).width
      if size > width - contents.text_size(' ').width
        for i in 1..word.size
          temp_str = temp_str.chop
        end
        lines.push(temp_str)
        temp_str = ''
        temp_str += word
      end
    end
    words = words.compact
    if temp_str != ''
      lines.push(temp_str)
    end
    return lines
  end
#---------------------------------------------------------------------
  def draw_paragraph(x,y,width,height,lines,align = 0)
    for i in 0...lines.size
      self.contents.draw_text(x, y + i * self.contents.font.size + 1, width, height, lines[i], align)
    end
  end
#-----------------------------------------------------------------
end



QuestLog wersja poprawiona:
Spoiler:

Kod:
=begin
Author: HellKiller
Version: 1.5
=end

Ikona = "032-item01"
Opacity_window = 180
Okienko_z_ukonczonymi_widac = false
Okienko_z_wszystkimi_zadaniami_widac = false

class Game_Party
  alias :questlog_hellkiller_initialize :initialize
  attr_accessor :all_quest
  def initialize
    questlog_hellkiller_initialize
    # $quest = ["nazwa", "opis", kasa, "nagroda", trudnosc, "obrazek"]
    @quest = []
    @quest_done = []
    @quest_x = []
    @all_quest = 1
  end
  def quest_x
    return @quest_x
  end
  def quest
    return @quest
  end
  def quest_done
    return @quest_done
  end
  def add_quest(quest)
    @quest.push(quest) if not @quest.include?(quest)
  end
    def add_quest_done(quest)
    @quest_done.push(quest) if @quest.include?(quest)
    @quest.delete(quest)
  end
  def add_quest_x(quest)
    @quest_x.push(quest) if @quest.include?(quest)
    @quest.delete(quest)
    end
  end
 
class Quest_Command < Window_Selectable
 
  def initialize
    super(0, 64, 180, 320)
    @column_max = 1
    @opacity = Opacity_window
    refresh
    self.index = 0
  end
 
  def item
    return @data[self.index]
  end
 
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...$game_party.quest.size
        @data.push($game_party.quest[i])
      end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = $defaultfonttype  # "Items" window font
      self.contents.font.size = $defaultfontsize
      for i in 0...@item_max
        draw_item(i)
      end
      end
  end
 
  def draw_item(index)
    item = @data[index]
    x = 8
    y = index * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    if @item_max > 0
    self.contents.draw_text(x , y, 212, 32, item[0], 0)
  else
    self.contents.draw_text(x , y, 212, 32, item, 0)
    end
  end
end

class Quest_Command_Done < Window_Selectable
 
  def initialize
    super(0, 64, 180, 320)
    @column_max = 1
    refresh
    self.index = 0
  end
 
  def item
    return @data[self.index]
  end
 
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...$game_party.quest_done.size
        @data.push($game_party.quest_done[i])
      end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = $defaultfonttype  # "Items" window font
      self.contents.font.size = $defaultfontsize
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
 
    def draw_item(index)
    item = @data[index]
    x = 8
    y = index * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    if @item_max > 0
    self.contents.draw_text(x , y, 212, 32, item[0], 0)
  else
    self.contents.draw_text(x , y, 212, 32, item, 0)
    end
  end
end
 
  class Quest_Command_X < Window_Selectable
 
  def initialize
    super(0, 64, 180, 320)
    @column_max = 1
    refresh
    self.index = 0
  end
 
  def item
    return @data[self.index]
  end
 
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...$game_party.quest_x.size
        @data.push($game_party.quest_x[i])
      end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = $defaultfonttype  # "Items" window font
      self.contents.font.size = $defaultfontsize
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end

  def draw_item(index)
    item = @data[index]
    x = 8
    y = index * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    if @item_max > 0
    self.contents.draw_text(x , y, 212, 32, item[0], 0)
  else
    self.contents.draw_text(x , y, 212, 32, item, 0)
    end
  end
end

class QuestLog
  def initialize
    @quest = $game_party.quest
  end
 
  def main
    @spriteset = Spriteset_Map.new
    @start = true
    s1 = "Zadania"
    s2 = "Zadania Ukończone"
    s3 = "Zadania Zniszczone"
    @choice = Window_Command.new(192, [s1, s2, s3])
    @choice.opacity = Opacity_window
    @choice.x = 320 - @choice.width / 2
    @choice.y = 288
    @okienko = Window_Empty.new
    @okienko.x = 180 + 19
    @okienko.y = 6
    @okienko.z = 101
    @okienko.opacity = Opacity_window
    @window_qd = Window_Quest_Done.new
    @window_qd.y = 360
    @window_qd.opacity = Opacity_window
    @window_qu = Window_Quest_Unlock.new
    @window_qu.y = 420
    @window_qd.opacity = Opacity_window
    @window_qu.visible = Okienko_z_wszystkimi_zadaniami_widac
    @window_qd.visible = Okienko_z_ukonczonymi_widac
    @window_qu.opacity = Opacity_window
    if @quest.size > 0 and not @index == nil
    @opis = @quest[@index][1]
    @money = @quest[@index][2]
    @prize = @quest[@index][3]
    @dificulty = @quest[@index][4]
    @picture = @quest[@index][5]
  else
    @opis = ""
    @money = 0
    @prize = ""
    @dificulty = 0
    @picture = ""
    end
    @window_quest_description = Window_Quest_Description.new(@opis,@picture)
    @window_quest_description.x = 180
    @window_quest_description.opacity = Opacity_window
    @window_qm = Window_Quest_Money.new(@money)
    @window_qm.x = 180
    @window_qm.y = 420
    @window_qm.opacity = Opacity_window
    @window_qp = Window_Quest_Prize.new(@prize)
    @window_qp.x = 180
    @window_qp.y = 360
    @window_qp.opacity = Opacity_window
    @window_qt = Window_Quest_Dificulty.new(@dificulty)
    @window_qt.y = 420
    @window_qt.x = 360
    @window_qt.opacity = Opacity_window
    @window_qu.visible = false
    @window_qd.visible = false
    @window_qt.visible = false
    @window_qp.visible = false
    @window_qm.visible =  false
    @window_quest_description.visible = false
    @okienko.visible = false
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @window_qd.dispose
    @window_qu.dispose
    @window_quest_description.dispose
    @window_qm.dispose
    @window_qp.dispose
    @window_qt.dispose
    @spriteset.dispose
    @choice.dispose
    @okienko.dispose
    if not @command_window == nil
    @command_window.dispose
    end
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end
  end
 
  def update
    @choice.update
    if @start == true
    @window_qu.visible = false
    @window_qd.visible = false
    @window_qt.visible = false
    @window_qp.visible = false
    @window_qm.visible =  false
    @window_quest_description.visible = false
    @okienko.visible = false
   
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      case @choice.index
      when 0  # &#12491;&#12517;&#12540;&#12466;&#12540;&#12512;
    @command_window = Quest_Command.new
    @command_window.x = 0
    @command_window.y = 0
    @command_window.opacity = Opacity_window
    @command_window.visible = true
    @choice.visible = false
    @quest = $game_party.quest
    @start = false
    return
      when 1  # &#12467;&#12531;&#12486;&#12451;&#12491;&#12517;&#12540;
    @command_window = Quest_Command_Done.new
    @command_window.x = 0
    @command_window.y = 0
    @command_window.opacity = Opacity_window
    @command_window.visible = true
    @start = false
    @choice.visible = false
    @quest = $game_party.quest_done
    @start = false
    return
      when 2  # &#12471;&#12515;&#12483;&#12488;&#12480;&#12454;&#12531;
    @command_window = Quest_Command_X.new
    @command_window.x = 0
    @command_window.y = 0
    @command_window.opacity = Opacity_window
    @command_window.visible = true
    @start = false
    @choice.visible = false
    @quest = $game_party.quest_done
    @start = false
      end
  end
end
  if @start == false
    @window_qu.visible = Okienko_z_wszystkimi_zadaniami_widac
    @window_qd.visible = Okienko_z_ukonczonymi_widac
    @window_qt.visible = true
    @window_qp.visible = true
    @window_qm.visible =  true
    @command_window.visible = true
    @command_window.active = true
    @window_quest_description.visible = true
    @okienko.visible = true
end
  if @start == false
    @window_qd.update
    @command_window.update
    @window_qu.update
    @window_qp.dispose
    @window_qt.dispose
    @window_qd.dispose
    @window_qu.dispose
    @window_quest_description.dispose
    @window_qm.dispose
    @index = @command_window.index
    @window_qd = Window_Quest_Done.new
    @window_qd.y = 360
    @window_qu = Window_Quest_Unlock.new
    @window_qu.y = 420
    if @quest.size > 0
    @opis = @quest[@index][1]
    @money = @quest[@index][2]
    @prize = @quest[@index][3]
    @dificulty = @quest[@index][4]
    @picture = @quest[@index][5]
  else
    @opis = ""
    @money = 0
    @prize = ""
    @dificulty = 0
    @picture = ""
    end
    @window_quest_description = Window_Quest_Description.new(@opis,@picture)
    @window_quest_description.x = 180
    @window_quest_description.opacity = Opacity_window
    @window_qm = Window_Quest_Money.new(@money)
    @window_qm.x = 180
    @window_qm.y = 420
    @window_qp = Window_Quest_Prize.new(@prize)
    @window_qp.x = 180
    @window_qp.y = 360
    @window_qt = Window_Quest_Dificulty.new(@dificulty)
    @window_qt.y = 420
    @window_qt.x = 360
    @window_qu.opacity = Opacity_window
    @window_qd.opacity = Opacity_window
    @window_qt.opacity = Opacity_window
    @window_qp.opacity = Opacity_window
    @window_qm.opacity = Opacity_window
    @window_qd.opacity = Opacity_window
    @window_qu.visible = Okienko_z_wszystkimi_zadaniami_widac
    @window_qd.visible = Okienko_z_ukonczonymi_widac
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
  end
end


class Window_Quest_Done < Window_Base
 
  def initialize
    super(0, 0, 180, 60)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 16
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, "Ukończone")
    self.contents.font.color = normal_color
    self.contents.draw_text(20, 0, 120, 32, $game_party.quest_done.size.to_s + " / " + $game_party.all_quest.to_s, 2)
  end
  def update
    refresh
  end
end

class Window_Quest_Unlock < Window_Base
 
  def initialize
    super(0, 0, 180, 60)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 16
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, "Odblokowano")
    self.contents.font.color = normal_color
    self.contents.draw_text(20, 0, 120, 32, $game_party.quest.size.to_s + " / " + $game_party.all_quest.to_s, 2)
  end
  def update
    refresh
  end
end

class Window_Quest_Description < Window_Base
 
  def initialize(quest,picture)
    super(0, 0, 460, 320)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 16
    @quest = quest
    @picture = picture
    refresh
  end
 
  def refresh
    self.contents.clear
    bitmap = RPG::Cache.picture(@picture)
    self.contents.blt(14, 0, bitmap, Rect.new(0, 0, 400, 100), 200)
    self.contents.font.color = system_color
    self.contents.draw_text(0, 128, 120, 32, "Opis")
    self.contents.font.color = normal_color
    paragraph = str_paragraph(@quest,430)
    draw_paragraph(0,18,430,290, paragraph)
  end
  def update
    refresh
  end
end

class Window_Quest_Money < Window_Base
 
  def initialize(quest)
    super(0, 0, 180, 60)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 16
    @quest = quest
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    bitmap = RPG::Cache.icon(Ikona)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.font.color = normal_color
    self.contents.draw_text(60, 0, 120, 32, @quest.to_s)
  end
  def update
    refresh
  end
end

class Window_Quest_Prize < Window_Base
 
  def initialize(quest)
    super(0, 0, 460, 60)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 16
    @quest = quest
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 80, 32, "Nagroda:")
    self.contents.font.color = normal_color
    self.contents.draw_text(80, 0, 350, 32, @quest)
  end
  def update
    refresh
  end
end

class Window_Quest_Dificulty < Window_Base
 
  def initialize(quest)
    super(0, 0, 300, 60)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype 
    self.contents.font.size = 16
    @quest = quest
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 80, 32, "Trudnosc:")
    self.contents.font.color = normal_color
    self.contents.draw_text(90, 0, 120, 32, "Bardzo łatwy") if @quest == 0
    self.contents.draw_text(90, 0, 120, 32, "Łatwy") if @quest == 1
    self.contents.draw_text(90, 0, 120, 32, "Średni") if @quest == 2
    self.contents.draw_text(90, 0, 120, 32, "Trudny") if @quest == 3
    self.contents.draw_text(90, 0, 120, 32, "Bardzo trudny") if @quest == 4
    self.contents.draw_text(90, 0, 120, 32, "Hiper Trudny") if @quest == 5
  end
  def update
    refresh
  end
end

class Window_Empty < Window_Base
 
  def initialize
    super(0, 0, 420, 120)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    refresh
  end
 
  def refresh
    self.contents.clear
   
  end
end


Żeby zadziałało potrzeba wkleić do main:
Kod:
    $defaultfonttype = "Times New Roman"
  $defaultfontsize = 26


FAQ:
1: "Jak dodajemy zadania" ?
- dodajemy je poprzez wywołanie skryptu i wpisaniu:
Kod:
$game_party.add_quest(quest)
, gdzie quest w nawiasie oznacza nazwę zadania
2: "Jak robić zadania" ?
- dobrze jest założyć pustą kartę i w niej wpisywać, według wzoru:
Kod:
$quest = ["nazwa", "opis", kasa, "nagroda", trudnosc, "obrazek"]

$quest należy zmieniać na np. $quest1, $quest2 itd., żeby nie nastąpiły jakieś komplikacje.
3 "Jak zmienić ikonę" ?
- w jednej z pierwszych linijek jest
Kod:
Ikona
w niej jest podana nazwa ikony, zmień ją i ciesz się nową ikoną.
4. "Jak wywołać dziennik ?"
- wystarczy że wywołasz skrypt i wpiszesz
Kod:
$scene = QuestLog.new

5. "Jak dodać zadania ukończone ?"
dodajemy je podobnie jak z zwykłym zadaniem poprzez wywołanie skryptu i wpisaniu:
Kod:
$game_party.add_quest_done(quest)
, gdzie quest w nawiasie oznacza nazwę zadania
6 "Jak dodać zniszczone(?) zadania" ?
dodajemy je podobnie jak z zwykłym zadaniem poprzez wywołanie skryptu i wpisaniu:
Kod:
$game_party.add_quest_x(quest)
, gdzie quest w nawiasie oznacza nazwę zadania

Credits:
HellKiller

kubica5050 - Pią 03 Gru, 2010 14:48

Mam jedno pytanie jak się wywołuje okno skryptu? :?:
HellKiller - Wto 07 Gru, 2010 00:47

FAQ punkt 4
Bulooo - Sro 22 Gru, 2010 16:14

mógł bym poprosić o demo, mi coś to nie wyszło
Czeliosss - Czw 23 Gru, 2010 13:56

Łapcie demo
http://www.speedyshare.co...estLog_Demo.exe

Bulooo - Czw 23 Gru, 2010 14:00

Dzięki
Noyas - Czw 30 Gru, 2010 20:06

Malutkie pytanko:
Cytat:
Żeby zadziałało potrzeba wkleić do main:
Kod:
$defaultfonttype = "Times New Roman"
$defaultfontsize = 26


Nie działa( wręcz wyskakuje błąd)

Kod:
1: "Jak dodajemy zadania" ?
- dodajemy je poprzez wywołanie skryptu i wpisaniu:
Kod:
$game_party.add_quest(quest)
, gdzie quest w nawiasie oznacza nazwę zadania
2: "Jak robić zadania" ?
- dobrze jest założyć pustą kartę i w niej wpisywać, według wzoru:
Kod:
$quest = ["nazwa", "opis", kasa, "nagroda", trudnosc, "obrazek"]

$quest należy zmieniać na np. $quest1, $quest2 itd., żeby nie nastąpiły jakieś komplikacje.
3 "Jak zmienić ikonę" ?
- w jednej z pierwszych linijek jest
Kod:
Ikona
w niej jest podana nazwa ikony, zmień ją i ciesz się nową ikoną.
4. "Jak wywołać dziennik ?"
- wystarczy że wywołasz skrypt i wpiszesz
Kod:
$scene = QuestLog.new

5. "Jak dodać zadania ukończone ?"
dodajemy je podobnie jak z zwykłym zadaniem poprzez wywołanie skryptu i wpisaniu:
Kod:
$game_party.add_quest_done(quest)
, gdzie quest w nawiasie oznacza nazwę zadania
6 "Jak dodać zniszczone(?) zadania" ?
dodajemy je podobnie jak z zwykłym zadaniem poprzez wywołanie skryptu i wpisaniu:
Kod:
$game_party.add_quest_x(quest)
, gdzie quest w nawiasie oznacza nazwę zadania


Nie działa (wyskakuje jeszcze inny błąd)

A problem jest taki że działało przez moment, a potem się wyłączyło.

Czy mogę prosić o konkretne rady typu:
-Jak założyć pustą kartę i w niej wpisywać, według wzoru [...] ?
- jak wywołać dziennik ( ta opcja nie działa w ogóle)?

byłbym wdzięczny za szybką odpowiedź

Czeliosss - Czw 30 Gru, 2010 21:06

Masz wszystko w demie 2 posty wyżej.
David - Czw 30 Gru, 2010 21:49

Pozwoliłem sobie przeedytować, tak żeby działało także na angielskim makerze:
Spoiler:

Kod:

=begin
Author: HellKiller
Version: 1.01
=end

Ikona = "032-item01"

class Game_Party
  alias :questlog_hellkiller_initialize :initialize
  attr_accessor :all_quest
  def initialize
    questlog_hellkiller_initialize
    # $quest = ["nazwa", "opis", kasa, "nagroda", trudnosc]
    @quest = []
    @quest_done = []
    @all_quest = 1
  end
  def quest
    return @quest
  end
  def quest_done
    return @quest_done
  end
  def add_quest(quest)
    @quest.push(quest) if not @quest.include?(quest)
  end
    def add_quest_done(quest)
    @quest_done.push(quest) if @quest.include?(quest)
    @quest.delete(quest)
    end
  end
 
class Quest_Command < Window_Selectable
 
  def initialize
    super(0, 64, 180, 320)
    @column_max = 1
    refresh
    self.index = 0
  end
 
  def item
    return @data[self.index]
  end
 
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...$game_party.quest.size
        @data.push($game_party.quest[i])
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = "Comic Sans MS"
      self.contents.font.size = 22
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
 
  def draw_item(index)
    item = @data[index]
    x = 8
    y = index * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(x , y, 212, 32, item[0], 0)
  end
end

class QuestLog
  def initialize
    @quest = $game_party.quest
  end
 
  def main
    @command_window = Quest_Command.new
    @command_window.x = 0
    @command_window.y = 0
    @index = @command_window.index
    @window_qd = Window_Quest_Done.new
    @window_qd.y = 320
    @window_qu = Window_Quest_Unlock.new
    @window_qu.y = 400
    if @quest.size > 0
    @opis = @quest[@index][1]
    @money = @quest[@index][2]
    @prize = @quest[@index][3]
    @dificulty = @quest[@index][4]
  else
    @opis = ""
    @money = 0
    @prize = ""
    @dificulty = 0
    end
    @window_quest_description = Window_Quest_Description.new(@opis)
    @window_quest_description.x = 180
    @window_qm = Window_Quest_Money.new(@money)
    @window_qm.x = 180
    @window_qm.y = 400
    @window_qp = Window_Quest_Prize.new(@prize)
    @window_qp.x = 180
    @window_qp.y = 320
    @window_qt = Window_Quest_Dificulty.new(@dificulty)
    @window_qt.y = 400
    @window_qt.x = 360
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
   
    @command_window.dispose
    @window_qd.dispose
    @window_qu.dispose
    @window_quest_description.dispose
    @window_qm.dispose
    @window_qp.dispose
    @window_qt.dispose
   
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end
  end
 
  def update
    @window_qd.update
    @command_window.update
    @window_qu.update
   
    @window_qp.dispose
    @window_qt.dispose
    @window_qd.dispose
    @window_qu.dispose
    @window_quest_description.dispose
    @window_qm.dispose
    @index = @command_window.index
    @window_qd = Window_Quest_Done.new
    @window_qd.y = 320
    @window_qu = Window_Quest_Unlock.new
    @window_qu.y = 400
    if @quest.size > 0
    @opis = @quest[@index][1]
    @money = @quest[@index][2]
    @prize = @quest[@index][3]
    @dificulty = @quest[@index][4]
  else
    @opis = ""
    @money = 0
    @prize = ""
    @dificulty = 0
    end
    @window_quest_description = Window_Quest_Description.new(@opis)
    @window_quest_description.x = 180
    @window_qm = Window_Quest_Money.new(@money)
    @window_qm.x = 180
    @window_qm.y = 400
    @window_qp = Window_Quest_Prize.new(@prize)
    @window_qp.x = 180
    @window_qp.y = 320
    @window_qt = Window_Quest_Dificulty.new(@dificulty)
    @window_qt.y = 400
    @window_qt.x = 360
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
  end
end


class Window_Quest_Done < Window_Base
 
  def initialize
    super(0, 0, 180, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 22
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, "Ukończone")
    self.contents.font.color = normal_color
    self.contents.draw_text(20, 0, 120, 32, $game_party.quest_done.size.to_s + " / " + $game_party.all_quest.to_s, 2)
  end
  def update
    refresh
  end
end

class Window_Quest_Unlock < Window_Base
 
  def initialize
    super(0, 0, 180, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 22
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, "Odblokowano")
    self.contents.font.color = normal_color
    self.contents.draw_text(20, 0, 120, 32, $game_party.quest.size.to_s + " / " + $game_party.all_quest.to_s, 2)
  end
  def update
    refresh
  end
end

class Window_Quest_Description < Window_Base
 
  def initialize(quest)
    super(0, 0, 460, 320)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 20
    @quest = quest
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 0, 120, 32, "Opis")
    self.contents.font.color = system_color
    paragraph = str_paragraph(@quest,430)
    draw_paragraph(0,-110,430,290, paragraph)
  end
  def update
    refresh
  end
end

class Window_Quest_Money < Window_Base
 
  def initialize(quest)
    super(0, 0, 180, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 22
    @quest = quest
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    bitmap = RPG::Cache.icon(Ikona)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.font.color = normal_color
    self.contents.draw_text(60, 0, 120, 32, @quest.to_s)
  end
  def update
    refresh
  end
end

class Window_Quest_Prize < Window_Base
 
  def initialize(quest)
    super(0, 0, 460, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 22
    @quest = quest
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 80, 32, "Nagroda:")
    self.contents.font.color = normal_color
    self.contents.draw_text(100, 0, 120, 32, @quest)
  end
  def update
    refresh
  end
end

class Window_Quest_Dificulty < Window_Base
 
  def initialize(quest)
    super(0, 0, 300, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Comic Sans MS"
    self.contents.font.size = 22
    @quest = quest
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 80, 32, "Trudność:")
    self.contents.font.color = normal_color
    self.contents.draw_text(90, 0, 120, 32, "Bardzo łatwy") if @quest == 0
    self.contents.draw_text(90, 0, 120, 32, "Łatwy") if @quest == 1
    self.contents.draw_text(90, 0, 120, 32, "Średni") if @quest == 2
    self.contents.draw_text(90, 0, 120, 32, "Trudny") if @quest == 3
    self.contents.draw_text(90, 0, 120, 32, "Bardzo trudny") if @quest == 4
    self.contents.draw_text(90, 0, 120, 32, "Hiper Trudny") if @quest == 5
  end
  def update
    refresh
  end
end


Noyas - Czw 30 Gru, 2010 23:17

Czeliosss napisał/a:
Masz wszystko w demie 2 posty wyżej.

No właśnie demo mi nie działa :D :mrgreen: :mrgreen:

Czeliosss - Czw 30 Gru, 2010 23:19

To zgaduję że masz polską wersję. Jedyną radą jest to, żebyś ściągnął sobie angielską wersję.
Noyas - Czw 30 Gru, 2010 23:24

Zgadza się, w dodatku z jakiejś rumuńskiej strony.
Zaraz sprawdzę czy działa na angielskiej i dam znać

Czeliosss - Czw 30 Gru, 2010 23:30

Na angielskiej na 100% będzie działało.
Noyas - Czw 30 Gru, 2010 23:41

Czeliosss napisał/a:
Na angielskiej na 100% będzie działało.


Wszystko PRAWIE działa.

jeszcze takie jedno pytanie, bo tam jest napisane, że założyć trzeba czystą kartę, i wpisać należy:
Cytat:
2: "Jak robić zadania" ?
- dobrze jest założyć pustą kartę i w niej wpisywać, według wzoru:
Kod:
$quest = ["nazwa", "opis", kasa, "nagroda", trudnosc, "obrazek"]


no i to się pojawia problem, jak tworzę już czysta kartkę to potem wyskakuje mi błąd.

Czeliosss - Pią 31 Gru, 2010 00:00

Otwórz demo i zobacz jak dałem.
Noyas - Pią 31 Gru, 2010 00:20

Jest ok, trudne do ogarnięcią, ale dam radę.

Dzięki wielkie za pomoc. :mrgreen:

PaKiTos - Pią 14 Sty, 2011 14:53

Demo wygasło a mi nie dziala
Czeliosss - Pią 14 Sty, 2011 14:58

Zaraz zauploaduję.
Nie odpisywać, bo nie dodam do postu.
EDIT:
http://www.speedyshare.co...estLog_Demo.exe

PaKiTos - Pią 14 Sty, 2011 16:15

Wyskakuje error jak testuję grę
victoriatus - Wto 14 Cze, 2011 22:26

jak wrzucić quest? bo robię wszystko wg wzoru, ale jak dodaje skryptem quest w grze, to wyskakuje błąd. dacie przykład w spojlerach?
Melvin - Sro 15 Cze, 2011 13:04

No nawet nieźle Ci wyszło, ale nie ma dodatkowych info...
Tak czy inaczej ładnie ;-)

Ale wydaje mi się, że skopiowałeś ode mnie i zmieniłeś ;-(

shiwt - Sro 15 Cze, 2011 15:53

Melvin napisał/a:
No nawet nieźle Ci wyszło, ale nie ma dodatkowych info...
Tak czy inaczej ładnie ;-)

Ale wydaje mi się, że skopiowałeś ode mnie i zmieniłeś ;-(

Hę? w twoim skrypcie trzeba jakoś dziwnie na zmiennych robić questy.
Tutaj jest wszystko w tablicy.

Melvin - Sro 15 Cze, 2011 22:24

shiwt, wiem, ale wydaje mi się przerobione. Ale nie ważne. Skrypt i tak git. Myślę, że mogę go użyć, bo łatwy w obsłudze, aczkolwiek musiałbym go trochę podrasować :-D
HellKiller - Sro 15 Cze, 2011 23:30

W gwoli ścisłości twój questlog był najgorzej napisanym skryptem jakiego widziałem.
Ja jedynie wzorowałem się troszkę wyglądowo a i tak w nowszej wersji jest już trochę inaczej. Z dobroci wspomniałem o tobie, bo tak naprawdę nie miałeś wkładu tu żadnego, nawet linijki kodu nie wziąłem od ciebie.
A po drugie po jaką cholerę dodatkowe info ? Skrypt jest dla ludzi myślących, jeżeli ktoś nie rozumie przykro mi, niech nie używa.

Melvin - Czw 16 Cze, 2011 01:52

Cytat:
W gwoli ścisłości twój questlog był najgorzej napisanym skryptem jakiego widziałem.

Niestety się z tym zgodzę :-(
Ale to przeszłość. Dawno napisałem ten skrypt i dlatego jest tak zagmatwany.

I wygląda na to, że muszę napisać nowy, łatwiejszy w konfiguracji..

Cytat:
bo tak naprawdę nie miałeś wkładu tu żadnego,

Tak naprawdę, to wygląd jest prawie identyczny ale ok :roll:

Cytat:
nawet linijki kodu nie wziąłem od ciebie.

Więc, ok ;-)

Dodatkowe info mogłoby być opcjonalne - dla dużych questów.

victoriatus - Czw 16 Cze, 2011 11:30

bardzo prosze. możecie mi napisać przykładowo zdefiniowany i wrzucony quest?

zdefiniowany mam chyba dobrze (żadnego errora. a wcześniej był)
ale kiedy go dodaje i otwieram dzxiennik misji to wyskakuje błąd. zależnie od tego jak go napisze pojawia się co innego. a próbowałem tylko w apostrofem i cudzysłowiem


Powered by phpBB modified by Przemo © 2003 phpBB Group