Dziennik zadań. (Problem rozwiązany). - Revlis - 05-03-15 18:11
[] Witam, to znowu ja. Testując pierwsze skrypty jakie udało mi się wsadzić do projektu w praktyce, natknąłem się na kilka przeszkód. Między innymi, skrypt na tzw. "dziennik zadań".
http://pastebin.com/Gdd8yhs0
[] Problem polega na tym, że zadania (zarówno główne jak i poboczne) nie przesuwają się w dół jeśli jest ich dużo. Na raz można zobaczyć tylko 11 z nich (np. zakładając że jest 12 zadań w dzienniku, wciąż nie możemy zobaczyć ostatniego).
[] Na zdjęciu poniżej widać, że ostatnie (12 z kolei) zadanie jest ucięte, a
pozostałych (13+) nie można zobaczyć gdyż po prostu nie da się zjechać bardziej w dół.
http://imgur.com/cnv3GnM
[] Ma ktoś może pomysł co może być tego przyczyną?
Wciąż aktualne.
RE: Dziennik zadań. (Wciąż aktualne) Tydzień bez odpowiedzi, jest tam kto? - Ayene - 17-03-15 00:17
Przyczyną jest błędny kod...
Aby nie psuć Ci konfiguracji, znajdź linijkę:
Kod:
# *** Don't edit below unless you know what you are doing. ***
I wszystko poniżej podmień na to:
Kod:
class Game_System
attr_accessor :main_quests
attr_accessor :side_quests
attr_accessor :completed_quests
attr_accessor :failed_quests
alias nicke_quest_initialize initialize unless $@
def initialize(*args, &block)
nicke_quest_initialize(*args, &block)
@main_quests = []
@side_quests = []
@completed_quests = [] # Going to be used later on.
@failed_quests = [] # Going to be used later on.
end
end
class Game_Interpreter
include NICKE::JOURNAL_SYSTEM
def add_quest(id, type)
# Method to add a quest.
case type
when :main # Main quests.
unless $game_system.main_quests.include?(MAIN_QUESTS[id])
$game_system.main_quests.push(MAIN_QUESTS[id])
end unless MAIN_QUESTS[id].nil?
when :side # Side quests.
unless $game_system.side_quests.include?(SIDE_QUESTS[id])
$game_system.side_quests.push(SIDE_QUESTS[id])
end unless SIDE_QUESTS[id].nil?
end
end
def complete_quest(id, type)
# Method to complete a quest.
case type
when :main # Main quests.
if $game_system.main_quests.include?(MAIN_QUESTS[id])
$game_system.main_quests.delete(MAIN_QUESTS[id])
$game_system.completed_quests.push(MAIN_QUESTS[id])
$game_variables[COMPLETE_QUEST_VAR] += 1
end
when :side # Side quests.
if $game_system.side_quests.include?(SIDE_QUESTS[id])
$game_system.side_quests.delete(SIDE_QUESTS[id])
$game_system.completed_quests.push(SIDE_QUESTS[id])
$game_variables[COMPLETE_QUEST_VAR] += 1
end
end
end
def fail_quest(id, type)
# Method for quest failed.
case type
when :main # Main quests.
unless MAIN_QUESTS[id].nil?
$game_system.main_quests.delete(MAIN_QUESTS[id])
$game_system.failed_quests.push(MAIN_QUESTS[id])
$game_variables[FAILED_QUEST_VAR] += 1
end
when :side # Side quests.
unless SIDE_QUESTS[id].nil?
$game_system.side_quests.delete(SIDE_QUESTS[id])
$game_system.failed_quests.push(SIDE_QUESTS[id])
$game_variables[FAILED_QUEST_VAR] += 1
end
end
end
end
class Scene_Simple_Journal < Scene_Base
include NICKE::JOURNAL_SYSTEM
def start
# Create the bg if true and make a new instance of Window_Simple_Journal.
super()
@journal_window = Window_Simple_Journal.new(true)
if BACKGROUND_IMAGE_ACTIVE == true
create_bg
@journal_window.opacity = 0
end
end
def create_bg
# Method for creating the background image.
@bg = Sprite.new
@bg.bitmap = Cache.picture(BACKGROUND_IMAGE)
end
def update
super
# Method for checking input triggers.
if Input.trigger?(Input::B)
Sound.play_cancel
if RETURN_TO_MAP == true
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(0)
end
elsif Input.trigger?(BUTTON_LEFT_PAGE) || Input.trigger?(BUTTON_RIGHT_PAGE)
Sound.play_decision
main = @journal_window.main
@journal_window.dispose
@journal_window = Window_Simple_Journal.new(!main)
elsif Input.press?(Input::UP)
return if @journal_window.contents.height < @journal_window.height - 64
return if @journal_window.oy <= 0
@journal_window.oy -= 2
elsif Input.press?(Input::DOWN)
return if @journal_window.contents.height < @journal_window.height - 64
return if @journal_window.oy >= @journal_window.contents.height - @journal_window.height + 32
@journal_window.oy += 2
end
@journal_window.opacity = 0 if BACKGROUND_IMAGE_ACTIVE == true
end
def terminate(*args, &block)
# Method for disposing the bg and the journal window.
super
@journal_window.dispose
@bg.dispose if BACKGROUND_IMAGE_ACTIVE == true
end
end
class Window_Simple_Journal < Window_Base
include NICKE::JOURNAL_SYSTEM
attr_reader :main
def initialize(main = true)
super(0,0,WIDTH, HEIGHT)
@main = main
# This will allow scrolling if there are too many items.
if !@main
self.contents = Bitmap.new(self.width - 32, 64 + ($game_system.side_quests.size) * WLH * 2)
else
self.contents = Bitmap.new(self.width - 32, 64 + ($game_system.side_quests.size) * WLH * 2) unless SCROLL_MAIN_QUESTS != true
end
refresh
end
def refresh
self.contents.clear
# Add Graphics.
addGraphics
# Add Quests.
addQuests
end
def self_rect
# Return the value of contents rect.
return self.contents.rect
end
def draw_text(x, y, text, align)
# Method for drawing the text.
title = self_rect
title.x = x
title.y = y
title.height = 28
self.contents.draw_text(title,text,align)
end
def draw_line(x, y)
# Create two lines actually, one is acting like the shadow.
line = self_rect
line.height = 1
line.width -= 10
line.x = x
line.y = y
self.contents.fill_rect(line,normal_color)
line.y += 1
color = Color.new(0,0,0,200)
self.contents.fill_rect(line,color)
end
def addQuests
if @main
# Fill it with the current main quest data.
quests = $game_system.main_quests
else
# Fill it with the current side quest data.
quests = $game_system.side_quests
end
# If no quests have been added show no entries instead.
if quests.empty?
contents.font.name = FONT_TYPE
contents.font.size = NO_E_FONT_SIZE
contents.font.color = NO_E_FONT_COLOR
contents.font.shadow = NO_E_FONT_SHADOW
draw_text(0, 160, NO_ENTRIES, 1)
return
end
yoff = WLH * 2
quests.each_with_index { |q, i|
draw_icon( q[0], 0, i * yoff + 84) ;
# Font, size, color & shadow.
contents.font.name = FONT_TYPE
contents.font.size = QUEST_HEADER_SIZE
contents.font.color = QUEST_HEADER_COLOR
contents.font.shadow = QUEST_HEADER_SHADOW
self.contents.draw_text(10, 68 + i * yoff, self.contents.width - 16, WLH, q[1], 1)
contents.font.name = FONT_TYPE
contents.font.size = QUEST_DETAILS_SIZE
contents.font.color = QUEST_DETAILS_COLOR
contents.font.shadow = QUEST_DETAILS_SHADOW
self.contents.draw_text(27, 60 + (i * yoff)+WLH, self.contents.width - 16, WLH, q[2])
}
end
def addGraphics
# Method for drawing the graphics and some headers.
self.contents.font.name = FONT_TYPE
self.contents.font.size = T_FONT_SIZE
self.contents.font.color = T_FONT_COLOR
self.contents.font.shadow = T_FONT_SHADOW
draw_text(0, 0, TITLE, 1) if BACKGROUND_IMAGE_ACTIVE != true
self.contents.font.name = FONT_TYPE
self.contents.font.size = H_FONT_SIZE
self.contents.font.color = H_FONT_COLOR
self.contents.font.shadow = H_FONT_SHADOW
if @main
draw_text(0, 42, MAIN_Q_HEADER, 1)
self.contents.font.name = FONT_TYPE
self.contents.font.size = F_FONT_SIZE
self.contents.font.color = F_FONT_COLOR
self.contents.font.shadow = F_FONT_SHADOW
draw_text(0,360, FOOTER, 1) unless SCROLL_MAIN_QUESTS == true
draw_line(5,356) unless SCROLL_MAIN_QUESTS == true
else
draw_text(0, 42, SIDE_Q_HEADER, 1)
end
draw_line(5,36) if BACKGROUND_IMAGE_ACTIVE != true
end
end # END OF FILE
#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*=#
RE: Dziennik zadań. (Wciąż aktualne) Tydzień bez odpowiedzi, jest tam kto? - Revlis - 17-03-15 00:25
Dziękuję serdecznie, jestem Twoim dłużnikiem :)
|