Night.png);">
Apprendre


Vous êtes
nouveau sur
Oniromancie?

Visite guidée
du site


Découvrir
RPG Maker

RM 95
RM 2000/2003
RM XP
RM VX/VX Ace
RM MV/MZ

Apprendre
RPG Maker

Tutoriels
Guides
Making-of

Dans le
Forum

Section Entraide

Tutos: Checklist de la composition (...) / Sorties: Dread Mac Farlane - episode 8 / Sorties: Dread Mac Farlane - episode 7 / Jeux: Ce qui vit Dessous / News: Quoi de neuf sur Oniromancie (...) / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

467 connectés actuellement

29383645 visiteurs
depuis l'ouverture

5 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

RPG Maker Détente

New RPG Maker

Lumen

RPG Fusion

Kingdom Ultimate

Tous nos partenaires

Devenir
partenaire



forums

Index du forum > Entraide > [RESOLU] [RPG Maker VX] Problème quête annexe


Lnaunboq - posté le 19/06/2013 à 16:47:33 (77 messages postés)

❤ 0

Domaine concerné: Script
Logiciel utilisé: RPG Maker VX
Bonjour à tous !

Donc, voilà. J'utilise un script qui permet d'avoir des quêtes annexes dans son jeu, très pratique à mon gout.
Mais, quand on rentre minimum 18 quêtes dans le script, les quêtes à partir de 18 sont hors de l'écran.
Donc, j'aimerai qu'on puisse avec ce script, descendre dans le menu, pour avoir accès aux autres quêtes (comme pour le script d'inventaire de base, par exemple).

Voilà le script :

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
=begin
#----Script créé par Josué Alvarez (RPG-Man)---#
Bon, quelques explications s'imposent :
 
=== Dans "def initialize" on doit avoir : ===
(Pour en rajouter)
@id_switch_qX = Y
Avec X : numéro de la quête
Avec Y : ID du switch qui fait que la quête est terminée
 
@id_switch_qdX = Y
Avec X : numéro de la quête
avec Y : ID du switch qui fait que la quête est débloquée
 
=== Dans "Def create_command_window", on doit avoir : ===
#---- Quête 1 ----#
if $game_switches[@id_switch_qd1] == true
s1 = "Nom quête 1"
else
s1 = "Quête_1 (vérouillée)"
end
#---- Quête 2 ----#
if $game_switches[@id_switch_qd2] == true
s2 = "Nom quête 2"
else
s2 = "Quête_2 (vérouillée)"
end
#---- Quête 3 ----#
if $game_switches[@id_switch_qd3] == true
s3 = "Nom quête 3"
else
s3 = "Quête_3 (vérouillée)"
end
@command_window = Window_Command.new(160, [s1, s2, s3])
 
Si vous rajoutez une quête, rajoutez pour que ça donne ça:
=== Dans "Def create_command_window", on doit avoir : ===
#---- Quête 1 ----#
if $game_switches[@id_switch_qd1] == true
s1 = "Nom quête 1"
else
s1 = "Quête_1 (vérouillée)"
end
#---- Quête 2 ----#
if $game_switches[@id_switch_qd2] == true
s2 = "Nom quête 2"
else
s2 = "Quête_2 (vérouillée)"
end
#---- Quête 3 ----#
if $game_switches[@id_switch_qd3] == true
s3 = "Nom quête 3"
else
s3 = "Quête_3 (vérouillée)"
end
#---- Quête 4 ----#
if $game_switches[@id_switch_qd4] == true
s4 = "Nom quête 4"
else
s4 = "Quête_4 (vérouillée)
end
@command_window = Window_Command.new(160, [s1, s2, s3, s4 ]) #(NE PAS OUBLIER DE RAJOUTER ICI!!)
 
=== Dans "texte_quete" : ===
A chaque fois qu'une quête est rajoutée, il faut rajouter (au bon endroit, mais ça se voir)
when (numero de la quete, SANS PARENTHESES!!)
@image_b.bitmap = Cache.picture("Nom de l'image")
 
== Dans "def image_c" ===
Si vous avez rajouté des quêtes :
when (numéro de la quete -1, vous verrez c'est à la suite)
if $game_switches[@id_switch_qX] == true #Avec X le n° de la quete
@image_c.bitmap = Cache.picture("Quete_ter")
 
=== Dans def image_d ===
Si vous avez rajouté des quêtes :
when (numéro de la quete -1, vous verrez c'est à la suite)
if $game_switches[@id_switch_qdX] == false # Avec X numéro de la quête
@image_c.bitmap = Cache.picture("Quete_cache")
 
=== Dans "def update_command_selection" :===
Si vous avez rajouté une quête, rajoutez :
when (numéro de la quete -1, vous verrez c'est à la suite)
@image_a = (Le même n° que dans when)
texte_quete
image_c
image_d
NE PAS OUBLIER LES IMAGES QUI VONT AVEC !!!!
=end
#================================================================
#Classe Scene_Quete par RPG-Man #================================================================
class Scene_Quete
def main
start
picture_back
perform_transition
Input.update
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.update
pre_terminate
Graphics.freeze
terminate
end
 
def initialize(menu_index = 0)
@menu_index = menu_index
picture_back
texte_quete
image_c
#---- Switches quetes débloquées ---#
@id_switch_qd1 = 4980
@id_switch_qd2 = 4978
@id_switch_qd3 = 4976
@id_switch_qd4 = 4974
@id_switch_qd5 = 4972
@id_switch_qd6 = 4970
@id_switch_qd7 = 4968
@id_switch_qd8 = 4966
@id_switch_qd9 = 4964
@id_switch_qd10 = 4962
@id_switch_qd11 = 4951
@id_switch_qd12 = 4940
@id_switch_qd13 = 4938
@id_switch_qd14 = 4936
@id_switch_qd15 = 4934
@id_switch_qd16 = 4932
@id_switch_qd17 = 4930
@id_switch_qd18 = 4928
#---- Switches quetes terminées ---#
@id_switch_q1 = 4979
@id_switch_q2 = 4977
@id_switch_q3 = 4975
@id_switch_q4 = 4973
@id_switch_q5 = 4971
@id_switch_q6 = 4969
@id_switch_q7 = 4967
@id_switch_q8 = 4965
@id_switch_q9 = 4963
@id_switch_q10 = 4961
@id_switch_q11 = 4950
@id_switch_q12 = 4939
@id_switch_q13 = 4937
@id_switch_q14 = 4935
@id_switch_q15 = 4933
@id_switch_q16 = 4931
@id_switch_q17 = 4929
@id_switch_q18 = 4927
 
end
 
def create_menu_background
@menuback_sprite = Sprite.new
@menuback_sprite.bitmap = $game_temp.background_bitmap
@menuback_sprite.color.set(16, 16, 16, 128)
update_menu_background
end
 
def dispose_menu_background
@menuback_sprite.dispose
end
 
def update_menu_background
end
 
def perform_transition
Graphics.transition(10)
end
 
def start
create_menu_background
create_command_window
picture_back
texte_quete
image_c
end
 
def pre_terminate
@command_window.close
@picture_back = nil
begin
@command_window.update
Graphics.update
end
end
def terminate
dispose_menu_background
@command_window.dispose
 
end
 
def update
update_menu_background
@command_window.update
texte_quete
if @command_window.active
update_command_selection
elsif @status_window.active
update_actor_selection
picture_back
end
end
 
#=============================================
#---- Image fond ----#
#=============================================
def picture_back
#~ @picture_back = Sprite.new
#~ @picture_back.bitmap = Cache.picture("Menu_quetes")
end
#=============================================
#---- Affichage des noms des quetes ----#
#=============================================
def create_command_window
#---- Quête 1 ----#
if $game_switches[@id_switch_qd1] == true
s1 = "Quête 1"
else
s1 = "???"
end
#---- Quête 2 ----#
if $game_switches[@id_switch_qd2] == true
s2 = "Quête 2"
else
s2 = "???"
end
#---- Quête 3 ----#
if $game_switches[@id_switch_qd3] == true
s3 = "Quête 3"
else
s3 = "???"
end
#---- Quête 4 ----#
if $game_switches[@id_switch_qd4] == true
s4 = "Quête 4"
else
s4 = "???"
end
#---- Quête 5 ----#
if $game_switches[@id_switch_qd5] == true
s5 = "Quête 5"
else
s5 = "???"
end
#---- Quête 6 ----#
if $game_switches[@id_switch_qd6] == true
s6 = "Quête 6"
else
s6 = "???"
end
#---- Quête 7 ----#
if $game_switches[@id_switch_qd7] == true
s7 = "Quête 7"
else
s7 = "???"
end
#---- Quête 8 ----#
if $game_switches[@id_switch_qd8] == true
s8 = "Quête 8"
else
s8 = "???"
end
#---- Quête 8 ----#
if $game_switches[@id_switch_qd8] == true
s8 = "Quête 8"
else
s8 = "???"
end
#---- Quête 9 ----#
if $game_switches[@id_switch_qd9] == true
s9 = "Quête 9"
else
s9 = "???"
end
#---- Quête 10 ----#
if $game_switches[@id_switch_qd10] == true
s10 = "Quête 10"
else
s10 = "???"
end
#---- Quête 11 ----#
if $game_switches[@id_switch_qd11] == true
s11 = "Quête 11"
else
s11 = "???"
end
#---- Quête 12 ----#
if $game_switches[@id_switch_qd12] == true
s12 = "Quête 12"
else
s12 = "???"
end
#---- Quête 13 ----#
if $game_switches[@id_switch_qd13] == true
s13 = "Quête 13"
else
s13 = "???"
end
#---- Quête 14 ----#
if $game_switches[@id_switch_qd14] == true
s14 = "Quête 14"
else
s14 = "???"
end
#---- Quête 15 ----#
if $game_switches[@id_switch_qd15] == true
s15 = "Quête 15"
else
s15 = "???"
end
#---- Quête 16 ----#
if $game_switches[@id_switch_qd16] == true
s16 = "Quête 16"
else
s16 = "???"
end
#---- Quête 17 ----#
if $game_switches[@id_switch_qd17] == true
s17 = "Quête 17"
else
s17 = "???"
end
#---- Quête 18 ----#
if $game_switches[@id_switch_qd18] == true
s18 = "Quête 18"
else
s18 = "???"
end
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9,s10,s11,s12,s13,s14,s15,s16,s17,s18])
@command_window.index = @menu_index
@command_window.openness = 0
@command_window.open
end
#=============================================
#---- Affichage de l'image de quête ----#
#=============================================
def texte_quete
if @image_b == nil
@image_b = Sprite.new
@image_b.opacity = 255
case @image_a
when 0
@image_b.bitmap = Cache.picture("Quete_1")
when 1
@image_b.bitmap = Cache.picture("Quete_2")
when 2
@image_b.bitmap = Cache.picture("Quete_3")
when 3
@image_b.bitmap = Cache.picture("Quete_4")
when 4
@image_b.bitmap = Cache.picture("Quete_5")
when 5
@image_b.bitmap = Cache.picture("Quete_6")
when 6
@image_b.bitmap = Cache.picture("Quete_7")
when 7
@image_b.bitmap = Cache.picture("Quete_8")
when 8
@image_b.bitmap = Cache.picture("Quete_9")
when 9
@image_b.bitmap = Cache.picture("Quete_10")
when 10
@image_b.bitmap = Cache.picture("Quete_11")
when 11
@image_b.bitmap = Cache.picture("Quete_12")
when 12
@image_b.bitmap = Cache.picture("Quete_13")
when 13
@image_b.bitmap = Cache.picture("Quete_14")
when 14
@image_b.bitmap = Cache.picture("Quete_15")
when 15
@image_b.bitmap = Cache.picture("Quete_16")
when 16
@image_b.bitmap = Cache.picture("Quete_17")
when 17
@image_b.bitmap = Cache.picture("Quete_18")
end
 
end
 
end
#=============================================
#---- Affichage de l'image lorsque la quête est réussie ----#
#=============================================
def image_c 
if @image_c == nil
@image_c = Sprite.new
case @image_a
when 0
if $game_switches[@id_switch_q1] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 1
if $game_switches[@id_switch_q2] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 2
if $game_switches[@id_switch_q3] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 3
if $game_switches[@id_switch_q4] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 4
if $game_switches[@id_switch_q5] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 5
if $game_switches[@id_switch_q6] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 6
if $game_switches[@id_switch_q7] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 7
if $game_switches[@id_switch_q8] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 8
if $game_switches[@id_switch_q9] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 9
if $game_switches[@id_switch_q10] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 10
if $game_switches[@id_switch_q11] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 11
if $game_switches[@id_switch_q11] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 12
if $game_switches[@id_switch_q11] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 13
if $game_switches[@id_switch_q11] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 14
if $game_switches[@id_switch_q11] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 15
if $game_switches[@id_switch_q11] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 16
if $game_switches[@id_switch_q11] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
when 17
if $game_switches[@id_switch_q11] == true
@image_c.bitmap = Cache.picture("Quete_ter")
end
 
end
 
end
 
end
#================================================
#---- Affichage de l'image cachant la quête non débloquée ----#
#================================================
def image_d 
if @image_d == nil
@image_d = Sprite.new
case @image_a
when 0
if $game_switches[@id_switch_qd1] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 1
if $game_switches[@id_switch_qd2] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 2
if $game_switches[@id_switch_qd3] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 3
if $game_switches[@id_switch_qd4] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 4
if $game_switches[@id_switch_qd5] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 5
if $game_switches[@id_switch_qd6] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 6
if $game_switches[@id_switch_qd7] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 7
if $game_switches[@id_switch_qd8] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 8
if $game_switches[@id_switch_qd9] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 9
if $game_switches[@id_switch_qd10] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 10
if $game_switches[@id_switch_qd11] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 11
if $game_switches[@id_switch_qd12] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 12
if $game_switches[@id_switch_qd13] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 13
if $game_switches[@id_switch_qd14] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 14
if $game_switches[@id_switch_qd15] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 15
if $game_switches[@id_switch_qd16] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 16
if $game_switches[@id_switch_qd17] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
when 17
if $game_switches[@id_switch_qd18] == false
@image_c.bitmap = Cache.picture("Quete_cache")
@image_b.dispose
end
 
end
end
end
#================================================
#---- Sélection ----#
#================================================
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Menu.new
@picture_back = nil
@image_b = nil
@image_a = nil
@image_c = nil #Réussie
@image_d = nil #Cache image
elsif Input.trigger?(Input::C)
Sound.play_decision
if @image_b != nil and
@image_c != nil and
@image_d != nil
@image_b.dispose
@image_c.dispose
@image_d.dispose
end
@image_a = nil
@image_c = nil
@image_d = nil
@image_b = nil
case @command_window.index
when 0
@image_a = 0
texte_quete
image_c
image_d
when 1
@image_a = 1
texte_quete
image_c
image_d
when 2
@image_a = 2
texte_quete
image_c
image_d
when 3
@image_a = 3
texte_quete
image_c
image_d
when 4
@image_a = 4
texte_quete
image_c
image_d
when 5
@image_a = 5
texte_quete
image_c
image_d
when 6
@image_a = 6
texte_quete
image_c
image_d
when 7
@image_a = 7
texte_quete
image_c
image_d
when 8
@image_a = 8
texte_quete
image_c
image_d
when 9
@image_a = 9
texte_quete
image_c
image_d
when 10
@image_a = 10
texte_quete
image_c
image_d
when 11
@image_a = 11
texte_quete
image_c
image_d
when 12
@image_a = 12
texte_quete
image_c
image_d
when 13
@image_a = 13
texte_quete
image_c
image_d
when 14
@image_a = 14
texte_quete
image_c
image_d
when 15
@image_a = 15
texte_quete
image_c
image_d
when 16
@image_a = 16
texte_quete
image_c
image_d
when 17
@image_a = 17
texte_quete
image_c
image_d
end
end
end
 
end



Merci d'avance :sourire2


cortez - posté le 19/06/2013 à 19:16:29 (523 messages postés)

❤ 0

Ce script n'a pas été prévu pour afficher plus de 18 quêtes (le scripteur à fait un travail baclé.)

Je te propose 2 script afin de remplacer celui que tu as.

http://rpgmaker.net/scripts/237/

ou alors celui là :

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
 #==============================================================================
#  Quest Journal
#  Version: 1.1
#  Author: modern algebra (rmrk.net)
#  Date: March 24, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Description:
#      Basically, this script is an objective based quest log that allows the 
#    user to make quests and reveal them to the characters through specified
#    script calls. It is objective based, meaning that you advance the quest
#    by having the player complete objectives and you can choose when to reveal
#    these objectives and when to set them as complete or as failed. That being
#    said, this script does not build quests, it more or less gives you a 
#    graphical interface for showing quest progress. It does run by script 
#    call, and so read the instructions carefully if you want to use this script
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Instructions:
#      Basically, set up all of your quests in the module below. The Constants 
#    section is annotated, so read the comments near them to determine what you
#    should set these constants to. As you can see, they are filled in with 
#    default values currently, and so that should give you an idea of what to
#    do.
#
#      Setting up quests can be a little bit harder. You will have to set one 
#    of these up for every quest that you want represented in the scene. Refer
#    to the editable region inside the class Quest for further instructions
#
#      Once they are setup, you can activate them at any time in the game by 
#    this code:
#
#      $game_party.quests[quest_id]
#
#    There are several methods you can call that are of relevance. Namely:
#
#        $game_party.quests[quest_id].reveal_objective (objective_id)
#        $game_party.quests[quest_id].conceal_objective (objective_id)
#        $game_party.quests[quest_id].complete_objective (objective_id)
#        $game_party.quests[quest_id].uncomplete_objective (objective_id)
#        $game_party.quests[quest_id].fail_objective (objective_id)
#        $game_party.quests[quest_id].unfail_objective (objective_id)
#        $game_party.quests[quest_id].complete?
#        $game_party.quests[quest_id].failed?
#        $game_party.quests[quest_id].reward_given = true/false
#        $game_party.quests[quest_id].concealed = true/false
#        $game_party.quests.remove (quest_id)
#
#    There are other methods that you can access, but they are irrelevant for
#    the purposes of controlling quest progress. These are fairly self-
#    explanatory methods, but in case they aren't, reveal_objective naturally
#    allows the specified objective to appear in the Quest Journal for browsing
#    by the user. complete_objective notes when an objective is complete, and 
#    fail_objective notes when the player has done something that fails this
#    objective. complete? returns true if all primary objectives have been
#    completed and failed? returns true if any primary objective has been 
#    failed. reward_given serves the function of a switch. You should 
#    essentially make the reward event look like this:
#
#      @> Conditional Branch: Script: $game_party.quests[quest_id].complete?
#        @> Conditional Branch: Script: $game_party.quests[quest_id].reward_given
#          @> ...Thank you or whatever you want the event to say once the reward has been given
#        @> Else
#          @> ...Give Reward
#          @> Script: $game_party.quests[quest_id].reward_given = true
#        @> Branch End
#      @> Branch End
#
#     Later versions of this script will have an auto-reward system and also a
#     Journal to which the player can write notes.
#
#     You can also disable access to the Quest Log at any time with the code:
#       $game_system.quest_disabled = true
#
#     And you can change how it is accessed with the codes:
#     
#       $game_system.quest_keyaccess = true / false  # ON MAP
#       $game_system.quest_menuaccess = true / false # IN MENU
#
#     Also, in a message, \nq[quest_id] will retrieve the name of a quest and
#     print it in a message
#================================================================================
# *** Quest Data
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  This is the configuration class for the Quest Journal
#================================================================================
 
module ModAlg_QuestData
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Constants
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Editable Region
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  QUESTS_LABEL = 'Quests'        # What you want Quests to be called (eg. 'Missions')
  ACTIVE_QUEST_ICON = 149        # What icon signifies a quest is active
  COMPLETE_QUEST_ICON = 150      # What icon signifies a quest is complete
  FAILED_QUEST_ICON = 179        # What icon signifies a quest is failed
  BULLET_CHARACTER = '●'         # The character used for listing objectives
  ACTIVE_COLOUR = 0              # The colour of a quest that is active
  COMPLETE_COLOUR = 11           # The colour of a quest that is complete
  FAILED_COLOUR = 18             # The colour of a quest that is failed
  MENU_ACCESS = true             # Can the script be accessed through the menu?
  MENU_INDEX = 4                 # If above is true, where in the command window?
  KEY_ACCESS = false             # Can the quest log be accessed by a key         
  MAPKEY_BUTTON = Input::L       # If above is true, which button?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Quest Data
  #----------------------------------------------------------------------------
  #  Returns skeleton data for the quesr
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.quest_data (id)
    # Set class variables to corresponding arguments
    objectives = []
    name = '??????'
    description = '??????????'
    icon_index = 0
    case id
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * EDITABLE REGION
    #------------------------------------------------------------------------
    #  To set up a quest, first identify it with an ID - this can be anything
    #  as long as it is not the same as another quest, but it is important to
    #  remember this ID as it is the only way to access your quest.
    #    In any case, the format for setting up a quest is:
    #
    #      when <quest_id> # Give the quest an ID number
    #        name = '<quest_name>' 
    #        description = '<quest_description>'
    #        objectives[0] = '<first_objective>'
    #        ...
    #        objectives[n] = '<nth objective>' 
    #        prime = [<objective_id>, ..., <objective_id>]
    #        icon_index = <quest_icon_index>
    #
    #    Each of these values have an importance.
    #      name is the name of the quest
    #      description is a small blurb explaining the overall goal of the quest
    #      objective[0..n] are short-term goals that lead to the overall goal
    #      primes are which objectives need to be complete before the quest is
    #        considered to be complete
    #      icon_index is the icon that represents the quest
    #
    #    Note that any of the above values can be omitted without throwing an 
    #    error, but for the quest to work properly you should at least set the
    #    name, description, and objectives. If you do omit these, the default 
    #    values are:
    #   
    #      name = '??????'
    #      description = '??????????'
    #      objectives = []
    #      prime = [all objectives]
    #      icon_index = 0
    #
    #   If you do want to require that all objectives must be satisfied before
    #   the quest is complete, then do not bother defining it. Otherwise, be 
    #   sure to set it.
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    when 1 # Fetch
      name = 'Fetch'
      description = 'Martha needs someone to play with her dog'
      objectives[0] = 'Find a stick'
      objectives[1] = 'Throw the stick to the dog'
      objectives[2] = 'Retrieve the stick from the dog'
      icon_index = 79
    when 4 # Cat Retrieval
      name = 'Cat Retrieval'
      description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
      objectives[0] = 'Find the lost cat'
      objectives[1] = 'Climb the tree and retrieve the cat'
      objectives[2] = "Return a cat to Mrs. Bunderby"
      # Set prime objectives in an array based on index 
      prime = [0, 2]
      icon_index = 137
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * END EDITABLE REGION
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    end
    return name, description, objectives, prime, icon_index
  end
  
  #============================================================================
  # ** Quest
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #  Holds in-game data for a quest
  #============================================================================
 
  class Quest
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Public Instance Variables
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    attr_reader   :name                # The name of the quest
    attr_reader   :id                  # The ID in $game_party.quests
    attr_reader   :description         # A blurb explaining the quest
    attr_reader   :objectives          # An array of strings holding objectives
    attr_reader   :prime_objectives    # An array of crucial objectives
    attr_reader   :icon_index          # The Icon associated with this quest
    attr_reader   :revealed_objectives # An array of revealed objectives
    attr_reader   :complete_objectives # An array of completed objectives
    attr_reader   :failed_objectives   # An array of failed objectives
    attr_accessor :reward_given        # A switch to ensure only one reward given
    attr_accessor :concealed           # A switch to show or not show the quest
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Object Initialization
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def initialize (id)
      @id = id
      # Set class variables to corresponding arguments
      @name, @description, @objectives, prime, @icon_index = ModAlg_QuestData.quest_data (id)
      # If no primary objectives are specified
      if prime.nil?
        # All objectives become primary
        prime = []
        for i in 0...@objectives.size
          prime.push (i)
        end
      end
      @prime_objectives = prime
      # Initialize non-public arrays
      @revealed_objectives = []
      @complete_objectives = []
      @failed_objectives = []
      @reward_given = false
      @concealed = false
    end 
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Reveal Objective
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def reveal_objective (index)
      return if index >= @objectives.size
      # Add to revealed objectives
      @revealed_objectives |= [index]
      # Sort from lowest index to highest index
      @revealed_objectives.sort!
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Conceal Objective
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def conceal_objective (index)
      @revealed_objectives.delete (index)
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Complete Objective
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def complete_objective (index)
      return if index >= @objectives.size
      # If the objective is failed, you cannot complete it.
      return if @failed_objectives.include? (index)
      # Reveal the objective if it was not previously revealed
      reveal_objective (index) unless @revealed_objectives.include? (index)
      # Add to complete objectives
      @complete_objectives |= [index]
      # Sort from lowest index to highest index
      @complete_objectives.sort!
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Uncomplete Objective
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def uncomplete_objective (index)
      @complete_objectives.delete (index)
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Fail Objective
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def fail_objective (index)
      return if index >= @objectives.size
      # Reveal the objective if it has not yet been revealed
      reveal_objective (index) unless @revealed_objectives.include? (index)
      # Add to revealed objectives
      @failed_objectives |= [index]
      # Sort from lowest index to highest index
      @failed_objectives.sort!
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Unfail Objective
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def unfail_objective (index)
      @failed_objectives.delete (index)
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Complete?
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def complete? 
      # Check if all prime objectives have been completed
      return (@complete_objectives & @prime_objectives) == @prime_objectives
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Failed?
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def failed? 
      # Check if any prime objectives have been failed
      return (@failed_objectives & @prime_objectives) != []
    end
  end
end
 
#==============================================================================
# ** Ellipse
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Stores an ellipse object.
#==============================================================================
 
class Ellipse
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader   :a # The width of the oval
  attr_reader   :b # The Height of the oval
  attr_reader   :x # the top left x position
  attr_reader   :y # the top left y position
  attr_reader   :h # The x position of the origin
  attr_reader   :k # The y position of the origin
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #     x : the top left x position
  #     y : the top left y position
  #     a : the width of oval from origin to the side
  #     b : the height of oval from origin. If nil, then a is radius of circle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize (x, y, a, b = nil)
    @x = x
    @y = y
    @a = a
    @b = b.nil? ? a : b
    @h = x + a
    @k = y + @b
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Within?
  #    x : the x coordinate being tested
  #    y : the y coordinate being tested
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def within? (x, y)
    x_square = ((x - @h)*(x - @h)).to_f / (@a*@a)
    y_square = ((y - @k)*(y - @k)).to_f / (@b*@cool.gif
    # If "radius" <= 1, then it must be within the ellipse
    return (x_square + y_square) <= 1 
  end
end
 
#==============================================================================
# ** Bitmap
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  This adds the methods fill_ellipse, outline_ellipse, and fill_rounded_rect
#==============================================================================
 
class Bitmap
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Outline Ellipse
  #    ellipse : the ellipse being drawn
  #    width   : the width of the bar
  #    colour  : the colour of the outline
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def outline_ellipse (ellipse, colour = font.color, width = 1, steps = 0)
    # For neatness, define local variables a and b to the ellipse variables
    a, b = ellipse.a, ellipse.b
    # Use Ramanujan's approximation of the Circumference of an ellipse
    steps = Math:tongue.gifI*(3*(a + cool.gif - Math.sqrt((3*a + cool.gif*(a + 3*cool.gif)) if steps == 0
    radian_modifier = (2*Math:tongue.gifI) / steps
    for i in 0...steps
      t = (radian_modifier*i) % (2*Math:tongue.gifI)
      # Expressed parametrically:
      #   x = h + acos(t), y = k + bsin(t) : where t ranges from 0 to 2pi
      x = (ellipse.h + (a*Math.cos(t)))
      y = (ellipse.k + (b*Math.sin(t)))
      set_pixel (x, y, colour)
    end
    # Thicken the line
    if width > 1
      ellipse = Ellipse.new (ellipse.x + 1, ellipse.y + 1, ellipse.a - 1, ellipse.b - 1)
      outline_ellipse (ellipse, colour, width - 1, steps)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Fill Ellipse
  #    ellipse : the ellipse being drawn
  #    colour  : the colour of the outline
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def fill_ellipse (ellipse, colour = font.color, steps = 0)
    # For neatness, define local variables a and b to the ellipse variables
    a, b = ellipse.a, ellipse.b
    # Use Ramanujan's approximation of the Circumference of an ellipse
    steps = Math:tongue.gifI*(3*(a + cool.gif - Math.sqrt((3*a + cool.gif*(a + 3*cool.gif)) if steps == 0
    radian_modifier = (2*Math:tongue.gifI) / steps
    for i in 0...(steps / 2)
      t = (radian_modifier*i) % (2*Math:tongue.gifI)
      # Expressed parametrically:
      #   x = h + acos(t), y = k + bsin(t) : where t ranges from 0 to 2pi
      x = ellipse.h + (a*Math.cos(t))
      y = ellipse.k - (b*Math.sin(t))
      fill_rect (x, y, 1, 2*(ellipse.k - y), colour)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Fill Rounded Rectangle
  #    rect    : the rectangle being drawn
  #    colour  : the colour of the outline
  #    w       : the number of pixels to cover by rounding
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #  Used to fill a rectangle with rounded corners
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def fill_rounded_rect (rect, colour = font.color, w = 8)
    # Draw Body of the rectangle
    fill_rect (rect.x + w, rect.y, rect.width - 2*w, rect.height, colour)
    # Draw Left Vertical Rect
    fill_rect (rect.x, rect.y + w, w, rect.height - 2*w, colour)
    # Draw Right Vertical Rect
    x = rect.x + rect.width - w
    fill_rect (x, rect.y + w, w, rect.height - 2*w, colour)
    # Make a circle
    circle = Ellipse.new (0, 0, w)
    for i in 0...w
      for j in 0...w
        # Upper Left Corner
        set_pixel (rect.x + i, rect.y + j, colour) if circle.within? (i, j)
        # Upper Right Corner
        set_pixel (rect.x + rect.width - w + i, rect.y + j, colour) if circle.within? (i + w, j)
        # Bottom Left Corner
        set_pixel (rect.x + i, rect.y + rect.height - w + j, colour) if circle.within? (i, j + w)
        # Bottom Right Corner
        set_pixel (rect.x + rect.width - w + i, rect.y + rect.height - w + j, colour) if circle.within? (i + w, j + w) 
      end
    end
  end
end
 
#==============================================================================
# ** Window_VarySizeHelp
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  This window is the same as Window_Help, but with variable size
#==============================================================================
 
class Window_VarySizeHelp < Window_Help
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize (h_x = 0, h_y = 0, h_width = Graphics.width, h_height = WLH + 32)
    super ()
    self.x, self.y, self.width, self.height = h_x, h_y, h_width, h_height
    contents.dispose
    self.contents = Bitmap.new (h_width - 32, h_height - 32)
  end
end
 
#==============================================================================
# ** Game_System
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    new instance variables - quest_disabled, quest_keyaccess
#    aliased method - initialize
#==============================================================================
 
class Game_System
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_accessor :quest_disabled   # Can you access quest journal at this time
  attr_accessor :quest_keyaccess  # Is it accessible by key?
  attr_accessor :quest_menuaccess # Is it accessible through the menu
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_qst_jrnl_system_init_quests initialize
  def initialize
    # Run Original Method
    modalg_qst_jrnl_system_init_quests
    # Initialize new variables
    @quest_disabled = false
    @quest_keyaccess = ModAlg_QuestData::KEY_ACCESS
    @quest_menuaccess = ModAlg_QuestData::MENU_ACCESS
  end
end
 
#==============================================================================
# ** Game_Party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    new instance variable - quests
#    aliased method - initialize
#==============================================================================
 
class Game_Party
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader   :quests
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_qst_jrnl_party_init_quests initialize
  def initialize
    # Run Original Method
    modalg_qst_jrnl_party_init_quests
    # Initialize @quests
    @quests = Game_Quests.new
  end
end
 
#==============================================================================
# ** Game_Quests
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  This class handles Quests. It is a wrapper for the built-in class "Hash".
# The instance of this class is accessed by $game_party.quests
#==============================================================================
 
class Game_Quests
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize
    @data = {}
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Quest
  #    quest_id : the ID of the quest
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def [] (quest_id)
    @data[quest_id] = ModAlg_QuestData::Quest.new (quest_id) if @data[quest_id] == nil
    return @data[quest_id]
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Quest List
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def list
    quest_list = @data.values
    quest_list.each { |i| quest_list.delete (i) if i.concealed }
    return quest_list
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Completed Quest List
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def completed_list
    complete_quests = []
    list.each { |i| complete_quests.push (i) if i.complete? }
    return complete_quests
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Failed Quest List
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def failed_list
    failed_quests = []
    list.each { |i| failed_quests.push (i) if i.failed? }
    return failed_quests
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Active Quest List
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def active_list
    return list - failed_list - completed_list
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Revealed? 
  #    quest_id : the ID of a checked quest
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def revealed? (quest_id)
    return @data[quest_id] != nil
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Remove Quest
  #    quest_id : the ID of a checked quest
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def remove (quest_id)
    @data.delete (quest_id)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Clear
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def clear
    @data.clear
  end
end
 
#==============================================================================
# ** Window_Command
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    new instance variable - disabled_commands
#    aliased method - initialize, draw_item
#==============================================================================
 
class Window_Command
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader :disabled_commands
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Initialize
  #     width      : window width
  #     commands   : command string array
  #     column_max : digit count (if 2 or more, horizontal selection)
  #     row_max    : row count (0: match command count)
  #     spacing    : blank space when items are arrange horizontally
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_quest_jrnl_intlz initialize
  def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
    # Initialize new instance variable
    @disabled_commands = []
    # Run Original Method
    modalg_quest_jrnl_intlz (width, commands, column_max, row_max, spacing)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Item
  #     index   : item number
  #     enabled : enabled flag. When false, draw semi-transparently
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_quest_jrnl_itm_drw draw_item
  def draw_item (index, enabled = true)
    # Run Original Method
    modalg_quest_jrnl_itm_drw (index, enabled)
    enabled ? @disabled_commands.delete (index) : @disabled_commands.push (index)
  end
end
 
#==============================================================================
# ** Window_Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliaed method - convert_special_characters
#==============================================================================
 
class Window_Message
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Convert Special Characters
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_quest_jrnl_spec_char_convert convert_special_characters
  def convert_special_characters
    @text.gsub! (/\\NQ\[(\d+)\]/i) { $game_party.quests[$1.to_i] } # Name Quest
    # Run Original Method
    modalg_quest_jrnl_spec_char_convert 
  end
end
 
#==============================================================================
# ** Window_QuestLabel
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  This window signifies that this is a quest list
#==============================================================================
 
class Window_QuestLabel < Window_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize
    super (0, 0, 160 + WLH, 32 + WLH)
    create_contents
    contents.font.color = system_color
    contents.draw_text (0, 0, contents.width, WLH, ModAlg_QuestData::QUESTS_LABEL, 1)
  end
end
 
#==============================================================================
# ** Window_QuestCategory
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  This window displays which category is being viewed
#==============================================================================
 
class Window_QuestCategory < Window_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize
    super (0, WLH + 32, 160 + WLH, 64)
    create_contents
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #    category_index : icon to highlight -
  #                       0 => All, 1 => Active, 2 => Complete, 3 => Failed
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def refresh (category_index = 0)
    contents.clear
    # Retrieve Icon Bitmaps
    bitmap = Cache.system("Iconset")
    icon_index = ModAlg_QuestData::ACTIVE_QUEST_ICON
    active_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    icon_index = ModAlg_QuestData::COMPLETE_QUEST_ICON
    complete_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    icon_index = ModAlg_QuestData::FAILED_QUEST_ICON
    failed_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    # Combine the three icons for the All Icon
    all_icon = Bitmap.new (40, 32)
    all_icon.blt (0, 0, bitmap, complete_rect)
    all_icon.blt (20, 0, bitmap, failed_rect)
    all_icon.blt (8, 10, bitmap, active_rect)
    distance = (contents.width - 112) / 3
    x = 0
    # Draw the 'All' Icon onto the window
    contents.blt (x, 0, all_icon, all_icon.rect, category_index == 0 ? 255 : 128)
    x += 40 + distance
    # Draw the 'Active' Icon onto the window
    contents.blt (x, 4, bitmap, active_rect, category_index == 1 ? 255 : 128)
    x += 24 + distance
    # Draw the 'Complete' Icon onto the window
    contents.blt (x, 4, bitmap, complete_rect, category_index == 2 ? 255 : 128)
    x += 24 + distance
    # Draw the 'Failed' Icon onto the window
    contents.blt (x, 4, bitmap, failed_rect, category_index == 3 ? 255 : 128)
  end
end
 
#==============================================================================
# ** Window_QuestList
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  This window displays the list of quests
#==============================================================================
 
class Window_QuestList < Window_Selectable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize (category_index = 0, index = 0)
    super (0, 64 + (WLH + 32), 160 + WLH, Graphics.height - 64 - 2*(WLH + 32))
    @data = []
    @column_max = 1
    refresh (category_index)
    self.index = index
    self.active = true
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Quest
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def quest
    return @data[self.index]
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #    category_index : List to show -
  #                       0 => All, 1 => Active, 2 => Complete, 3 => Failed
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def refresh (category_index = 0)
    font = Font.new
    @data.clear
    self.index = 0
    # Get the quest list to be drawn
    case category_index
    when 0
      @data = $game_party.quests.list
    when 1
      @data = $game_party.quests.active_list
      font.color = text_color (ModAlg_QuestData::ACTIVE_COLOUR)
    when 2
      @data = $game_party.quests.completed_list
      font.color = text_color (ModAlg_QuestData::COMPLETE_COLOUR)
    when 3
      @data = $game_party.quests.failed_list
      font.color = text_color (ModAlg_QuestData::FAILED_COLOUR)
    end
    @item_max = @data.size
    unless contents == nil
      # Clear Contents
      contents.clear
      return if @data.empty?
      contents.dispose
    end
    # Create Contents
    self.contents = Bitmap.new (width - 32, WLH*@data.size)
    contents.font = font
    # Draw the Quest Names
    for i in 0...@data.size
      quest = @data[i]
      # If all, distinguish between quest types by colour
      if category_index == 0
        if quest.complete? 
          contents.font.color = text_color (ModAlg_QuestData::COMPLETE_COLOUR)
        elsif quest.failed?
          contents.font.color = text_color (ModAlg_QuestData::FAILED_COLOUR)
        else # Active
          contents.font.color = text_color (ModAlg_QuestData::ACTIVE_COLOUR)
        end
      end
      draw_icon (quest.icon_index, 0, i*WLH)
      # Draw the name of the quest
      contents.draw_text (24, i*WLH, contents.width - 24, WLH, quest.name)
    end
  end
end
 
#==============================================================================
# ** Window_QuestInfo
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  This window displays the information on the quest being viewed
#==============================================================================
 
class Window_QuestInfo < Window_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize
    super (160 + WLH, 0, Graphics.width - (160 + WLH), Graphics.height - (32 + WLH))
    create_contents
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def refresh (quest = nil)
    contents.clear
    return if quest == nil
    # Draw the name of the Quest, centred
    contents.font.color = normal_color
    contents.draw_text (0, 0, contents.width, WLH, quest.name, 1)
    # If the font has set width characters
    if contents.text_size ('w').width == contents.text_size ('i').width
      formatter = Paragrapher::Formatter_2.new
    else
      formatter = Paragrapher::Formatter.new
    end
    # Format the description
    desc_bitmap = Bitmap.new (contents.width - 16, (2.4*WLH).to_i)
    desc_bitmap.font.size -= 4
    formatted_desc = formatter.format (quest.description, desc_bitmap)
    # Draw the Description Box
    box_height = [WLH*(formatted_desc.lines.size + 1), 3*WLH].min
    rect = Rect.new (2, (1.5*WLH).to_i, contents.width - 4, box_height)
    contents.fill_rounded_rect (rect, system_color, 10)
    rect.x, rect.y = rect.x + 2, rect.y + 2
    rect.width, rect.height = rect.width - 4, rect.height - 4
    contents.fill_rounded_rect (rect, Color.new (0, 0, 0, 0), 10)
    tw = contents.text_size ('Description').width
    # Draw the description signifier
    contents.fill_rect (32, (1.5*WLH).to_i, tw + 2, 2, Color.new (0, 0, 0, 0))
    contents.font.color = system_color
    contents.draw_text (33, WLH, tw, WLH, 'Description')
    # Paragraph Artist
    artist = Paragrapher::Artist.new
    # If bitmap is too large
    if formatted_desc.lines.size < 2
      formatted_desc.bitmap = Bitmap.new (contents.width - 16, formatted_desc.lines.size*WLH)
      formatted_desc.bitmap.font.size -= 4
    end
    bmp = artist.draw (formatted_desc)
    # Centre within the box
    y = rect.y + 4 + (rect.height - bmp.height) / 2
    contents.blt (8, y, bmp, bmp.rect)
    bmp.dispose
    y = 2*WLH + rect.height + 4
    # Draw Objectives Signifier Text
    contents.font.color = system_color
    tw = contents.text_size ('Objectives').width
    contents.draw_text (32, y, tw, WLH, 'Objectives')
    y += WLH
    quest.revealed_objectives.each { |i|
      # Get the correct color
      contents.font.color = quest.complete_objectives.include? (i) ?
        text_color (ModAlg_QuestData::COMPLETE_COLOUR) : quest.failed_objectives.include? (i) ?
        text_color (ModAlg_QuestData::FAILED_COLOUR) : text_color (ModAlg_QuestData::ACTIVE_COLOUR)
      # Get objective
      objective = quest.objectives[i]
      # Draw Bullet
      tw = contents.text_size (ModAlg_QuestData::BULLET_CHARACTER).width
      x = 8
      contents.draw_text (x, y, tw, WLH, ModAlg_QuestData::BULLET_CHARACTER)
      x += tw + 4
      # Format the objective
      obj_bitmap = Bitmap.new (contents.width - x, 2*WLH)
      obj_bitmap.font = contents.font
      obj_bitmap.font.size -= 4
      formatted_obj = formatter.format (objective, obj_bitmap)
      # Draw Objective
      bmp = artist.draw (formatted_obj)
      contents.blt (x, y + 4, bmp, bmp.rect)
      # Modify the Y accordingly
      y += WLH*([formatted_obj.lines.size, 2].min)
    }
  end
end
 
#==============================================================================
# ** Scene_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased method - update
#==============================================================================
 
class Scene_Map < Scene_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Frame Update
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_quest_journal_map_upd_key_access update
  def update
    modalg_quest_journal_map_upd_key_access
    # If the quest log can be accessed by key and is not empty or disabled
    if $game_system.quest_keyaccess && !$game_system.quest_disabled && !$game_party.quests.list.empty?
      $scene = Scene_Quest.new if Input.trigger? (ModAlg_QuestData::MAPKEY_BUTTON)
    end
  end
end
 
#==============================================================================
# ** Scene_Menu
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased methods - initialize, create_command_window, update_command_selection
#==============================================================================
 
class Scene_Menu < Scene_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_quest_jrnl_init initialize
  def initialize(menu_index = 0)
    modalg_quest_jrnl_init (menu_index)
    return unless $game_system.quest_menuaccess
    if @menu_index == 'Quest'
      @menu_index = ModAlg_QuestData::MENU_INDEX
    elsif @menu_index >= ModAlg_QuestData::MENU_INDEX
      @menu_index += 1 
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Command Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_quest_journal_menu_cmmnd_win_create create_command_window
  def create_command_window
    modalg_quest_journal_menu_cmmnd_win_create 
    # If accessed through map, then don't add it to the menu
    return unless $game_system.quest_menuaccess
    c = @command_window.commands
    c.insert (ModAlg_QuestData::MENU_INDEX, ModAlg_QuestData::QUESTS_LABEL)
    width = @command_window.width
    disabled = @command_window.disabled_commands
    @command_window.dispose
    @command_window = Window_Command.new(width, c)
    @command_window.index = @menu_index
    # Disable all of the old commands as well
    disabled.each { |i| 
      i += 1 if i >= ModAlg_QuestData::MENU_INDEX
      @command_window.draw_item (i, false)
    }
    if $game_system.quest_disabled || $game_party.quests.list.empty? # If Quest Journal disabled
      @command_window.draw_item (ModAlg_QuestData::MENU_INDEX, false)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Command Selection
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_quest_journal_menu_cmmnd_select_upd update_command_selection
  def update_command_selection
    if $game_system.quest_menuaccess
      changed = false
      if @command_window.index == ModAlg_QuestData::MENU_INDEX && Input.trigger? (Input::C)
        if $game_system.quest_disabled || $game_party.quests.list.empty? # If Quest Journal disabled
          Sound.play_buzzer
        else
          # Open Quest Window
          Sound.play_decision
          $scene = Scene_Quest.new
        end
        return
      end
      # If the command index is greater than it ought to be, make sure 
      if @command_window.index > ModAlg_QuestData::MENU_INDEX
        @command_window.index = (@command_window.index - 1) % @command_window.commands.size
        changed = true
      end
    end
    modalg_quest_journal_menu_cmmnd_select_upd
    return unless $game_system.quest_menuaccess
    @command_window.index = (@command_window.index + 1) % @command_window.commands.size if changed
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Actor Selection
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_quest_jrnl_actor_selection_upd update_actor_selection
  def update_actor_selection
    changed = false
    if $game_system.quest_menuaccess && @command_window.index > ModAlg_QuestData::MENU_INDEX
      @command_window.index = (@command_window.index - 1) % @command_window.commands.size
      changed = true
    end
    modalg_quest_jrnl_actor_selection_upd
    return unless $game_system.quest_menuaccess
    @command_window.index = (@command_window.index + 1) % @command_window.commands.size if changed
  end
end
 
#==============================================================================
# ** Scene_Quest
#------------------------------------------------------------------------------
#  This class performs the quest screen processing.
#==============================================================================
 
class Scene_Quest < Scene_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(category_index = 0, quest_index = 0)
    @category_index = category_index
    @quest_index = quest_index
  end
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    # Create Windows
    @label_window = Window_QuestLabel.new
    @category_window = Window_QuestCategory.new
    @category_window.refresh (@category_index)
    @list_window = Window_QuestList.new (@category_index, @quest_index)
    @info_window = Window_QuestInfo.new 
    @info_window.refresh (@list_window.quest)
    @help_window = Window_VarySizeHelp.new
    @help_window.y = Graphics.height - @help_window.height
    @help_window.set_text ('Use Horizontal Arrow Keys to change categories', 1)
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @label_window.dispose
    @category_window.dispose
    @list_window.dispose
    @info_window.dispose
    @help_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    # Since the only possible activity is from @list_window, put it here
    @list_window.update
    if Input.trigger?(Input::cool.gif # If Button B is pressed
      Sound.play_cancel
      # If Returning to Menu
      if $game_system.quest_menuaccess
        $scene = Scene_Menu.new ('Quest')
      else # Returning to Map
        $scene = Scene_Map.new
      end
    elsif Input.trigger? (Input::C) # If C button is pressed
      # Open Journal (eventually)
    elsif Input.trigger? (Input::LEFT) # If Left direction pressed
      # Play Cursor SE
      Sound.play_cursor
      # Refresh Category Window
      @category_index = (@category_index - 1) % 4
      @category_window.refresh (@category_index)
      @list_window.refresh (@category_index)
      @info_window.refresh (@list_window.quest)
    elsif Input.trigger? (Input::RIGHT) # If Right direction pressed
      # Play Cursor SE
      Sound.play_cursor
      # Refresh Category Window
      @category_index = (@category_index + 1) % 4
      @category_window.refresh (@category_index)
      @list_window.refresh (@category_index)
      @info_window.refresh (@list_window.quest)
    # If scrolling through quests
    elsif Input.trigger? (Input::DOWN) || Input.trigger? (Input::UP)
      # Refresh Info Window
      @info_window.refresh (@list_window.quest)
    end
  end
end 




Lnaunboq - posté le 19/06/2013 à 22:15:03 (77 messages postés)

❤ 0

Merci beaucoup pour les scripts, le premier lien marche parfaitement Ken et est très à mon goût ^^
Merci encore:sourire2


MatteW - posté le 24/07/2013 à 12:16:05 (22 messages postés)

❤ 0

Salut Lnaunboq,
j'ai repris il y a quelques temps le script pour les quêtes que tu as, et il fonctionnait déjà avec plusieurs pages. Je l'ai même amélioré et réduit, je te le passe ici s'il t'intéresse :

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
=begin
#----Script créé par Josué Alvarez (RPG-Man)---#
 
 
Script repris par :    Mattew_Phoenyx_Eon,  Le 06/06/2013
 
Ajouts :
• Automatisation des noms de quête, et des noms des images selon un format laissé au choix.
• Plus besoin de cliquer pour afficher l'image de la quête, l'image montrée à droite est mise à jour automatiquement.
• Simplification du code, en passant par des fonctions plutot que de traiter au cas par cas avec un "CAS ... PARMIS"
• Sûrement un gain de temps de processeur
 
Rappels :
• Les images sont à placer dans le dossier "Graphics/Picture" du jeu
• L'appel du journal des quêtes se faii grâce à : "$scene = Scene_Quete.new"
=end
 
module Menu_Quetes_Voc
  
#   ===== Les principales modifications se réalisent ici :
 
# Apellation des quêtes non disponibles :
Q_verrouillee = "Verrouillée"
# Apellation des quêtes accessibles :
Index_quete = "Quête n°"  #Le numéro de quête sera automatiquement ajouté, en commençant par "Quête n°1"
 
# Nom de l'image pour les quêtes indisponibles :
Image_cache = "Quete_cache"
# A noter que les noms des images des quêtes disponibles seront, pour la Quete n°1 :
# Q1 -> Pour l'image de la quête n°1 en cours
# Q1f -> Pour l'image de la quête n°1 terminée
 
end # Fin du module de vocabulaire
 
# AUTRES MODIFICATIONS POSSIBLES ET UTILES :
# Ligne 130 et 132 : ID des interrupteurs pour activer l'accès à une quête (L.130), ou valider la quête finie (L.132).
# Ligne 165 et 170 : Ajoutez comme précisé pour augmenter le nombre de quêtes (avec un maximum de 17 par page)
 
 
#-_-_-_-_-_-_-_-_-_-_-_-_-_Class Scene_Quete_-_-_-_-_-_-_-_-_-_-_-_-_-#
class Scene_Quete
 
#____________________#
#________Main________#
def main
    create_command_window
    Graphics.transition(10)
    Input.update
    loop do
        Graphics.update
        Input.update
        update
        changement_page
        break if $scene != self
    end
    Graphics.update
    pre_terminate
    Graphics.freeze
    terminate
end
 
#______________________#
#________Update________#
def update
    @command_window.update
    if @command_window.active
        update_command_selection
    elsif @status_window.active
        update_actor_selection
        update_command_selection
    end
  end
  
  #_______________________________#
#________changement_page________#
def changement_page
    if @attendre < 0
        # Si on passe à la page suivante
        if Input.press?(Input::RIGHT)
            @menu_page += 1
            @command_window.close
            #@command_window.dispose
            if @menu_page > 1
                @menu_page = 0
            end
            create_command_window
            @attendre = 10
            update_command_selection
        # Si on passe à la page précédente
        elsif Input.press?(Input::LEFT)
            @menu_page -= 1
            @command_window.close
            #@command_window.dispose
            if @menu_page < 0
                @menu_page = 1
            end
            create_command_window
            @attendre = 10
        end
    else
        @attendre-=1
    end
end
  
#___________________________#
#________pre_terminate________#
def pre_terminate
@command_window.close
@picture_back = nil
    begin
    @command_window.update
    Graphics.update
    end
end
  
#________________________#
#________terminate________#
def terminate
    @command_window.dispose
end
 
#_______________________#
#________Initialize________#
def initialize(menu_index = 0, menu_page=0)    #Initialize, Soit le Constructeur
    @attendre = 0
    @menu_index = menu_index
    @menu_page = menu_page
    @txt1 = Array.[]
# === Table des ID des switchs des quêtes disponibles
    @Tab_Qdispo = [2, 3, 4, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 200, 200]
# === Table des ID des switchs des quêtes terminées
    @Tab_Qterm = [41, 42, 43, 44, 45, 46, 47, 48, 19, 50, 51, 52,53, 54, 55, 56, 57, 58, 59, 60, 200, 200]
end
 
#_______________________#
#________Affichage________#
# Modification interne effectuée n°1
def affichage(id)
    @image_a = id
    img_quete(@Tab_Qterm[id],@Tab_Qdispo[id])
end
 
#_________________________#
#________nom_quete________#
# Modification interne effectuée n°2
def nom_quete(id1=0, id2=0)
    @txt1[@i] =  "#{Menu_Quetes_Voc::Q_verrouillee}"
    if ($game_switches[id1] or $game_switches[id2]) == true
        @titre = 
        @txt1[@i] = "#{Menu_Quetes_Voc::Index_quete}#{@i+1}"
    end
end
 
#_____________________________________#
#________create_command_window________# Ouvre la fenêtre pour la liste des choix
def create_command_window
    #Initialisation si jamais menu_page n'a pas de valeur
    if @menu_page == nil 
        @menu_page = 0
    end
    case @menu_page
    when 0    
        for @i in 0..16 # Pour les quêtes 1 à 17
            nom_quete(@Tab_Qdispo[@i],@Tab_Qterm[@i])
            @command_window = Window_Command.new(160, [@txt1[0], @txt1[1] ]) # Ici ajouter de @txt1[0] jusque @txt1[16] 
        end                                                                                                                                     # pour augmenter le nombre de quêtes
    when 1
        for @i in 0..2 # Pour les quêtes 17 à 33
            nom_quete(@Tab_Qdispo[@i+16],@Tab_Qterm[@i+16])
            @command_window = Window_Command.new(160, [@txt1[0], @txt1[1] ]) # Ici ajouter de @txt1[17] jusque @txt1[32] 
        end                                                                                                                                    # pour augmenter le nombre de quêtes
    end
    @command_window.index = @menu_index
    @command_window.openness = 0
    @command_window.open
 end
 
#_________________________#
#________img_quete________#
# Affiche l'image de la quête : terminée, sinon disponible, sinon indisponible
def img_quete(id_quete_term, id_quete_dispo)                               
    if @image == nil
        @image = Sprite.new
        if $game_switches[id_quete_term] == true
            @image.bitmap = Cache.picture("Q#{@image_a+1}f")
        elsif $game_switches[id_quete_dispo] == true
            @image.bitmap = Cache.picture("Q#{@image_a+1}") 
        else
            @image.bitmap = Cache.picture("#{Menu_Quetes_Voc::Image_cache}")
        end
    end
end
 
#_______________________________________#
#________update_command_selection________#
def update_command_selection
    if Input.trigger?(Input::B)
        Sound.play_cancel
        $scene = Scene_Map.new
        @picture_back = nil
        @image = nil
    end
    if @image != nil
        @image.dispose # rafraichit l'image de la mission
    end
    @image = nil
    case @menu_page
    when 0                                                         # Si le joueur est dans la page n°1 :
        affichage (@command_window.index)
    when 1                                                         # Si le joueur est dans la page n°2 :
        affichage (@command_window.index + 17)
    end 
end
 
end #Fin de classe



Index du forum > Entraide > [RESOLU] [RPG Maker VX] Problème quête annexe

repondre up

Suite à de nombreux abus, le post en invités a été désactivé. Veuillez vous inscrire si vous souhaitez participer à la conversation.

Haut de page

Merci de ne pas reproduire le contenu de ce site sans autorisation.
Contacter l'équipe - Mentions légales

Plan du site

Communauté: Accueil | Forum | Chat | Commentaires | News | Flash-news | Screen de la semaine | Sorties | Tests | Gaming-Live | Interviews | Galerie | OST | Blogs | Recherche
Apprendre: Visite guidée | RPG Maker 95 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker MV | Tutoriels | Guides | Making-of
Télécharger: Programmes | Scripts/Plugins | Ressources graphiques / sonores | Packs de ressources | Midis | Eléments séparés | Sprites
Jeux: Au hasard | Notre sélection | Sélection des membres | Tous les jeux | Jeux complets | Le cimetière | RPG Maker 95 | RPG Maker 2000 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker VX Ace | RPG Maker MV | Autres | Proposer
Ressources RPG Maker 2000/2003: Chipsets | Charsets | Panoramas | Backdrops | Facesets | Battle anims | Battle charsets | Monstres | Systems | Templates
Ressources RPG Maker XP: Tilesets | Autotiles | Characters | Battlers | Window skins | Icônes | Transitions | Fogs | Templates
Ressources RPG Maker VX: Tilesets | Charsets | Facesets | Systèmes
Ressources RPG Maker MV: Tilesets | Characters | Faces | Systèmes | Title | Battlebacks | Animations | SV/Ennemis
Archives: Palmarès | L'Annuaire | Livre d'or | Le Wiki | Divers