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

468 connectés actuellement

29383138 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

RPG Fusion

ConsoleFun

Level Up!

Tous nos partenaires

Devenir
partenaire



forums

Index du forum > Entraide > [RESOLU] [VX Ace] Journal de quêtes


Hurrikani - posté le 07/10/2016 à 21:50:20 (14 messages postés)

❤ 0

KAMIKAZE!

Domaine concerné: script
Logiciel utilisé: VX Ace
bonjour bonjour!
Bon voilà j'ai chopé ce scrpit sur le net et le truc c'est que je sais pas coder mais lVX ace me dit que à la ligne 623 y'a "unidentified method" qu'est-ce que je dois faire ?

Merci d'avance a vous ^^

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
#Basic Quest System v1.3e
#----------#
#Features: Quests! What more can you say.
#
#Usage:   Set up your quests and away you go!
#        Script calls:
#         accept_quest(:questid)     - force quest accept
#         ask_accept(:questid)       - open quest acceptance window
#         abandon_quest(:questid)    - force quest abandon
#         turnin_quest(:questid)     - force quest turnin
#         fail_quest(:questid)       - force abandon with ME
#         ask_turnin(:questid)       - open quest complete window
#
#       adv_obj(:questid, :objectiveid, value)   - changes obj by value
#       set_obj(:questid, :objectiveid, value)   - sets obj to value
#       obj(:questid, :objectiveid)              - gets obj value
#       hide_obj(:questid, :objectiveid)         - hides objective
#       show_obj(:questid, :objectiveid)         - shows objective
#
#     $game_quests[:questid].accepted?     - true if quest is accepted
#     $game_quests[:questid].completed?    - true if quest is completed
#     $game_quests[:questid].turned_in?     - true if quest is turned in
#
# Examples:
#  The obj function can be used in conditional branches to check progress
#   of certain objectives. Example.
#    #Checking if :obj3 of :quest89 is greater than 3:
#     obj(:quest89, :obj3) > 3
#
#~ #----------#
#-- Script by: V.M of D.T
#
#- Questions or comments can be:
#    given by email: sumptuaryspade@live.ca
#    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
#   All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
#
#--- Free to use in any project, commercial or non-commercial, with credit given
# - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)
 
#Visibility of quest log on map
$questlogvisibility = true
#Maximum # of quests displayed on the quest log overlay
$questlogmaxdisplay = 5
#Quest log position, 1 - top-left, 2 - top-right
QUEST_LOG_POSITION = 2
#Quest log offsets
QUEST_LOG_OFFSET_X = 0
QUEST_LOG_OFFSET_Y = 0
 
# Quest Format and set up!
 
# DETAILS[:quest_id] = {
#   :name => "quest name"     #Quest name
#   :level => value           #Arbitrary value (Optional)
#   :difficulty => "string"   #Arbitrary string (Optional)
#   :auto_complete => true    #Recieve rewards on the spot (Optional)
#   :abandonable => false     #Set's whether quest can be abandoned (Optional)
#   :force_accept => true     #ask_accept only allows accepting (Optional)
#   :force_turnin => true     #ask_turnin only allows completing (Optional)
#  }
# DESCRIPTIONS[:quest_id] = {
#   :qgiver_name => "string"  #Quest giver name (shows in log) (Optional)
#   :location => "string"     #Quest giver location (shows in log) (Optional)
#   :desc => "string"         #Description of quest displayed in log (Optional)
#  }
# OBJECTIVES[:quest_id] = {   #Quest objectives, "string" is name, id is max value
#                             #   boolean is hidden objective (true for hidden)
#   :obj_id1 => ["string", id]
#   :obj_id2 => ["string", id, boolean],
#   etc...
#  }
# REWARDS[:quest_id] = {
#   :gold => value            #Gold recieved from quest (Optional)
#   :exp => value             #Exp recieved from quest (Optional)
#         #Items recieved from quest, :type is :item, :weapon, or :armor
#   :scale_exp => value       #Percent value to scale exp based on level vs party
#   :items => [[:type,id,value], ...]],    (Optional)
#  }
 
module QUEST
  DETAILS= {}
  DESCRIPTIONS = {}
  OBJECTIVES = {}
  REWARDS = {}
 
  #Main Quest 1
  DETAILS[:questid001] = {
    :name => "I need water!",
    :level => 1,
    :force_accept => true,
    :force_turnin => true,}
  DESCRIPTIONS[:questid001] = {
    :qgiver_name => "This Lady",
    :location => "This Place",
    :desc => " I'm thirsty, can you get me some water from the merchant?" }
  OBJECTIVES[:questid001] = {
    :obj1 => ["Get a canteen of water",1],
    :obj2 => ["Get another canteen of water",1,true]}
  REWARDS[:questid001] = {
#    :gold => 5,
#    :exp => 10,
    :scale_exp => 5,
    :items => [[:item,1,2]], }  
   
  #Main Quest 2
  DETAILS[:questid002] = {
    :name => "First Steps: Arkineer",
    :level => 2,}
  DESCRIPTIONS[:questid002] = {
    :qgiver_name => "Marshal Avalan",
    :location => "Class Town",
    :desc => " An Arkineer's job is to construct
as much as it is to fight. To do
that, requires materials though.
Head to the Forest Encampment and
see what the situation is." }
  OBJECTIVES[:questid002] = {
    :obj1 => ["Head to the Forest Camp",1] }
  REWARDS[:questid002] = {}
  
    #Main Quest 2
  DETAILS[:questid003] = {
    :name => "First Steps: Arkineer",
    :level => 2,}
  DESCRIPTIONS[:questid003] = {
    :qgiver_name => "Marshal Avalan",
    :location => "Class Town",
    :desc => " An Arkineer's job is to construct
as much as it is to fight. To do
that, requires materials though.
Head to the Forest Encampment and
see what the situation is." }
  OBJECTIVES[:questid003] = {
    :obj1 => ["Head to the Forest Camp",1] }
  REWARDS[:questid003] = {}
 
  #Side Quest
  DETAILS[:sidequest001] = {
    :name => "Fibers for M'Lana",
    :level => 3,}
  DESCRIPTIONS[:sidequest001] = {
    :qgiver_name => "M'Lana Lee",
    :location => "Class Town",
    :desc => " You're not sure what M'Lana
wants with the plant fibres, but at
least she's isn't telling you to
leave anymore. Better do as she
says and collect them from beasts
around the Forest Camp." }
  OBJECTIVES[:sidequest001] = {
    :obj1 => ["Collect 10 plant fibres",10] }
  REWARDS[:sidequest001] = {
    :gold => 20,
    :exp => 25,
    :items => [[:armor,89,1]], }
 
end
 
class Game_Quests
  attr_accessor :reset_hash
  def initialize
    @quests = {}
    QUEST::DETAILS.each do |id, quest|
      @quests[id] = Quest.new(id,quest)
    end
    @reset_hash = {}
    @quests.each_value do |quest|
      @reset_hash[quest.id] = {}
      @reset_hash[quest.id][:accepted] = false
      @reset_hash[quest.id][:turnedin] = false
      quest.objectives.each do |id, obj|
        @reset_hash[quest.id][id] = obj
      end
    end
  end
  def check_quests
    @quests.each do |id, quest|
      if !$game_party.quests[id]
        $game_party.quests[id] = {}
        quest.reset
      end
    end
  end
  def [](quest_id)
    return msgbox("No Quest with id " + quest_id.to_s) if @quests[quest_id].nil?
    @quests[quest_id]
  end
  def []=(quest_id, val)
    @quests[quest_id] = val
  end
  def quests
    @quests
  end
  def no_quests?
    @quests.each do |id, quest|
      return false if quest.accepted? && !quest.turned_in
    end
    return true
  end
  def tracking?
    $game_party.tracking
  end
  def track_quest(id)
    return if $game_party.tracking.include?(id)
    $game_party.tracking.push(id)
    if $game_party.tracking.size > $questlogmaxdisplay = 5
      $game_party.tracking.reverse!.pop
      $game_party.tracking.reverse!
    end
  end
  def untrack_quest(id)
    return unless $game_party.tracking.include?(id)
    $game_party.tracking.delete(id)
    $game_party.tracking.compact!
  end
end
 
class Quest
  attr_accessor :name
  attr_accessor :level
  attr_accessor :id
  attr_accessor :desc
  attr_accessor :objectives
  attr_accessor :turned_in
  attr_accessor :difficulty
  attr_accessor :qgiver_name
  attr_accessor :location
  attr_accessor :auto_complete
  attr_accessor :abandonable
  attr_accessor :force_accept
  attr_accessor :force_turnin
  def initialize(id,quest_hash)
    @id = id
    @level = 0
    @difficulty = 0
    @name = "No Quest Name"
    @desc = ""
    @qgiver_name = 0
    @location = 0
    @auto_complete = false
    @abandonable = true
    @need_popup = false
    @force_turnin = false
    @force_accept = false
    @name = quest_hash[:name] if quest_hash[:name]
    @level = quest_hash[:level] if quest_hash[:level]
    @force_accept = quest_hash[:force_accept] if quest_hash[:force_accept]
    @force_turnin = quest_hash[:force_turnin] if quest_hash[:force_turnin]
    @difficulty = quest_hash[:difficulty] if quest_hash[:difficulty]
    @auto_complete = quest_hash[:auto_complete] if quest_hash[:auto_complete]
    @abandonable = quest_hash[:abandonable] if !quest_hash[:abandonable].nil?
    @desc = QUEST::DESCRIPTIONS[id][:desc] if QUEST::DESCRIPTIONS[id][:desc]
    @qgiver_name = QUEST::DESCRIPTIONS[id][:qgiver_name] if QUEST::DESCRIPTIONS[id][:qgiver_name]
    @location = QUEST::DESCRIPTIONS[id][:location] if QUEST::DESCRIPTIONS[id][:location]
    @objectives = {}
    if QUEST::OBJECTIVES[id]
      QUEST::OBJECTIVES[id].each do |id, obj|
        @objectives[id] = Objective.new(id, obj)
      end
    else
      msgbox("Quest " + id.to_s + " has no objectives.")
    end
    @reward_gold = 0
    @reward_exp = 0
    @scale_exp = 0
    @reward_items = []
    begin
      if QUEST::REWARDS[id][:gold]
        @reward_gold = QUEST::REWARDS[id][:gold]
      end
      if QUEST::REWARDS[id][:exp]
        @reward_exp = QUEST::REWARDS[id][:exp]
        @scale_exp = QUEST::REWARDS[id][:scale_exp] if QUEST::REWARDS[id][:scale_exp]
      end
      if QUEST::REWARDS[id][:items]
        @reward_items = QUEST::REWARDS[id][:items]
      end
    rescue
      msgbox(id.to_s + " has no defined REWARDS. This is not optional.")
    end
  end
  def accept
    reset
    $game_party.quests[id][:accepted] = true
    track_quest
    $game_map.need_refresh = true
    Audio.se_play("Audio/SE/Book2")
  end
  def abandon
    reset
    $game_party.quests[id][:accepted] = false
  end
  def fail
    Audio.me_play("Audio/ME/Gag")
    abandon
  end
  def accepted?
    $game_party.quests[id][:accepted]
  end
  def accepted
    accepted?
  end
  def completed?
    @objectives.each do |id, obj|
      return false if !$game_party.quests[@id][id].completed?
    end
    return true
  end
  def force_done
    $game_party.quests[id][:accepted] = true
    @objectives.each do |id, obj|
      $game_party.quests[@id][id].current = obj.max
    end
    turnin
  end
  def reset
    $game_party.quests[id][:accepted] = false
    @objectives.each do |id, obj|
      $game_party.quests[@id][id] = obj
      $game_party.quests[@id][id].current = 0
    end
    $game_party.quests[id][:turnedin] = false
  end
  def objective(id)
    return Objective.new(["No Objective Found",0]) if @objectives[id].nil?
    $game_party.quests[@id][id]
  end
  def set_obj(id, value)
    objective(id).current = value
    @need_popup = false if !completed?
    popup if completed? && !@need_popup
    turnin if completed? && @auto_complete
    $game_map.need_refresh = true
  end
  def adv_obj(id, value)
    objective(id).current += value
    @need_popup = false if !completed?
    popup if completed? && !@need_popup
    turnin if completed? && @auto_complete
    $game_map.need_refresh = true
  end
  def reward_gold
    @reward_gold
  end
  def reward_exp
    get_mod_exp.to_i
  end
  def reward_items
    @reward_items
  end
  def turnin
    $game_party.quests[id][:turnedin] = true
    untrack_quest
    $game_map.need_refresh = true
    $game_party.gain_gold(@reward_gold)
    $game_party.members.each do |actor|
      actor.gain_exp(@reward_exp)
    end
    @reward_items.each do |array|
      item = $data_items[array[1]] if array[0] == :item
      item = $data_weapons[array[1]] if array[0] == :weapon
      item = $data_armors[array[1]] if array[0] == :armor
      $game_party.gain_item(item, array[2])
    end
  end
  def track_quest
    $game_quests.track_quest(@id)
  end
  def untrack_quest
    $game_quests.untrack_quest(@id)
  end
  def can_abandon?
    @abandonable
  end
  def popup
    @need_popup = true
    Audio.me_play("Audio/ME/Item")
    if Module.const_defined?(:Popup)
      Popup.add([@name + ' complete!'])
    end
  end
  def turned_in?
    $game_party.quests[id][:turnedin]
  end
  def turned_in
    turned_in?
  end
  def active?
    accepted? && !completed?
  end
  def get_mod_exp
    pval = @scale_exp * (@level - $game_party.highest_level).to_f / 100 + 1
    @reward_exp * pval
  end
end
 
class Objective
  attr_accessor :id
  attr_accessor :name
  attr_accessor :current
  attr_accessor :max
  attr_accessor :hidden
  def initialize(id, obj)
    @name = obj[0]
    @current = 0
    @max = obj[1]
    @hidden = obj[2] ? obj[2] : false
  end
  def completed?
    @current >= @max
  end
end
 
module DataManager
  class << self
    alias quest_cgo load_database
    alias quest_sng setup_new_game
  end
  def self.load_database
    quest_cgo
    $game_quests = Game_Quests.new
  end
  def self.setup_new_game
    $game_quests = Game_Quests.new
    quest_sng
  end
end
 
class Scene_Quest < Scene_MenuBase
  def start
    super
    @help_window = Window_Help.new(1)
    @help_window.set_text("Quest Log")
    @list_window = Window_SceneList.new
    @list_window.set_handler(:cancel, method(:list_cancel))
    @list_window.set_handler(:ok, method(:list_ok))
    @list_window.refresh
    @list_window.activate
    @list_window.select(0)
    @detail_window = Window_SceneDetail.new
    @command_window = Window_QuestTrack.new
    @command_window.x = Graphics.width / 2 - @command_window.width / 2
    @command_window.y = Graphics.height / 2 - @command_window.height / 2
    @command_window.set_handler(:track, method(:track))
    @command_window.set_handler(:untrack, method(:untrack))
    @command_window.set_handler(:abandon, method(:abandon))
    @command_window.set_handler(:cancel, method(:command_cancel))
  end
  def update
    super
    @detail_window.quest = @list_window.current_item
  end
  def list_cancel
    SceneManager.return
  end
  def list_ok
    @command_window.quest(@list_window.current_item)
    @command_window.refresh
    @command_window.select(0)
    @command_window.activate
    @command_window.open
  end
  def track
    $game_quests.track_quest(@list_window.current_item.id)
    command_cancel
  end
  def untrack
    $game_quests.untrack_quest(@list_window.current_item.id)
    command_cancel
  end
  def abandon
    @list_window.current_item.abandon
    command_cancel
  end
  def command_cancel
    @command_window.close
    @list_window.refresh
    @list_window.activate
    list_cancel if $game_quests.no_quests?
  end
end
 
class Window_SceneList < Window_Selectable
  def initialize
    super(0,48,Graphics.width/5*2,Graphics.height-48)
    refresh
  end
  def make_item_list
    @data = []
    $game_quests.quests.each do |id, quest|
      @data.push(quest) if quest.accepted? && !quest.turned_in?
    end
    @data.push(nil) if @data.empty?
  end
  def draw_item(index)
    contents.font.size = 18
    item = @data[index]
    if item
      rect = item_rect(index)
      rect.width -= 4
      if $game_quests.tracking?.include?(item.id)
        text = "*" + item.name
      else
        text = item.name
      end
      draw_text(rect, text)
      draw_text(rect, "Lv" + item.level.to_s,2) if item.level > 0
    end
  end
  def col_max; 1; end
  def current_item
    @data[@index]
  end
  def current_item_enabled?
    true
  end
  def refresh
    make_item_list
    create_contents
    draw_all_items
  end
  def item_max
    @data ? @data.size : 0
  end
end
 
class Window_SceneDetail < Window_Base
  def initialize
    super(Graphics.width/5*2,48,Graphics.width-Graphics.width/5*2,Graphics.height-48)
  end
  def quest=(quest)
    return if @quest == quest
    @quest = quest
    refresh
  end
  def refresh
    contents.clear
    return unless @quest
    contents.font.size = 18
    change_color(system_color)
    draw_text(0,0,contents.width,line_height,@quest.qgiver_name) if @quest.qgiver_name != 0
    draw_text(0,0,contents.width,line_height,@quest.location,2) if @quest.location != 0
    change_color(normal_color)
    @quest.qgiver_name != 0 || @quest.location != 0 ? yy = line_height : yy = 0
    draw_text_ex(0,yy,@quest.desc)
    change_color(system_color)
    draw_text(0,line_height*7,contents.width,24,"Objectives:")
    change_color(normal_color)
    yy = line_height * 8
    @quest.objectives.each do |id, obj|
      next if obj.hidden
      draw_objective(yy, obj)
      yy += 24
    end
    change_color(system_color)
    draw_text(0,yy,contents.width,line_height,"Rewards:")
    yy += line_height
    if @quest.reward_exp > 0
      draw_text(6,yy,contents.width/2,line_height,"XP: ")
      change_color(normal_color)
      draw_text(36,yy,contents.width/2,line_height,@quest.reward_exp)
      yy += line_height
    end
    if @quest.reward_gold > 0
      change_color(normal_color)
      draw_text(6,yy,contents.width/2,line_height,@quest.reward_gold.to_s)
      cx = text_size(@quest.reward_gold).width
      change_color(system_color)
      draw_text(6+cx,yy,contents.width/2,line_height,Vocab::currency_unit)
    end
    yy += line_height
    change_color(normal_color)
    @quest.reward_items.each do |array|
      item = $data_items[array[1]] if array[0] == :item
      item = $data_weapons[array[1]] if array[0] == :weapon
      item = $data_armors[array[1]] if array[0] == :armor
      draw_item_name(item, 6, yy, true, contents.width)
      if array[2] > 1
        draw_text(6+text_size(item.name).width+36,yy,48,24,"x"+array[2].to_s)
      end
      yy += line_height
    end
    if @quest.difficulty != 0
      text = "Difficulty: " + @quest.difficulty
      draw_text(0,contents.height-line_height,contents.width,line_height,text,2)
    end
  end
  def draw_objective(yy, obj)
    draw_text(6,yy,contents.width,24,obj.name)
    draw_text(0,yy,contents.width,24,obj.current.to_s+"/"+obj.max.to_s,2)
  end
  def reset_font_settings
    change_color(normal_color)
    contents.font.bold = Font.default_bold
    contents.font.italic = Font.default_italic
  end
end
 
class Window_QuestTrack < Window_Command
  def initialize
    super(0,0)
    self.openness = 0
  end
  def quest(quest)
    @quest = quest
  end
  def make_command_list
    return unless @quest
    if !$game_quests.tracking?.include?(@quest.id)
      add_command("Track Quest", :track)
    else
      add_command("Untrack Quest", :untrack)
    end
    add_command("Abandon Quest", :abandon, @quest.can_abandon?)
  end
  def window_height
    fitting_height(2)
  end
end
 
class Window_MenuCommand
  alias quest_aoc add_original_commands
  def add_original_commands
    quest_aoc
    add_command("Quest Log", :quest, !$game_quests.no_quests?)
  end
end
 
class Scene_Menu
  alias quest_ccw create_command_window
  def create_command_window
    quest_ccw
    @command_window.set_handler(:quest,    method(:scene_quest))
  end
  def scene_quest
    SceneManager.call(Scene_Quest)
  end
end
 
class Scene_Map
  alias quest_start start
  alias quest_update update
  def start
    quest_start
    @quest_log = Window_QuestLog.new
    @quest_confirm = Window_QuestConfirm.new
    @quest_confirm.set_handler(:accept, method(:confirm_accept))
    @quest_confirm.set_handler(:decline, method(:confirm_cancel))
    @quest_confirm.set_handler(:cancel, method(:confirm_cancel))
    @quest_turnin = Window_QuestTurnin.new
    @quest_turnin.set_handler(:accept, method(:turnin_accept))
    @quest_turnin.set_handler(:decline, method(:confirm_cancel))
    @quest_turnin.set_handler(:cancel, method(:confirm_cancel))
    @quest_apply = Window_QuestApply.new(@quest_confirm,@quest_turnin)
  end
  def update(*args)
    @quest_log = Window_QuestLog.new if @quest_log.disposed?
    quest_update(*args)
  end
  def show_quest(id, turnin = false)
    @quest_apply.show($game_quests[id],turnin)
  end
  def accepting?
    @quest_confirm.active || @quest_turnin.active
  end
  def confirm_accept
    @quest_apply.accept
    @quest_apply.hide
  end
  def confirm_cancel
    @quest_apply.hide
  end
  def turnin_accept
    @quest_apply.turnin
    @quest_apply.hide
  end
  def update_call_menu
    if $game_system.menu_disabled || $game_map.interpreter.running? || accepting?
      @menu_calling = false
    else
      @menu_calling ||= Input.trigger?(:B)
      call_menu if @menu_calling && !$game_player.moving?
    end
  end
end
 
class Scene_Base
  def accepting?
    false
  end
end
 
class Window_QuestLog < Window_Base
  def initialize
    super(Graphics.width/5*3,0,Graphics.width/5*2,Graphics.height)
    self.x = 0 if QUEST_LOG_POSITION == 1
    self.x += QUEST_LOG_OFFSET_X
    self.y += QUEST_LOG_OFFSET_Y
    self.opacity = 0
    self.contents.font.size = 18
  end
  def update
    super
    return unless Graphics.frame_count % 20 == 0
    self.visible = $questlogvisibility
    return unless self.visible
    self.visible = !$game_quests.no_quests?
    self.visible = $game_quests.tracking?.size > 0
    return unless self.visible
    contents.clear
    change_color(crisis_color)
    draw_text(0,0,contents.width,18,"Quest Log:",1)
    yy = 18;iter = 0
    $game_quests.tracking?.each do |id|
      quest = $game_quests[id]
      next unless quest.accepted? && !quest.turned_in
      change_color(system_color)
      draw_text(6,yy,contents.width-6,18,quest.name)
      change_color(normal_color)
      yy += 18
      quest.objectives.each do |obj_id, obj|
        next if obj.hidden
        draw_objective(yy, $game_party.quests[id][obj_id])
        yy += 18
      end
      iter += 1
    end
  end
  def draw_objective(yy, obj)
    draw_text(0,yy,contents.width-24,18,obj.name)
    draw_text(0,yy,contents.width,18,obj.current.to_s+"/"+obj.max.to_s,2)
  end
end
   
class Window_QuestApply < Window_Base
  def initialize(confirm_window, turnin_window)
    super(Graphics.width/8,Graphics.width/8,Graphics.width/5*3,Graphics.height-Graphics.width/8*2)
    self.openness = 0
    @confirm_window = confirm_window
    @turnin_window = turnin_window
    self.contents.font.size = 18
  end
  def refresh
    return unless @quest
    contents.clear
    change_color(system_color)
    yy = 0
    if @quest.qgiver_name != 0
      draw_text(0,0,contents.width/2,line_height,@quest.qgiver_name)
      yy = line_height
    end
    if @quest.location != 0
      draw_text(contents.width/2,0,contents.width/2,line_height,@quest.location,2)
      yy = line_height
    end
    change_color(crisis_color)
    draw_text(0,yy,contents.width,line_height,"Lvl: " + @quest.level.to_s) if @quest.level > 0
    draw_text(0,yy,contents.width,line_height,@quest.name,1)
    draw_text(0,yy,contents.width,line_height,@quest.difficulty,2) if @quest.difficulty != 0
    change_color(normal_color)
    draw_text_ex(0,line_height+yy,@quest.desc)
    change_color(system_color)
    draw_text(0,line_height*8,contents.width,line_height,"Objectives:")
    change_color(normal_color)
    yy = line_height * 9
    @quest.objectives.each do |obj_id, obj|
      next if obj.hidden
      draw_objective(yy, $game_party.quests[@quest.id][obj_id])
      yy += line_height
    end
    change_color(system_color)
    draw_text(0,yy,contents.width,line_height,"Rewards:")
    yy += line_height
    if @quest.reward_exp > 0
      draw_text(6,yy,contents.width/2,line_height,"XP: ")
      change_color(normal_color)
      draw_text(36,yy,contents.width/2,line_height,@quest.reward_exp)
      yy += line_height
    end
    if @quest.reward_gold > 0
      change_color(normal_color)
      draw_text(6,yy,contents.width/2,line_height,@quest.reward_gold.to_s)
      cx = text_size(@quest.reward_gold).width
      change_color(system_color)
      draw_text(6+cx,yy,contents.width/2,line_height,Vocab::currency_unit)
    end
    yy += line_height
    change_color(normal_color)
    @quest.reward_items.each do |array|
      item = $data_items[array[1]] if array[0] == :item
      item = $data_weapons[array[1]] if array[0] == :weapon
      item = $data_armors[array[1]] if array[0] == :armor
      draw_item_name(item, 6, yy, true, contents.width)
      if array[2] > 1
        draw_text(6+text_size(item.name).width+36,yy,48,24,"x"+array[2].to_s)
      end
      yy += line_height
    end
  end
  def reset_font_settings
    change_color(normal_color)
    contents.font.bold = Font.default_bold
    contents.font.italic = Font.default_italic
  end
  def line_height
    18
  end
  def draw_objective(yy, obj)
    draw_text(6,yy,contents.width,24,obj.name)
    draw_text(0,yy,contents.width,24,obj.current.to_s+"/"+obj.max.to_s,2)
  end
  def show(quest,turnin)
    @quest = quest
    return if @quest.turned_in
    refresh
    open
    @confirm_window.quest(@quest)
    @confirm_window.open if !turnin
    if turnin
      @turnin_window.quest(@quest)
      @turnin_window.open
    end
  end
  def hide
    close
    @confirm_window.close
    @turnin_window.close
  end
  def accept
    @quest.accept
  end
  def turnin
    @quest.turnin
  end
end
 
class Window_QuestConfirm < Window_HorzCommand
  def initialize
    super(Graphics.width/8,Graphics.width/8+Graphics.height-Graphics.width/8*2)
    self.openness = 0
    self.active = false
    @enabled = true
    refresh
  end
  def window_width
    Graphics.width/5*2
  end
  def window_height
    48
  end
  def make_command_list
    add_command("Accept",:accept)
    add_command("Decline",:decline, @enabled)
  end
  def item_width
    width / 2 - padding * 2
  end
  def open
    super
    activate
    select(0)
  end
  def quest(quest)
    @quest = quest
    @enabled = !@quest.force_accept
    refresh
  end
  def cancel_enabled?
    super && @enabled
  end
end
 
class Window_QuestTurnin < Window_QuestConfirm
  def quest(quest)
    @quest = quest
    @enabled = true
    @enabled = !@quest.completed? if @quest.force_turnin
    refresh
  end
  def make_command_list
    return unless @quest
    add_command("Complete",:accept,@quest.completed? && !@quest.turned_in)
    add_command("Cancel",:decline, @enabled)
  end
end
 
class Game_Party
  attr_accessor :quests
  attr_accessor :tracking
  alias quests_init initialize
  def initialize(*args)
    quests_init(*args)
    @quests = $game_quests.reset_hash unless $game_quests.nil?
    @tracking = []
  end
end
 
class Game_Player
  alias quest_update update
  def update
    return if SceneManager.scene.accepting?
    quest_update
  end
end
 
class Game_Event
  def obj(quest, objective)
    $game_quests[quest].objective(objective).current
  end
end
 
class Game_Interpreter
  def accept_quest(quest)
    $game_quests[quest].accept
  end
  def ask_accept(quest)
    return unless SceneManager.scene.is_a?(Scene_Map)
    SceneManager.scene.show_quest(quest)
    Fiber.yield while SceneManager.scene.accepting?
  end
  def abandon_quest(quest)
    $game_quests[quest].abandon
  end
  def fail_quest(quest)
    $game_quests[quest].fail
  end
  def turnin_quest(quest)
    $game_quests[quest].turnin
  end
  def ask_turnin(quest)
    return unless SceneManager.scene.is_a?(Scene_Map)
    SceneManager.scene.show_quest(quest,true)
    Fiber.yield while SceneManager.scene.accepting?
  end
  def adv_obj(quest, objective, value)
    $game_quests[quest].adv_obj(objective, value)
  end
  def set_obj(quest, objective, value)
    $game_quests[quest].set_obj(objective, value)
  end
  def obj(quest, objective)
    $game_quests[quest].objective(objective).current
  end
  def hide_obj(quest, objective)
    $game_quests[quest].objective(objective).hidden = true
  end
  def show_obj(quest, objective)
    $game_quests[quest].objective(objective).hidden = false
  end
end
 
module DataManager
  class << self
    alias quest_load_game load_game
  end
  def self.load_game(index)
    quest_load_game(index)
    $game_quests.check_quests
  end
end



....................................................


arttroy - posté le 08/10/2016 à 06:07:33 (2394 messages postés)

❤ 0

Just working

Salut alors je comprend pas ce qui se passe parce que j'utilise moi aussi ce script sur un projet et tout fonctionne à merveille.

Alors pour commencer lorsque tu fais une demande d'aide sur un script le mieux c'est de donner le message d'erreur en entier (le top c'est de screen l'écran où tu as le message d'erreur).

Là j'imagine que ça doit être un truc du genre undefined method xx for nil:nil class

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
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
#Basic Quest System v1.3e
#----------#
#Features: Quests! What more can you say.
#
#Usage:   Set up your quests and away you go!
#        Script calls:
#         accept_quest(:questid)     - force quest accept
#         ask_accept(:questid)       - open quest acceptance window
#         abandon_quest(:questid)    - force quest abandon
#         turnin_quest(:questid)     - force quest turnin
#         fail_quest(:questid)       - force abandon with ME
#         ask_turnin(:questid)       - open quest complete window
#
#       adv_obj(:questid, :objectiveid, value)   - changes obj by value
#       set_obj(:questid, :objectiveid, value)   - sets obj to value
#       obj(:questid, :objectiveid)              - gets obj value
#       hide_obj(:questid, :objectiveid)         - hides objective
#       show_obj(:questid, :objectiveid)         - shows objective
#
#     $game_quests[:questid].accepted?     - true if quest is accepted
#     $game_quests[:questid].completed?    - true if quest is completed
#     $game_quests[:questid].turned_in?     - true if quest is turned in
#
# Examples:
#  The obj function can be used in conditional branches to check progress
#   of certain objectives. Example.
#    #Checking if :obj3 of :quest89 is greater than 3:
#     obj(:quest89, :obj3) > 3
#
#~ #----------#
#-- Script by: V.M of D.T
#
#- Questions or comments can be:
#    given by email: sumptuaryspade@live.ca
#    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
#   All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
#
#--- Free to use in any project, commercial or non-commercial, with credit given
# - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)
 
#Visibility of quest log on map
$questlogvisibility = true
#Maximum # of quests displayed on the quest log overlay
$questlogmaxdisplay = 6
#Quest log position, 1 - top-left, 2 - top-right
QUEST_LOG_POSITION = 2
#Quest log offsets
QUEST_LOG_OFFSET_X = 0
QUEST_LOG_OFFSET_Y = 0
 
# Quest Format and set up!
 
# DETAILS[:quest_id] = {
#   :name => "quest name"     #Quest name
#   :level => value           #Arbitrary value (Optional)
#   :difficulty => "string"   #Arbitrary string (Optional)
#   :auto_complete => true    #Recieve rewards on the spot (Optional)
#   :abandonable => false     #Set's whether quest can be abandoned (Optional)
#   :force_accept => true     #ask_accept only allows accepting (Optional)
#   :force_turnin => true     #ask_turnin only allows completing (Optional)
#  }
# DESCRIPTIONS[:quest_id] = {
#   :qgiver_name => "string"  #Quest giver name (shows in log) (Optional)
#   :location => "string"     #Quest giver location (shows in log) (Optional)
#   :desc => "string"         #Description of quest displayed in log (Optional)
#  }
# OBJECTIVES[:quest_id] = {   #Quest objectives, "string" is name, id is max value
#                             #   boolean is hidden objective (true for hidden)
#   :obj_id1 => ["string", id]
#   :obj_id2 => ["string", id, boolean],
#   etc...
#  }
# REWARDS[:quest_id] = {
#   :gold => value            #Gold recieved from quest (Optional)
#   :exp => value             #Exp recieved from quest (Optional)
#         #Items recieved from quest, :type is :item, :weapon, or :armor
#   :scale_exp => value       #Percent value to scale exp based on level vs party
#   :items => [[:type,id,value], ...]],    (Optional)
#  }
 
module QUEST
  DETAILS= {}
  DESCRIPTIONS = {}
  OBJECTIVES = {}
  REWARDS = {}
 
  #Main Quest 1
  DETAILS[:questid001] = {
    :name => "I need water!",
    :level => 1,
    :force_accept => false,
    :force_turnin => true,}
  DESCRIPTIONS[:questid001] = {
    :qgiver_name => "This Lady",
    :location => "This Place",
    :desc => " I'm thirsty, can you get me some
 water from the merchant?" }
  OBJECTIVES[:questid001] = {
    :obj1 => ["Get a canteen of water",1],
    :obj2 => ["Get another canteen of water",1,true]}
  REWARDS[:questid001] = {
#    :gold => 5,
#    :exp => 10,
    :scale_exp => 5,
    :items => [[:item,1,2]], }  
   
  #Main Quest 2
  DETAILS[:questid002] = {
    :name => "Journée de travail",
    :abandonable => false,
    :level => 0,}
  DESCRIPTIONS[:questid002] = {
    :qgiver_name => "",
    :location => "Bhamuta",
    :desc => " Rendez vous à la plantation
de Bhamuta et parlez au gérant." }
  OBJECTIVES[:questid002] = {
    :obj1 => ["Rendez vous à la plantation",1] }
  REWARDS[:questid002] = {}
  
    #Main Quest 3
  DETAILS[:questid003] = {
    :name => "L'académie",
    :abandonable => false,
    :level => 0,}
  DESCRIPTIONS[:questid003] = {
    :qgiver_name => "Gérant de la plantation",
    :location => "Bhamuta",
    :desc => "Livrer le colis à l'intendant
de l'académie draconique" }
  OBJECTIVES[:questid003] = {
    :obj1 => ["Livrer le colis à l'académie",1] }
  REWARDS[:questid003] = {}
  
    #Main Quest 4
  DETAILS[:questid004] = {
    :name => "Tout travail mérite salaire",
    :abandonable => false,
    :level => 0,}
  DESCRIPTIONS[:questid004] = {
    :qgiver_name => "Maître de l'académie",
    :location => "Bhamuta",
    :desc => "Retourner à la plantation pour
être payé par le gérant" }
  OBJECTIVES[:questid004] = {
    :obj1 => ["Retourner à la plantation",1] }
  REWARDS[:questid004] = {
    :gold => 300, }
 
    #Main Quest 5
  DETAILS[:questid005] = {
    :name => "Cache-cache",
    :abandonable => false,
    :level => 0,}
  DESCRIPTIONS[:questid005] = {
    :qgiver_name => "Simon",
    :location => "Bhamuta",
    :desc => "Le dragon de Simon à disparu,
aidez le à le retrouver" }
  OBJECTIVES[:questid005] = {
    :obj1 => ["Retrouver Teemo",1] }
  REWARDS[:questid005] = {}
 
  #Main Quest 6
  DETAILS[:questid006] = {
    :name => "L'essence draconique",
    :abandonable => false,
    :level => 0,}
  DESCRIPTIONS[:questid006] = {
    :qgiver_name => "Maître de l'académie",
    :location => "Bhamuta",
    :desc => "Aller voir le maître de l'académie." }
  OBJECTIVES[:questid006] = {
    :obj1 => ["Retourner à l'académie",1] }
  REWARDS[:questid006] = {}
 
  #Main Quest 7
  DETAILS[:questid007] = {
    :name => "L'essence draconique",
    :abandonable => false,
    :level => 0,}
  DESCRIPTIONS[:questid007] = {
    :qgiver_name => "Maître de l'académie",
    :location => "Bhamuta",
    :desc => "Faites visiter Genom." }
  OBJECTIVES[:questid007] = {
    :obj1 => ["Accomplir 5 quêtes annexes",5] }
  REWARDS[:questid007] = {}
  
  #Main Quest 8
  DETAILS[:questid008] = {
    :name => "Le début d'une aventure",
    :abandonable => false,
    :level => 1,}
  DESCRIPTIONS[:questid008] = {
    :qgiver_name => "",
    :location => "",
    :desc => "Rendez vous dans la ville de Thanviale." }
  OBJECTIVES[:questid008] = {
    :obj1 => ["Se rendre à thanviale",1] }
  REWARDS[:questid008] = {}
 
  #Side Quest 1
  DETAILS[:sidequest001] = {
    :name => "Senteurs arômatiques",
    :abandonable => false,
    :level => 1,}
  DESCRIPTIONS[:sidequest001] = {
    :qgiver_name => "Habitant de Bhamuta",
    :location => "Bhamuta",
    :desc => " Je ne sais pas ce qu'il compte
faire de ces herbes. Il m'a dit que
j'en trouverais en battant des
monstres de la plaine Behemot Sud" }
  OBJECTIVES[:sidequest001] = {
    :obj1 => ["Collecter 5 Herbes arômatiques",5] }
  REWARDS[:sidequest001] = {}
    
  #Side Quest 2
  DETAILS[:sidequest002] = {
    :name => "Carnivores",
    :abandonable => false,
    :level => 1,}
  DESCRIPTIONS[:sidequest002] = {
    :qgiver_name => "Habitante de Bhamuta",
    :location => "Bhamuta",
    :desc => " Cette femme à besoin de viande pour
préparer son repas. Elle m'a donné de
l'argent pour en acheter, mais est ce
qu'il n'y aurait pas un autre moyen..." }
  OBJECTIVES[:sidequest002] = {
    :obj1 => ["Collecter 2 Viandes",2] }
  REWARDS[:sidequest002] = {}
 
  #Side Quest 3
  DETAILS[:sidequest003] = {
    :name => "Vieux compagnon",
    :abandonable => false,
    :level => 1,}
  DESCRIPTIONS[:sidequest003] = {
    :qgiver_name => "Homme agé",
    :location => "Bhamuta",
    :desc => " Ce vieil homme voudrait récupérer
son bouclier pour rendre hommage 
à son ancien compagnon d'arme. Je
dois chercher dans Bhamuta..." }
  OBJECTIVES[:sidequest003] = {
    :obj1 => ["Retrouver le bouclier",1], 
    :obj2 => ["Trouver une corde",1,true]}
  REWARDS[:sidequest003] = {}
 
  #Side Quest 4
  DETAILS[:sidequest004] = {
    :name => "Soins diaboliques",
    :abandonable => false,
    :level => 1,}
  DESCRIPTIONS[:sidequest004] = {
    :qgiver_name => "Gérante du chenil",
    :location => "Bhamuta",
    :desc => " La gérante du chenil a besoin de 4 
cornes de diablotins. Elle m'a dit que
j'en trouverai à la plaine Behemot sud." }
  OBJECTIVES[:sidequest004] = {
    :obj1 => ["Collecter 4 Cornes",4] }
  REWARDS[:sidequest004] = {}
 
  #Side Quest 5
  DETAILS[:sidequest005] = {
    :name => "Encre gelifiée",
    :abandonable => false,
    :level => 1,}
  DESCRIPTIONS[:sidequest005] = {
    :qgiver_name => "Chef cartographe",
    :location => "Bhamuta",
    :desc => " Le chef cartographe m'a demandé de lui
trouver du liquide visqueux pour son encre.
Il m'a dit que j'en trouverai en battant
des slimes dans la Plaine Behemot Sud" }
  OBJECTIVES[:sidequest005] = {
    :obj1 => ["Trouver 3 liquide visqueux",3] }
  REWARDS[:sidequest005] = {}
 
end
 
class Game_Quests
  attr_accessor :reset_hash
  def initialize
    @quests = {}
    QUEST::DETAILS.each do |id, quest|
      @quests[id] = Quest.new(id,quest)
    end
    @reset_hash = {}
    @quests.each_value do |quest|
      @reset_hash[quest.id] = {}
      @reset_hash[quest.id][:accepted] = false
      @reset_hash[quest.id][:turnedin] = false
      quest.objectives.each do |id, obj|
        @reset_hash[quest.id][id] = obj
      end
    end
  end
  def check_quests
    @quests.each do |id, quest|
      if !$game_party.quests[id]
        $game_party.quests[id] = {}
        quest.reset
      end
    end
  end
  def [](quest_id)
    return msgbox("Pas de quête avec cet id " + quest_id.to_s) if @quests[quest_id].nil?
    @quests[quest_id]
  end
  def []=(quest_id, val)
    @quests[quest_id] = val
  end
  def quests
    @quests
  end
  def no_quests?
    @quests.each do |id, quest|
      return false if quest.accepted? && !quest.turned_in
    end
    return true
  end
  def tracking?
    $game_party.tracking
  end
  def track_quest(id)
    return if $game_party.tracking.include?(id)
    $game_party.tracking.push(id)
    if $game_party.tracking.size > $questlogmaxdisplay = 6
      $game_party.tracking.reverse!.pop
      $game_party.tracking.reverse!
    end
  end
  def untrack_quest(id)
    return unless $game_party.tracking.include?(id)
    $game_party.tracking.delete(id)
    $game_party.tracking.compact!
  end
end
 
class Quest
  attr_accessor :name
  attr_accessor :level
  attr_accessor :id
  attr_accessor :desc
  attr_accessor :objectives
  attr_accessor :turned_in
  attr_accessor :difficulty
  attr_accessor :qgiver_name
  attr_accessor :location
  attr_accessor :auto_complete
  attr_accessor :abandonable
  attr_accessor :force_accept
  attr_accessor :force_turnin
  def initialize(id,quest_hash)
    @id = id
    @level = 0
    @difficulty = 0
    @name = "Quête inconnue"
    @desc = ""
    @qgiver_name = 0
    @location = 0
    @auto_complete = false
    @abandonable = true
    @need_popup = false
    @force_turnin = false
    @force_accept = false
    @name = quest_hash[:name] if quest_hash[:name]
    @level = quest_hash[:level] if quest_hash[:level]
    @force_accept = quest_hash[:force_accept] if quest_hash[:force_accept]
    @force_turnin = quest_hash[:force_turnin] if quest_hash[:force_turnin]
    @difficulty = quest_hash[:difficulty] if quest_hash[:difficulty]
    @auto_complete = quest_hash[:auto_complete] if quest_hash[:auto_complete]
    @abandonable = quest_hash[:abandonable] if !quest_hash[:abandonable].nil?
    @desc = QUEST::DESCRIPTIONS[id][:desc] if QUEST::DESCRIPTIONS[id][:desc]
    @qgiver_name = QUEST::DESCRIPTIONS[id][:qgiver_name] if QUEST::DESCRIPTIONS[id][:qgiver_name]
    @location = QUEST::DESCRIPTIONS[id][:location] if QUEST::DESCRIPTIONS[id][:location]
    @objectives = {}
    if QUEST::OBJECTIVES[id]
      QUEST::OBJECTIVES[id].each do |id, obj|
        @objectives[id] = Objective.new(id, obj)
      end
    else
      msgbox("Quête " + id.to_s + " n'a aucun objectif.")
    end
    @reward_gold = 0
    @reward_exp = 0
    @scale_exp = 0
    @reward_items = []
    begin
      if QUEST::REWARDS[id][:gold]
        @reward_gold = QUEST::REWARDS[id][:gold]
      end
      if QUEST::REWARDS[id][:exp]
        @reward_exp = QUEST::REWARDS[id][:exp]
        @scale_exp = QUEST::REWARDS[id][:scale_exp] if QUEST::REWARDS[id][:scale_exp]
      end
      if QUEST::REWARDS[id][:items]
        @reward_items = QUEST::REWARDS[id][:items]
      end
    rescue
      msgbox(id.to_s + " pas de récompense définie. Ce n'est pas une option.")
    end
  end
  def accept
    reset
    $game_party.quests[id][:accepted] = true
    track_quest
    $game_map.need_refresh = true
    Audio.se_play("Audio/SE/Decision2")
  end
  def abandon
    reset
    $game_party.quests[id][:accepted] = false
  end
  def fail
    Audio.me_play("Audio/ME/Gag")
    abandon
  end
  def accepted?
    $game_party.quests[id][:accepted]
  end
  def accepted
    accepted?
  end
  def completed?
    @objectives.each do |id, obj|
      return false if !$game_party.quests[@id][id].completed?
    end
    return true
  end
  def force_done
    $game_party.quests[id][:accepted] = true
    @objectives.each do |id, obj|
      $game_party.quests[@id][id].current = obj.max
    end
    turnin
  end
  def reset
    $game_party.quests[id][:accepted] = false
    @objectives.each do |id, obj|
      $game_party.quests[@id][id] = obj
      $game_party.quests[@id][id].current = 0
    end
    $game_party.quests[id][:turnedin] = false
  end
  def objective(id)
    return Objective.new(["Pas d'objectif trouvé",0]) if @objectives[id].nil?
    $game_party.quests[@id][id]
  end
  def set_obj(id, value)
    objective(id).current = value
    @need_popup = false if !completed?
    popup if completed? && !@need_popup
    turnin if completed? && @auto_complete
    $game_map.need_refresh = true
  end
  def adv_obj(id, value)
    objective(id).current += value
    @need_popup = false if !completed?
    popup if completed? && !@need_popup
    turnin if completed? && @auto_complete
    $game_map.need_refresh = true
  end
  def reward_gold
    @reward_gold
  end
  def reward_exp
    get_mod_exp.to_i
  end
  def reward_items
    @reward_items
  end
  def turnin
    $game_party.quests[id][:turnedin] = true
    untrack_quest
    $game_map.need_refresh = true
    $game_party.gain_gold(@reward_gold)
    $game_party.members.each do |actor|
      actor.gain_exp(@reward_exp)
    end
    @reward_items.each do |array|
      item = $data_items[array[1]] if array[0] == :item
      item = $data_weapons[array[1]] if array[0] == :weapon
      item = $data_armors[array[1]] if array[0] == :armor
      $game_party.gain_item(item, array[2])
    end
  end
  def track_quest
    $game_quests.track_quest(@id)
  end
  def untrack_quest
    $game_quests.untrack_quest(@id)
  end
  def can_abandon?
    @abandonable
  end
  def popup
    @need_popup = true
    Audio.me_play("Audio/ME/Item")
    if Module.const_defined?(:Popup)
      Popup.add([@name + ' complété!'])
    end
  end
  def turned_in?
    $game_party.quests[id][:turnedin]
  end
  def turned_in
    turned_in?
  end
  def active?
    accepted? && !completed?
  end
  def get_mod_exp
    pval = @scale_exp * (@level - $game_party.highest_level).to_f / 100 + 1
    @reward_exp * pval
  end
end
 
class Objective
  attr_accessor :id
  attr_accessor :name
  attr_accessor :current
  attr_accessor :max
  attr_accessor :hidden
  def initialize(id, obj)
    @name = obj[0]
    @current = 0
    @max = obj[1]
    @hidden = obj[2] ? obj[2] : false
  end
  def completed?
    @current >= @max
  end
end
 
module DataManager
  class << self
    alias quest_cgo load_database
    alias quest_sng setup_new_game
  end
  def self.load_database
    quest_cgo
    $game_quests = Game_Quests.new
  end
  def self.setup_new_game
    $game_quests = Game_Quests.new
    quest_sng
  end
end
 
class Scene_Quest < Scene_MenuBase
  def start
    super
    @help_window = Window_Help.new(1)
    @help_window.set_text("Liste Quêtes")
    @list_window = Window_SceneList.new
    @list_window.set_handler(:cancel, method(:list_cancel))
    @list_window.set_handler(:ok, method(:list_ok))
    @list_window.refresh
    @list_window.activate
    @list_window.select(0)
    @detail_window = Window_SceneDetail.new
    @command_window = Window_QuestTrack.new
    @command_window.x = Graphics.width / 2 - @command_window.width / 2
    @command_window.y = Graphics.height / 2 - @command_window.height / 2
    @command_window.set_handler(:track, method(:track))
    @command_window.set_handler(:untrack, method(:untrack))
    @command_window.set_handler(:abandon, method(:abandon))
    @command_window.set_handler(:cancel, method(:command_cancel))
  end
  def update
    super
    @detail_window.quest = @list_window.current_item
  end
  def list_cancel
    SceneManager.return
  end
  def list_ok
    @command_window.quest(@list_window.current_item)
    @command_window.refresh
    @command_window.select(0)
    @command_window.activate
    @command_window.open
  end
  def track
    $game_quests.track_quest(@list_window.current_item.id)
    command_cancel
  end
  def untrack
    $game_quests.untrack_quest(@list_window.current_item.id)
    command_cancel
  end
  def abandon
    @list_window.current_item.abandon
    command_cancel
  end
  def command_cancel
    @command_window.close
    @list_window.refresh
    @list_window.activate
    list_cancel if $game_quests.no_quests?
  end
end
 
class Window_SceneList < Window_Selectable
  def initialize
    super(0,48,Graphics.width/5*2,Graphics.height-48)
    refresh
  end
  def make_item_list
    @data = []
    $game_quests.quests.each do |id, quest|
      @data.push(quest) if quest.accepted? && !quest.turned_in?
    end
    @data.push(nil) if @data.empty?
  end
  def draw_item(index)
    contents.font.size = 18
    item = @data[index]
    if item
      rect = item_rect(index)
      rect.width -= 4
      if $game_quests.tracking?.include?(item.id)
        text = "*" + item.name
      else
        text = item.name
      end
      draw_text(rect, text)
      draw_text(rect, "Lv" + item.level.to_s,2) if item.level > 0
    end
  end
  def col_max; 1; end
  def current_item
    @data[@index]
  end
  def current_item_enabled?
    true
  end
  def refresh
    make_item_list
    create_contents
    draw_all_items
  end
  def item_max
    @data ? @data.size : 0
  end
end
 
class Window_SceneDetail < Window_Base
  def initialize
    super(Graphics.width/5*2,48,Graphics.width-Graphics.width/5*2,Graphics.height-48)
  end
  def quest=(quest)
    return if @quest == quest
    @quest = quest
    refresh
  end
  def refresh
    contents.clear
    return unless @quest
    contents.font.size = 18
    change_color(system_color)
    draw_text(0,0,contents.width,line_height,@quest.qgiver_name) if @quest.qgiver_name != 0
    draw_text(0,0,contents.width,line_height,@quest.location,2) if @quest.location != 0
    change_color(normal_color)
    @quest.qgiver_name != 0 || @quest.location != 0 ? yy = line_height : yy = 0
    draw_text_ex(0,yy,@quest.desc)
    change_color(system_color)
    draw_text(0,line_height*7,contents.width,24,"Objectifs:")
    change_color(normal_color)
    yy = line_height * 8
    @quest.objectives.each do |id, obj|
      next if obj.hidden
      draw_objective(yy, obj)
      yy += 24
    end
    change_color(system_color)
    draw_text(0,yy,contents.width,line_height,"Récompenses:")
    yy += line_height
    if @quest.reward_exp > 0
      draw_text(6,yy,contents.width/2,line_height,"EXP: ")
      change_color(normal_color)
      draw_text(36,yy,contents.width/2,line_height,@quest.reward_exp)
      yy += line_height
    end
    if @quest.reward_gold > 0
      change_color(normal_color)
      draw_text(6,yy,contents.width/2,line_height,@quest.reward_gold.to_s)
      cx = text_size(@quest.reward_gold).width
      change_color(system_color)
      draw_text(6+cx,yy,contents.width/2,line_height,Vocab::currency_unit)
    end
    yy += line_height
    change_color(normal_color)
    @quest.reward_items.each do |array|
      item = $data_items[array[1]] if array[0] == :item
      item = $data_weapons[array[1]] if array[0] == :weapon
      item = $data_armors[array[1]] if array[0] == :armor
      draw_item_name(item, 6, yy, true, contents.width)
      if array[2] > 1
        draw_text(6+text_size(item.name).width+36,yy,48,24,"x"+array[2].to_s)
      end
      yy += line_height
    end
    if @quest.difficulty != 0
      text = "Difficulté: " + @quest.difficulty
      draw_text(0,contents.height-line_height,contents.width,line_height,text,2)
    end
  end
  def draw_objective(yy, obj)
    draw_text(6,yy,contents.width,24,obj.name)
  #  draw_text(0,yy,contents.width,24,obj.current.to_s+"/"+obj.max.to_s,2)
  end
  def reset_font_settings
    change_color(normal_color)
    contents.font.bold = Font.default_bold
    contents.font.italic = Font.default_italic
  end
end
 
class Window_QuestTrack < Window_Command
  def initialize
    super(0,0)
    self.openness = 0
  end
  def quest(quest)
    @quest = quest
  end
  def make_command_list
    return unless @quest
    if !$game_quests.tracking?.include?(@quest.id)
      add_command("Suivre Quête", :track)
    else
      add_command("Stopper Quête", :untrack)
    end
    add_command("Abandonner Quête", :abandon, @quest.can_abandon?)
  end
  def window_height
    fitting_height(2)
  end
end
 
class Window_MenuCommand
  alias quest_aoc add_original_commands
  def add_original_commands
    quest_aoc
    add_command("Liste Quêtes", :quest, !$game_quests.no_quests?)
  end
end
 
class Scene_Menu
  alias quest_ccw create_command_window
  def create_command_window
    quest_ccw
    @command_window.set_handler(:quest,    method(:scene_quest))
  end
  def scene_quest
    SceneManager.call(Scene_Quest)
  end
end
 
class Scene_Map
  alias quest_start start
  alias quest_update update
  def start
    quest_start
    @quest_log = Window_QuestLog.new
    @quest_confirm = Window_QuestConfirm.new
    @quest_confirm.set_handler(:accept, method(:confirm_accept))
    @quest_confirm.set_handler(:decline, method(:confirm_cancel))
    @quest_confirm.set_handler(:cancel, method(:confirm_cancel))
    @quest_turnin = Window_QuestTurnin.new
    @quest_turnin.set_handler(:accept, method(:turnin_accept))
    @quest_turnin.set_handler(:decline, method(:confirm_cancel))
    @quest_turnin.set_handler(:cancel, method(:confirm_cancel))
    @quest_apply = Window_QuestApply.new(@quest_confirm,@quest_turnin)
  end
  def update(*args)
    @quest_log = Window_QuestLog.new if @quest_log.disposed?
    if Input.press?(:Z)
      $questlogvisibility = true
      @quest_log.opacity = 180
    else
      $questlogvisibility = false
    end
    quest_update(*args)
  end
  def show_quest(id, turnin = false)
    @quest_apply.show($game_quests[id],turnin)
  end
  def accepting?
    @quest_confirm.active || @quest_turnin.active
  end
  def confirm_accept
    @quest_apply.accept
    @quest_apply.hide
  end
  def confirm_cancel
    @quest_apply.hide
  end
  def turnin_accept
    @quest_apply.turnin
    @quest_apply.hide
  end
  def update_call_menu
    if $game_party.members.include?($game_party.members[1])
      if $game_system.menu_disabled || $game_map.interpreter.running? || accepting?
        @menu_calling = false
      else
        @menu_calling ||= Input.trigger?(:B)
        call_menu if @menu_calling && !$game_player.moving?
      end
    end
  end
end
 
class Scene_Base
  def accepting?
    false
  end
end
 
class Window_QuestLog < Window_Base
  def initialize
    super(Graphics.width/5*3,0,Graphics.width/5*2,Graphics.height)
    self.x = 0 if QUEST_LOG_POSITION == 1
    self.x += QUEST_LOG_OFFSET_X
    self.y += QUEST_LOG_OFFSET_Y
    self.opacity = 180
    self.visible = false
    self.contents.font.size = 18
  end
  
  def update
    super
    return unless Graphics.frame_count % 20 == 0
    self.visible = $questlogvisibility
    return unless self.visible
    self.visible = !$game_quests.no_quests?
    self.visible = $game_quests.tracking?.size > 0
    return unless self.visible
    contents.clear
    if $game_quests.tracking?.size == 1
      self.height = Graphics.height/5
    elsif $game_quests.tracking?.size == 2
      self.height = Graphics.height/5*2-32
    elsif $game_quests.tracking?.size == 3
      self.height = Graphics.height/5*3-64
    elsif $game_quests.tracking?.size == 4
      self.height = Graphics.height/5*4-96
    elsif $game_quests.tracking?.size == 5
      self.height = Graphics.height-128
    elsif $game_quests.tracking?.size == 6
      self.height = Graphics.height-96
    end
    change_color(crisis_color)
    draw_text(0,0,contents.width,18,"Journal Quêtes:",1)
    yy = 18;iter = 0
    $game_quests.tracking?.each do |id|
      quest = $game_quests[id]
      next unless quest.accepted? && !quest.turned_in
      change_color(system_color)
      draw_text(0,yy,contents.width,18,quest.name, 1) #(6,yy,contents.width-6,18,quest.name)
      change_color(normal_color)
      yy += 18
      quest.objectives.each do |obj_id, obj|
        next if obj.hidden
        draw_objective(yy, $game_party.quests[id][obj_id])
        yy += 18
      end
      iter += 1
    end
  end
  def draw_objective(yy, obj)
    draw_text(0,yy,contents.width-24,18,obj.name)
    draw_text(0,yy,contents.width,18,obj.current.to_s+"/"+obj.max.to_s,2)
  end
end
   
class Window_QuestApply < Window_Base
  def initialize(confirm_window, turnin_window)
    super(Graphics.width/8,Graphics.width/8,Graphics.width/5*3,Graphics.height-Graphics.width/8*2)
    self.openness = 0
    @confirm_window = confirm_window
    @turnin_window = turnin_window
    self.contents.font.size = 18
  end
  def refresh
    return unless @quest
    contents.clear
    change_color(system_color)
    yy = 0
    if @quest.qgiver_name != 0
      draw_text(0,0,contents.width/2,line_height,@quest.qgiver_name)
      yy = line_height
    end
    if @quest.location != 0
      draw_text(contents.width/2,0,contents.width/2,line_height,@quest.location,2)
      yy = line_height
    end
    change_color(crisis_color)
    draw_text(0,yy,contents.width,line_height,"Lvl: " + @quest.level.to_s) if @quest.level > 0
    draw_text(0,yy,contents.width,line_height,@quest.name,1)
    draw_text(0,yy,contents.width,line_height,@quest.difficulty,2) if @quest.difficulty != 0
    change_color(normal_color)
    draw_text_ex(0,line_height+yy,@quest.desc)
    change_color(system_color)
    draw_text(0,line_height*8,contents.width,line_height,"Objectifs:")
    change_color(normal_color)
    yy = line_height * 9
    @quest.objectives.each do |obj_id, obj|
      next if obj.hidden
      draw_objective(yy, $game_party.quests[@quest.id][obj_id])
      yy += line_height
    end
    change_color(system_color)
    draw_text(0,yy,contents.width,line_height,"Récompenses:")
    yy += line_height
    if @quest.reward_exp > 0
      draw_text(6,yy,contents.width/2,line_height,"EXP: ")
      change_color(normal_color)
      draw_text(36,yy,contents.width/2,line_height,@quest.reward_exp)
      yy += line_height
    end
    if @quest.reward_gold > 0
      change_color(normal_color)
      draw_text(6,yy,contents.width/2,line_height,@quest.reward_gold.to_s)
      cx = text_size(@quest.reward_gold).width
      change_color(system_color)
      draw_text(6+cx,yy,contents.width/2,line_height,Vocab::currency_unit)
    end
    yy += line_height
    change_color(normal_color)
    @quest.reward_items.each do |array|
      item = $data_items[array[1]] if array[0] == :item
      item = $data_weapons[array[1]] if array[0] == :weapon
      item = $data_armors[array[1]] if array[0] == :armor
      draw_item_name(item, 6, yy, true, contents.width)
      if array[2] > 1
        draw_text(6+text_size(item.name).width+36,yy,48,24,"x"+array[2].to_s)
      end
      yy += line_height
    end
  end
  def reset_font_settings
    change_color(normal_color)
    contents.font.bold = Font.default_bold
    contents.font.italic = Font.default_italic
  end
  def line_height
    18
  end
  def draw_objective(yy, obj)
    draw_text(6,yy,contents.width,24,obj.name)
    draw_text(0,yy,contents.width,24,obj.current.to_s+"/"+obj.max.to_s,2)
  end
  def show(quest,turnin)
    @quest = quest
    return if @quest.turned_in
    refresh
    open
    @confirm_window.quest(@quest)
    @confirm_window.open if !turnin
    if turnin
      @turnin_window.quest(@quest)
      @turnin_window.open
    end
  end
  def hide
    close
    @confirm_window.close
    @turnin_window.close
  end
  def accept
    @quest.accept
  end
  def turnin
    @quest.turnin
  end
end
 
class Window_QuestConfirm < Window_HorzCommand
  def initialize
    super(Graphics.width/8,Graphics.width/8+Graphics.height-Graphics.width/8*2)
    self.openness = 0
    self.active = false
    @enabled = true
    refresh
  end
  def window_width
    Graphics.width/5*2
  end
  def window_height
    48
  end
  def make_command_list
    add_command("Accepter",:accept)
    add_command("Décliner",:decline, @enabled)
  end
  def item_width
    width / 2 - padding * 2
  end
  def open
    super
    activate
    select(0)
  end
  def quest(quest)
    @quest = quest
    @enabled = !@quest.force_accept
    refresh
  end
  def cancel_enabled?
    super && @enabled
  end
end
 
class Window_QuestTurnin < Window_QuestConfirm
  def quest(quest)
    @quest = quest
    @enabled = true
    @enabled = !@quest.completed? if @quest.force_turnin
    refresh
  end
  def make_command_list
    return unless @quest
    add_command("Compléter",:accept,@quest.completed? && !@quest.turned_in)
    add_command("Annuler",:decline, @enabled)
  end
end
 
class Game_Party
  attr_accessor :quests
  attr_accessor :tracking
  alias quests_init initialize
  def initialize(*args)
    quests_init(*args)
    @quests = $game_quests.reset_hash unless $game_quests.nil?
    @tracking = []
  end
end
 
class Game_Player
  alias quest_update update
  def update
    return if SceneManager.scene.accepting?
    quest_update
  end
end
 
class Game_Event
  def obj(quest, objective)
    $game_quests[quest].objective(objective).current
  end
end
 
class Game_Interpreter
  def accept_quest(quest)
    $game_quests[quest].accept
  end
  def ask_accept(quest)
    return unless SceneManager.scene.is_a?(Scene_Map)
    SceneManager.scene.show_quest(quest)
    Fiber.yield while SceneManager.scene.accepting?
  end
  def abandon_quest(quest)
    $game_quests[quest].abandon
  end
  def fail_quest(quest)
    $game_quests[quest].fail
  end
  def turnin_quest(quest)
    $game_quests[quest].turnin
  end
  def ask_turnin(quest)
    return unless SceneManager.scene.is_a?(Scene_Map)
    SceneManager.scene.show_quest(quest,true)
    Fiber.yield while SceneManager.scene.accepting?
  end
  def adv_obj(quest, objective, value)
    $game_quests[quest].adv_obj(objective, value)
  end
  def set_obj(quest, objective, value)
    $game_quests[quest].set_obj(objective, value)
  end
  def obj(quest, objective)
    $game_quests[quest].objective(objective).current
  end
  def hide_obj(quest, objective)
    $game_quests[quest].objective(objective).hidden = true
  end
  def show_obj(quest, objective)
    $game_quests[quest].objective(objective).hidden = false
  end
end
 
module DataManager
  class << self
    alias quest_load_game load_game
  end
  def self.load_game(index)
    quest_load_game(index)
    $game_quests.check_quests
  end
end



voilà le code que moi j'utilise, j'y ais rajouté quelques quêtes pour les besoins de mon projet et tout les messages sont traduits en français. après je pense que le souci doit venir de la manière dont tu appelles tes quêtes :

par exemple pour cette quête ci dans le script :

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
    #Main Quest 3
  DETAILS[:questid003] = {
    :name => "L'académie",
    :abandonable => false,
    :level => 0,}
  DESCRIPTIONS[:questid003] = {
    :qgiver_name => "Gérant de la plantation",
    :location => "Bhamuta",
    :desc => "Livrer le colis à l'intendant
de l'académie draconique" }
  OBJECTIVES[:questid003] = {
    :obj1 => ["Livrer le colis à l'académie",1] }
  REWARDS[:questid003] = {}



j'utilise la commande script dans un évènement et je met ça dedans :

accept_quest(:questid003)

ainsi la quête s'ajoute automatiquement à la liste si j'avais voulu qu'on demande l'avis du joueur j'aurais mis :

ask_accept(:questid003)

Pour abandonner la quête (parfois une quête peut en remplacer une autre pour les besoins du scénario donc cette commande peut être utile):

abandon_quest(:questid003)

Pour valider la quête sans demander l'avis du joueur (généralement lorsqu'il n'y a aucun objet à fournir pour la quête j'utilise cette commande) :

turnin_quest(:questid003)

Pour demander au joueur si il veut ou non valider la quête :

ask_turnin(:questid003)

Dans le cas où la quête peut être échouée et si c'est le cas tu utilise cette commande :

fail_quest(:questid003)

Le script n' est pas forcément évident pour quelqu'un qui ne s'y connait pas en script surtout pour la configuration des quêtes mais une fois que tu l'as mis d'aplomb c'est nickel.

Edit : Ah ouais j'avais modifié un peu le script pour que le quest_log ne soit visible que si on garde appuyée la touche Z du clavier ^^. Si tu veux modifier ça dis le moi je te remettrai ça comme il faut.

Anti-inconstructivité / Pétition pour que le mot making soit inscrit dans le dictionnaire ?


Nukidoudi - posté le 08/10/2016 à 15:32:41 (733 messages postés) -

❤ 0

yo

Sinon tu peux utiliser ce script : http://www.biloucorp.com/un-systeme-de-quetes-extremement-riche--35

(il est décrit dans la section "Le vrai script (super badass) :D")

https://xvw.lol


Hurrikani - posté le 08/10/2016 à 22:42:04 (14 messages postés)

❤ 0

KAMIKAZE!

- arttroy
j'ai droit à

Script "line 623: NameError occured. undefined method 'add_original_commands' for class "Window_MenuCommand' (j'arrive pas a mettre un screen j suis un boulet là x) )



-Nukidoui
Ce script a l'air sympa je vais tester merci ^^

EDIT : Je pige un peu rien au Custom data base '-'

....................................................


Nukidoudi - posté le 09/10/2016 à 14:44:11 (733 messages postés) -

❤ 0

yo

tu dois juste l'installer, tu n'es pas obligé de t'en servir

https://xvw.lol


Hurrikani - posté le 09/10/2016 à 16:00:09 (14 messages postés)

❤ 0

KAMIKAZE!

ah du coup ca va mieux x)

mais du coup j'ai fait une quete pour test et il me marque

unexepected tSYMBEG, expecting '(' :gold => 200,

....................................................


Nukidoudi - posté le 09/10/2016 à 23:43:44 (733 messages postés) -

❤ 0

yo

je peux voir le code de ta quête ?

https://xvw.lol


Hurrikani - posté le 11/10/2016 à 20:42:13 (14 messages postés)

❤ 0

KAMIKAZE!

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
Quest.create(
  :id => 2,
  :name => "test",
  :desc => "test",
  :gold => 200,
  :exp => 120,
  :items => [1,1,2],
  :weapons => [1],
  :armors => [1],
  :need_confiramtion => true
  :success_trigger => monster_killed(1, 2)
)



....................................................


arttroy - posté le 12/10/2016 à 12:32:24 (2394 messages postés)

❤ 0

Just working

need_confiramtion

c'est pas plutôt

need_confirmation

??

Après ça devrait pas changer grand chose à ton problème mais ça évitera d'en avoir d'autres

Anti-inconstructivité / Pétition pour que le mot making soit inscrit dans le dictionnaire ?


Hurrikani - posté le 12/10/2016 à 15:46:04 (14 messages postés)

❤ 0

KAMIKAZE!

ba maintenant j'ai le même message d’erreur mais pour la succes_trigger

....................................................


François Berhn - posté le 12/10/2016 à 15:50:16 (5402 messages postés)

❤ 0

Tonton Hellper

Tu as oublié une virgule après :need_confiramtion => true

La liste des raisons pour lesquelles le making se meurt, la cinquième va vous étoner | Des projets abandonnés, source d'inspiration :D | Mes jeux


Nukidoudi - posté le 12/10/2016 à 15:58:47 (733 messages postés) -

❤ 0

yo

Yep ;) merci Hellper !

https://xvw.lol


Hurrikani - posté le 12/10/2016 à 17:11:17 (14 messages postés)

❤ 0

KAMIKAZE!

'_' merci

c'est stuupide comme erreur enfaite

....................................................


arttroy - posté le 13/10/2016 à 12:49:00 (2394 messages postés)

❤ 0

Just working

Ça l'est souvent quand on parle de script ^^ Une virgule, une parenthèse ou un tableau non ou mal refermés et c'est la catastrophe XD.

Anti-inconstructivité / Pétition pour que le mot making soit inscrit dans le dictionnaire ?

Index du forum > Entraide > [RESOLU] [VX Ace] Journal de quêtes

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