06-01-2005, 01:00 PM
Questlog System
Me / Derk-Jan
Beta 3.0
June 1 2005
This is the demo
ScriptProject86.exe (Size: 287.97 KB / Downloads: 1)
At the top of the Game_Party init section:
then after def intialize
second in $game_system, right after def intialize
THIS MIGHT LOOK STRANGE, BUT YOU WILL SEE WHY AFTER YOU PUT IT IN
This is where u have to put your quest information, as you can see i set "beginn_switches" to 1, and "max_quests" => 100, quest 1 will use switch 1, 101, 201, 301, 401 ... quest 2 will use switch 2, 102, 202, 203 etc.
Now make 3 new scripts above main:
Window_Quest
Window_QuestOverview
Scene_QuestLog
The syntax:
to call the window: $scene= Scene_QuestLog.new
To enable quests: $game_party.quests[quest + text number] = true
like 1 (actually 001) = quest 1 text 0, 105 = quest 5 text 1
Mr. DJ Me Derk-Jan
Me / Derk-Jan
Beta 3.0
June 1 2005
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given.
No support is given.
This is the demo
ScriptProject86.exe (Size: 287.97 KB / Downloads: 1)
At the top of the Game_Party init section:
Code:
attr_accessor :quests
then after def intialize
Code:
@quests = []
@quests = Array.new(2000, false)
second in $game_system, right after def intialize
THIS MIGHT LOOK STRANGE, BUT YOU WILL SEE WHY AFTER YOU PUT IT IN
Code:
$quest_switches=[]
$quest_log = {
"beginn_switches" => 1,
"max_quests" => 100,
"quests" =>
[
{ "title" => "Search for the miracle leaf",
"texts" => [
"The old man at likayla city told me about a leaf that i can only find inside the dungeon of marupa.",
"Marupa is a nice city, however, every time i ask about the miracle leaf, they all seem to have to maw the grass?!?",
"Also BlueGirl could tell me nothing..."
]
},
{ "title" => "Title of quest2",
"texts" => [
"Text of switch 2 enabled",
"Text of switch 102 enabled",
"Text of switch 202 enabled",
"Text of switch 302 enabled"
]
}
]
}
This is where u have to put your quest information, as you can see i set "beginn_switches" to 1, and "max_quests" => 100, quest 1 will use switch 1, 101, 201, 301, 401 ... quest 2 will use switch 2, 102, 202, 203 etc.
Me Wrote:These are not the regular switchesm but the $game_party.quest switches!
Now make 3 new scripts above main:
Window_Quest
Code:
class Window_Quest < Window_Base
def initialize(quest)
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@quest = quest
refresh
end
def refresh
self.contents.clear
$quest_variables[1]= 23
#ein etwas größeres problem, zeilenumbrüche
height = contents.text_size("Pg").height
line_length = 590 #evtl gibts hierfür nen besseren wert. könnt je mal nen bischen rumprobieren.
line = 0
for i in 0 ... $quest_log["quests"][@quest]["texts"].length
if $game_party.quests[$quest_log["max_quests"]*i+$quest_log["beginn_switches"]+@quest] == true
text = $quest_log["quests"][@quest]["texts"][i]
pos = text.length
while contents.text_size(text).width > line_length
leer_pos = 0
pos = 0
#versuch 2, etwas langsammer, aber sicherer
#erstmal solange durchgehen, bis die textlänge zu lang ist
while contents.text_size(text[0, pos]).width < line_length && pos < text.length
pos += 1
end
#jetzt von hinten nach forne lehrstellen finden
leer_pos = pos
while leer_pos > 0
if text[leer_pos] == 32
break
end
leer_pos -= 1
end
#hoffentlich haben wir jetzt ne leerstelle gefunden
if leer_pos == 0
self.contents.draw_text(4, 2+line*height, 632,height, text[0,pos])
text = text[pos, text.length]
else
self.contents.draw_text(4, 2+line*height, 632,height, text[0,leer_pos])
text = text[leer_pos+1, text.length]
end
line += 1
end
if ( text.length > 0 )
self.contents.draw_text(4, 2+line*height, 632,height, text[0,pos])
line += 1
end
line += 1
end
end
end
end
Window_QuestOverview
Code:
class Window_QuestOverview < Window_Selectable
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@quest_hash = [ 0 ]
refresh
self.index = 0
end
def refresh
self.contents.clear
@cnt = 0
for i in 0...$quest_log["quests"].length
if $game_party.quests[$quest_log["beginn_switches"]+i] == true
@quest_hash[@cnt]=i
draw_item(i)
@cnt += 1
end
end
@item_max = @cnt
end
def draw_item(index)
y = 2 + @cnt * 32
self.contents.draw_text(4, y, 632, 32, $quest_log["quests"][index]["title"])
end
def get_quest
return @quest_hash[self.index]
end
end
Scene_QuestLog
Code:
class Scene_QuestLog
def main
@quest_window = Window_QuestOverview.new
@show_quest = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@quest_window.dispose
end
def update
if @show_quest == true
@squest_window.update
else
@quest_window.update
end
update_command
end
def update_command
if Input.trigger?(Input::B)
if @show_quest
$game_system.se_play($data_system.cancel_se)
@show_quest = false
@quest_window.active = true
@quest_window.visible = true
@squest_window.active = false
@squest_window.visible = false
@squest_window.dispose
else
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(3)
return
end
end
if Input.trigger?(Input::C)
if @show_quest
$game_system.se_play($data_system.cancel_se)
@show_quest = false
@quest_window.active = true
@quest_window.visible = true
@squest_window.active = false
@squest_window.visible = false
else
$game_system.se_play($data_system.decision_se)
@squest_window = Window_Quest.new(@quest_window.get_quest)
@quest_window.active=false
@quest_window.visible=false
@show_quest = true
end
end
end
end
The syntax:
to call the window: $scene= Scene_QuestLog.new
To enable quests: $game_party.quests[quest + text number] = true
like 1 (actually 001) = quest 1 text 0, 105 = quest 5 text 1
Mr. DJ Me Derk-Jan