• Anmelden

Mitsch93

Drachentöter

  • »Mitsch93« ist der Autor dieses Themas

Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.

  • Nachricht senden

1

Sonntag, 12. März 2017, 11:16

[ERLEDIGT] Heldenpunkte System (Stat Distribution System) Edit

Ahoi,

ich habe mittlerweile das Stat Distribution System in mein Menü integriert,
alles soweit toll, alles läuft.
Was aber gar nicht so schön ist, dass die verteilten Punkte nicht gespeichert werden,
wenn man das Menü mit ESC verlässt. Das confirmation window wird dann erst gar nicht
aufgerufen.

Habe mir das ganze auch mal angesehen, aber komme nicht so mit dem Code zurecht.
Habe dann mal stupf reineditiert, aber dabei kam nur Müll raus.
Liegt vermutlich daran, dass ich bei mir alles kleinlich sortiere und sehr übersichtlich schachtel.

Wäre cool, wenn das jemand so editieren kann, dass bei ESC (habe die Stelle im Code mit einem print gekennzeichnet)
ebenfalls das Confirmation Window anzeigt wird.
Ich hatte bei meinem Edit das Problem, dass bei "Änderung verwerfen" nichts geschehen ist <.<

Stat Distribution System:
Spoiler

Ruby Quellcode

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
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Stat Distribution System by Blizzard
# Version: 2.2b
# Type: Actor Attribute Modifier
# Date: 25.3.2007
# Date v1.1b: 6.4.2007
# Date v1.2b: 22.8.2007
# Date v1.3b: 12.9.2007
# Date v1.33b: 5.11.2007
# Date v2.0: 18.10.2009
# Date v2.01: 28.7.2010
# Date v2.1: 16.12.2011
# Date v2.2: 29.9.2012
# Date v2.2b: 30.9.2012
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# 
# Compatibility:
# 
#   99% compatible with SDK v1.x. 80% compatible with SDK 2.x. WILL corrupt
#   your old savegames. Might cause problems with custom leveling up systems.
#   99% compatibility with everything else.
# 
# 
# Features:
# 
#   - distribute points between different stats
#   - extra scene for point distribution with confirmation window at the end
#   - calls the "caller scene" automatically when finished
#   - add points by easily pressing RIGHT/LEFT
#   - hold Q to add 10 points at once
#   - hold W to add 100 points at once
#   - a Stat Distribution System that actually works like it should...
# 
# new in v1.1b:
#   - added option to call the Points Scene after a fight with level ups
#   - customizable icon position and opacity
# 
# new in v1.2b:
#   - improved coding and made code shorter
#   - rewritten conditions using classic syntax to avoid RGSS conditioning bug
# 
# new in v1.3b:
#   - improved coding
#   - fixed bug with AUTO_CALL after battle
#   - new AUTO_MAP_CALL works on the map as well (that means it's fully
#     compatible with Blizz-ABS)
# 
# new in v1.33b:
#   - improved coding
#   - improved compatibility
#   - fixed a little glitch
# 
# new in v2.0:
#   - improved coding and overworked system (corrupts old savegames with older
#     version of this system!)
#   - new design
#   - new support for HP and SP
#   - now possible to configure multiple points for one stat
# 
# new in v2.01:
#   - fixed bug with display of remaining DP
# 
# new in v2.1:
#   - fixed bug with calculation of DP allowance
# 
# new in v2.2:
#   - added possibility of using negative number in X_DP_COST values for
#     inverted exchange rates
# 
# new in v2.2b:
#   - fixed a few small bugs when using inverted exchange rates
# 
# 
# Configuration:
# 
#   Set up the configuration below.
# 
#   STARTING_DP   - how many points should the actor have initially at level 1
#   DP_PER_LEVEL  - how many points should the actor gain per level
#   HP_DP_COST    - how many DP does 1 HP cost (use negative numbers for
#                   inverted exchange rate)
#   SP_DP_COST    - how many DP does 1 SP cost (use negative numbers for
#                   inverted exchange rate)
#   STR_DP_COST   - how many DP does 1 STR cost (use negative numbers for
#                   inverted exchange rate)
#   DEX_DP_COST   - how many DP does 1 DEX cost (use negative numbers for
#                   inverted exchange rate)
#   AGI_DP_COST   - how many DP does 1 AGI cost (use negative numbers for
#                   inverted exchange rate)
#   INT_DP_COST   - how many DP does 1 INT cost (use negative numbers for
#                   inverted exchange rate)
#   AUTO_CALL     - set to true to have the scene called automatically after
#                   battles if at least one character got leveled up
#   AUTO_MAP_CALL - set to true to have the scene called automatically on the
#                   map if at least one character got leveled up (this works
#                   for Blizz-ABS as well), also note that this will cause the
#                   scene to called over and over as long as not all points
#                   were distributed
#   DISPLAY_ICON  - displays an icon on the map if ANY character in the
#                   party has any points to distribute
#   OWN_ICON      - use an own icon for display, false for no or filename of
#                   your own icon (the icon has to be in the Icons folder)
#   ICON_X        - icon X coordinate
#   ICON_Y        - icon Y coordinate
#   ICON_OPACITY  - icon Y opacity
#   WINDOW_MODE   - set to true to have the command windows at the bottom, set
#                   to false to have them to at the top
# 
# 
#   You can always add change DP yourself by using following syntax:
# 
#     $game_party.actors[POSITION].dp = VALUE
#     $game_actors[ID].dp = VALUE
# 
#   POSITION - position of actor in the party (STARTS FROM ZERO!)
#   ID       - ID of actor in the database
#   VALUE    - value
# 
#   You can call the Scene by using a "Call script" event command. Type into
#   the editor window this text:
# 
#     $scene = Scene_Points.new
# 
# 
# Notes:
# 
#   - Decreasing the level of an actor won't remove his gained DP. You MUST do
#     it manually.
#   - Negative numbers in X_DP_COST designate inverted exchange rates. e.g.
#     a value of 10 would designate that 10 DP are required to raise the stat
#     by 1 point while a value of -10 woulde designate that 1 DP is required to
#     increase the stat by 10 points. This convention has been added as
#     calculation with decimals (floating point numbers) can cause problems
#     during rounding due to physically limited precision.
# 
# 
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
 
module BlizzCFG
 
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  STARTING_DP = 10
  DP_PER_LEVEL = 0
  HP_DP_COST = -2
  SP_DP_COST = 1
  STR_DP_COST = 1
  DEX_DP_COST = 1
  AGI_DP_COST = 1
  INT_DP_COST = 1
  AUTO_CALL = false
  AUTO_MAP_CALL = false
  DISPLAY_ICON = false
  OWN_ICON = false
  ICON_X = 612
  ICON_Y = 452
  ICON_OPACITY = 192
  WINDOW_MODE = true
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # constants
  HPLimit = 9999
  SPLimit = 9999
  STRLimit = 999
  DEXLimit = 999
  AGILimit = 999
  INTLimit = 999
  DPName = 'HP'
  EvasionName = 'Glück'
  EXPText = 'EHRE'
  NextText = 'nächstes Lv.'
  EquipmentText = 'Ausrüstung'
  AreYouSure = 'Bist Du sicher?'
  DistroCommands = ['Heldenpunkte verteilen', 'Nächster Charakter', 'Vorheriger Charakter', 'Beenden']
  AreYouSureCommands = ['Zurück', 'Änderungen bestätigen', 'Änderungen verwerfen']
  AttrLimits = [HPLimit, SPLimit, STRLimit, DEXLimit, AGILimit, INTLimit]
  ExchangeRates = [HP_DP_COST, SP_DP_COST, STR_DP_COST,
      DEX_DP_COST, AGI_DP_COST, INT_DP_COST]
  ColorWhite = Color.new(255, 255, 255)
  ColorBlack = Color.new(0, 0, 0)
  ColorIcon = Color.new(0, 128, 255)
  ColorIncreased = Color.new(0, 255, 0)
  # ensures compatibility
  $stat_system = 2.2
 
end
 
#==============================================================================
# Array
#==============================================================================
 
class Array
 
  def sum
    result = 0
    self.each {|i| result += i if i.is_a?(Numeric)}
    return result
  end
 
end
 
#==============================================================================
# Game_Actor
#==============================================================================
 
class Game_Actor < Game_Battler
 
  attr_reader :dp
 
  alias setup_sds_later setup
  def setup(actor_id)
    @dp = BlizzCFG::STARTING_DP
    setup_sds_later(actor_id)
  end
 
  alias exp_sds_later exp=
  def exp=(exp)
    old_level = @level
    exp_sds_later(exp)
    value = (@level - old_level) * BlizzCFG::DP_PER_LEVEL
    self.dp += value if value > 0
  end
 
  def dp=(value)
    @dp = (value < 0 ? 0 : value)
  end
 
end
 
#==============================================================================
# Window_Base
#==============================================================================
 
class Window_Base < Window
 
  def draw_actor_battler(actor, x, y)
    bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    cw, ch = bitmap.width, bitmap.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x - cw / 2, y - ch / 2, bitmap, src_rect)
  end
 
  alias draw_actor_parameter_sds_later draw_actor_parameter
  def draw_actor_parameter(actor, x, y, type, w=164)
    if type == 7
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 120, 32, BlizzCFG::EvasionName)
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 190, y, 36, 32, actor.eva.to_s, 2)
    else
      draw_actor_parameter_sds_later(actor, x, y, type)
    end
  end
 
end
 
#==============================================================================
# Window_DistributionStatus
#==============================================================================
 
class Window_DistributionStatus < Window_Base
 
  attr_reader :actor
 
  def initialize(actor)
    super(0, BlizzCFG::WINDOW_MODE ? 0 : 224, 640, 256)
    @actor = actor
    self.contents = Bitmap.new(width - 32, height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    refresh
  end
 
  def actor=(actor)
    @actor = actor
    refresh
  end
 
  def refresh
    self.contents.clear
    unless @actor == nil
      draw_actor_battler(@actor, 256, 120)
      draw_actor_name(@actor, 4, 0)
      draw_actor_class(@actor, 4, 32)
      draw_actor_level(@actor, 4, 64)
      self.contents.font.color = system_color
      #======================================================
      #Ausrüstung config Actor Advanced Status
      #======================================================
      data = []
    for i in 0...@actor.equip_kind.size
      id = @actor.equip_kind[i]
      if id == 0
        data.push($data_weapons[@actor.equip_id[i]])
      elsif id == 1 and @actor.two_swords_style
        data.push($data_weapons[@actor.equip_id[i]])
      elsif id != 0 or (id == 1 and not @actor.two_swords_style)
        data.push($data_armors[@actor.equip_id[i]])
      end
    end
    self.contents.font.size = 16
    self.contents.font.color = system_color
    return if data.size == 0
    for i in 0...@actor.equip_names.size
      name = @actor.equip_names[i]
      self.contents.draw_text(240, 24 + 28 * i, 92, 32, name)
    end
    for i in 0...data.size
      draw_item_name(data[i], 352, 24 + 28 * i)
    end
    #======================================================
    # self.contents.draw_text(352, 16, 96, 32, BlizzCFG::EquipmentText)
     # draw_item_name($data_weapons[@actor.weapon_id], 352, 64)
     # draw_item_name($data_armors[@actor.armor1_id], 352, 96)
     # draw_item_name($data_armors[@actor.armor2_id], 352, 128)
     # draw_item_name($data_armors[@actor.armor3_id], 352, 160)
     # draw_item_name($data_armors[@actor.armor4_id], 352, 192)
      self.contents.font.color = normal_color
      draw_actor_parameter(@actor, 4, 96, 0)
      draw_actor_parameter(@actor, 4, 128, 1)
      draw_actor_parameter(@actor, 4, 160, 2)
      draw_actor_parameter(@actor, 4, 190, 7)
    end
  end
 
end
 
#==============================================================================
# Window_DistributionPoints
#==============================================================================
 
class Window_DistributionPoints < Window_Base
 
  attr_reader :actor
  attr_reader :dp_left
 
  def initialize(actor)
    super(0, BlizzCFG::WINDOW_MODE ? 416 : 160, 224, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.actor = actor
  end
 
  def actor=(actor)
    @actor, @dp_left = actor, actor.dp
    refresh
  end
 
  def set_dp(value)
    @dp_left = actor.dp - value
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 32, 32, BlizzCFG::DPName)
    self.contents.font.color = normal_color
    self.contents.draw_text(36, 0, 152, 32, "#{@dp_left} / #{@actor.dp}", 2)
  end
 
end
 
#==============================================================================
# Window_Distribution
#==============================================================================
 
class Window_Distribution < Window_Selectable
 
  attr_reader :actor
  attr_reader :spent
 
  def initialize(actor)
    super(224, BlizzCFG::WINDOW_MODE ? 256 : 0, 416, 224)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    #@words = ["Max #{$data_system.words.hp}", "Max #{$data_system.words.sp}",
    #    $data_system.words.str, $data_system.words.dex, $data_system.words.agi,
    #    $data_system.words.int]
    @words = ["Max #{$data_system.words.hp}",
        $data_system.words.str, $data_system.words.dex, $data_system.words.agi,
        $data_system.words.int]
    @item_max = @words.size
    self.actor = actor
    self.active, self.index = false, 0
  end
 
  def actor=(actor)
    @actor = actor
    #@current = [@actor.maxhp, @actor.maxsp, @actor.str, @actor.dex, @actor.agi,
    #    @actor.int]
    @current = [@actor.maxhp, @actor.str, @actor.dex, @actor.agi,
                @actor.int]
    @spent = [0, 0, 0, 0, 0]
    refresh
  end
 
  def active=(value)
    super(value)
    update_cursor_rect
  end
 
  def apply_new_attributes
    @actor.maxhp += (BlizzCFG::HP_DP_COST > 0 ?
        @spent[0] / BlizzCFG::HP_DP_COST : @spent[0] * -BlizzCFG::HP_DP_COST)
    #@actor.maxsp += (BlizzCFG::SP_DP_COST > 0 ?
    #    @spent[1] / BlizzCFG::SP_DP_COST : @spent[1] * -BlizzCFG::SP_DP_COST)
    @actor.str += (BlizzCFG::STR_DP_COST > 0 ?
        @spent[1] / BlizzCFG::STR_DP_COST : @spent[2] * -BlizzCFG::STR_DP_COST)
    @actor.dex += (BlizzCFG::DEX_DP_COST > 0 ?
        @spent[2] / BlizzCFG::DEX_DP_COST : @spent[3] * -BlizzCFG::DEX_DP_COST)
    @actor.agi += (BlizzCFG::AGI_DP_COST > 0 ?
        @spent[3] / BlizzCFG::AGI_DP_COST : @spent[4] * -BlizzCFG::AGI_DP_COST)
    @actor.int += (BlizzCFG::INT_DP_COST > 0 ?
        @spent[4] / BlizzCFG::INT_DP_COST : @spent[5] * -BlizzCFG::INT_DP_COST)
    @actor.dp -= @spent.sum
    self.actor = @actor
  end
 
  def refresh
    self.contents.clear
    (0...@item_max).each {|i| draw_item(i)}
  end
 
  def draw_item(i)
    y = i * 32
    self.contents.fill_rect(0, y, self.contents.width, 32, Color.new(0, 0, 0, 0))
    self.contents.font.color = system_color
    self.contents.draw_text(4, y, 80, 32, @words[i])
    self.contents.draw_text(344, y, 40, 32, BlizzCFG::DPName)
    self.contents.draw_text(180, y, 12, 32, '/', 1)
    self.contents.draw_text(192, y, 64, 32, @current[i].to_s)
    self.contents.font.color = normal_color
    if BlizzCFG::ExchangeRates[i] > 0
      self.contents.draw_text(276, y, 64, 32,
          BlizzCFG::ExchangeRates[i].to_s, 2)
    elsif BlizzCFG::ExchangeRates[i] < 0
      self.contents.draw_text(276, y, 64, 32,
          "1/" + (-BlizzCFG::ExchangeRates[i]).to_s, 2)
    end
    font, self.contents.font.name = self.contents.font.name, 'Trajan Pro'
    size, self.contents.font.size = self.contents.font.size, 32
    bold, self.contents.font.bold = self.contents.font.bold, true
    self.contents.draw_text(104, y - 2, 24, 32, '«')
    self.contents.draw_text(244, y - 2, 24, 32, '»', 2)
    self.contents.font.bold = bold
    self.contents.font.size = size
    self.contents.font.bold = bold
    self.contents.font.color = BlizzCFG::ColorIncreased if @spent[i] > 0
    current = @current[i]
    if BlizzCFG::ExchangeRates[i] > 0
      current = (@current[i] + @spent[i] / BlizzCFG::ExchangeRates[i])
    elsif BlizzCFG::ExchangeRates[i] < 0
      current = (@current[i] + @spent[i] * -BlizzCFG::ExchangeRates[i])
    end
    current = BlizzCFG::AttrLimits[i] if current > BlizzCFG::AttrLimits[i]
    self.contents.draw_text(116, y, 64, 32, current.to_s, 2)
  end
 
  def add_points(value)
    return false if value == 0
    if BlizzCFG::ExchangeRates[index] > 0
      limit = BlizzCFG::AttrLimits[index] -
          (@current[index] + @spent[index] / BlizzCFG::ExchangeRates[index])
      remaining = (@actor.dp - @spent.sum) / BlizzCFG::ExchangeRates[index]
      limit = remaining if limit > remaining
      value = limit if value > limit
    elsif BlizzCFG::ExchangeRates[index] < 0
      value *= -BlizzCFG::ExchangeRates[index]
      limit = BlizzCFG::AttrLimits[index] -
          (@current[index] + @spent[index] * -BlizzCFG::ExchangeRates[index])
      remaining = (@actor.dp - @spent.sum) * -BlizzCFG::ExchangeRates[index]
      limit = remaining if limit > remaining
      value = limit if value > limit
      spent = (value - BlizzCFG::ExchangeRates[index] - 1) /
          -BlizzCFG::ExchangeRates[index]
    end
    if value > 0
      if BlizzCFG::ExchangeRates[index] > 0
        @spent[index] += value * BlizzCFG::ExchangeRates[index]
      elsif BlizzCFG::ExchangeRates[index] < 0
        @spent[index] += spent
      end
      return true
    end
    return false
  end
 
  def remove_points(value)
    return false if value == 0
    if BlizzCFG::ExchangeRates[index] > 0
      limit = @spent[index] / BlizzCFG::ExchangeRates[index]
      value = limit if value > limit
    elsif BlizzCFG::ExchangeRates[index] < 0
      value = @spent[index] if value > @spent[index]
      spent = value
      value *= -BlizzCFG::ExchangeRates[index]
    end
    if value > 0
      if BlizzCFG::ExchangeRates[index] > 0
        @spent[index] -= value * BlizzCFG::ExchangeRates[index]
      elsif BlizzCFG::ExchangeRates[index] < 0
        @spent[index] -= spent
      end
      return true
    end
    return false
  end
 
  def update
    super
    return unless self.active
    if Input.press?(Input::R)
      if Input.repeat?(Input::RIGHT)
        if add_points(100)
          $game_system.se_play($data_system.cursor_se)
          draw_item(self.index)
        else
          $game_system.se_play($data_system.buzzer_se)
        end
      elsif Input.repeat?(Input::LEFT)
        if remove_points(100)
          $game_system.se_play($data_system.cursor_se)
          draw_item(self.index)
        else
          $game_system.se_play($data_system.buzzer_se)
        end
      end
    elsif Input.press?(Input::L)
      if Input.repeat?(Input::RIGHT)
        if add_points(10)
          $game_system.se_play($data_system.cursor_se)
          draw_item(self.index)
        else
          $game_system.se_play($data_system.buzzer_se)
        end
      elsif Input.repeat?(Input::LEFT)
        if remove_points(10)
          $game_system.se_play($data_system.cursor_se)
          draw_item(self.index)
        else
          $game_system.se_play($data_system.buzzer_se)
        end
      end
    elsif Input.repeat?(Input::RIGHT)
      if add_points(1)
        $game_system.se_play($data_system.cursor_se)
        draw_item(self.index)
      else
        $game_system.se_play($data_system.buzzer_se)
      end
    elsif Input.repeat?(Input::LEFT)
      if remove_points(1)
        $game_system.se_play($data_system.cursor_se)
        draw_item(self.index)
      else
        $game_system.se_play($data_system.buzzer_se)
      end
    end
  end
 
  def update_cursor_rect
    if @index < 0 || !self.active
      self.cursor_rect.empty
    else
      super
    end
  end
 
end
 
#==============================================================================
# Window_Sure
#==============================================================================
 
class Window_Sure < Window_Command
 
  def initialize(width, commands)
    commands = commands.clone + ['']
    super
    @item_max, self.index = commands.size - 1, 0
    self.x, self.y, self.z = 320 - self.width / 2, 240 - self.height / 2, 10000
    refresh
  end
 
  def refresh
    super
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, self.contents.width - 8, 32,
        BlizzCFG::AreYouSure, 1)
  end
 
  def draw_item(i, color)
    self.contents.font.color = color
    rect = Rect.new(4, (i + 1) * 32, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[i], 1)
  end
 
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(32, (@index + 1) * 32, self.contents.width - 64, 32)
    end
  end
 
end
 
#==============================================================================
# Scene_Points
#==============================================================================
 
#==============================================================================
# Scene_Points
#==============================================================================
 
class Scene_Points
 
  def initialize(classe = $scene.class)
    @scene = classe
  end
 
  def main
    @command_window = Window_Command.new(224, BlizzCFG::DistroCommands)
    @command_window.y = (BlizzCFG::WINDOW_MODE ? 256 : 0)
    actor = $game_party.actors[0]
    @status_window = Window_DistributionStatus.new(actor)
    @distro_window = Window_Distribution.new(actor)
    @dp_window = Window_DistributionPoints.new(actor)
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    @command_window.dispose
    @status_window.dispose
    @distro_window.dispose
    @dp_window.dispose
  end
 
  def create_confirmation_window
    @sure_window = Window_Sure.new(256, BlizzCFG::AreYouSureCommands)
  end
 
  def update
    if @command_window.active
      @command_window.update
      update_main_command
    elsif @sure_window != nil
      @sure_window.update
      update_confirmation
    elsif @distro_window.active
      @distro_window.update
      update_distro
    end
  end
 
  def update_main_command
    if Input.trigger?(Input::B)
      print "ESC"
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(0,4)
    elsif Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      if @command_window.index == 0
        @command_window.active, @distro_window.active = false, true
      elsif @distro_window.spent.sum > 0
        @command_window.active = false
        create_confirmation_window
      else
        @distro_window.index = 0
        check_command_window
      end
    end
  end
 
  def update_confirmation
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @sure_window.dispose
      @sure_window, @command_window.active = nil, true
    elsif Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      if @sure_window.index > 0
        @distro_window.apply_new_attributes if @sure_window.index == 1
        check_command_window
      end
      @sure_window.dispose
      @sure_window, @command_window.active = nil, true
    end
  end
 
  def check_command_window
    case @command_window.index
    when 1
      i = @status_window.actor.index + 1
      i %= $game_party.actors.size
      @status_window.actor = @distro_window.actor =
          @dp_window.actor = $game_party.actors[i]
    when 2
      i = @status_window.actor.index + $game_party.actors.size - 1
      i %= $game_party.actors.size
      @status_window.actor = @distro_window.actor =
          @dp_window.actor = $game_party.actors[i]
    when 3
      print "BEENDEN"
      $scene = Scene_Menu.new(0,4)
    end
  end
 
  def update_distro
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active, @distro_window.active = true, false
    elsif Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @command_window.active, @distro_window.active = true, false
    elsif Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT)
      @dp_window.set_dp(@distro_window.spent.sum)
    end
  end
 
end
 
#==============================================================================
# Scene_Battle
#==============================================================================
 
class Scene_Battle
 
  alias main_sds_later main
  def main
    main_sds_later
    if BlizzCFG::AUTO_CALL &&
        $game_party.actors.any? {|actor| actor.dp > 0}
      $scene = Scene_Points.new
    end
  end
 
end
 
#==============================================================================
# Scene_Map
#==============================================================================
 
class Scene_Map
 
  alias main_sds_later main
  def main
    main_sds_later
    @notify.dispose if @notify != nil
  end
 
  alias upd_sds_later update
  def update
    check_icon if BlizzCFG::DISPLAY_ICON
    upd_sds_later
    if BlizzCFG::AUTO_MAP_CALL &&
        $game_party.actors.any? {|actor| actor.dp > 0}
      $scene = Scene_Points.new
    end
  end
 
  def check_icon
    if $game_party.actors.any? {|actor| actor.dp > 0}
      if @notify == nil
        @notify = RPG::Sprite.new
        if BlizzCFG::OWN_ICON
          @notify.bitmap = RPG::Cache.icon(BlizzCFG::OWN_ICON)
        else
          @notify.bitmap = Bitmap.new(24, 24)
          @notify.bitmap.fill_rect(0, 0, 24, 24, BlizzCFG::ColorWhite)
          @notify.bitmap.fill_rect(22, 1, 2, 23, BlizzCFG::ColorBlack)
          @notify.bitmap.fill_rect(1, 22, 23, 2, BlizzCFG::ColorBlack)
          @notify.bitmap.set_pixel(23, 0, BlizzCFG::ColorBlack)
          @notify.bitmap.set_pixel(0, 23, BlizzCFG::ColorBlack)
          @notify.bitmap.fill_rect(2, 2, 20, 20, BlizzCFG::ColorIcon)
          @notify.bitmap.fill_rect(4, 10, 16, 4, BlizzCFG::ColorWhite)
          @notify.bitmap.fill_rect(10, 4, 4, 16, BlizzCFG::ColorWhite)
          @notify.opacity = BlizzCFG::ICON_OPACITY
        end
        @notify.x, @notify.y = BlizzCFG::ICON_X, BlizzCFG::ICON_Y
        @notify.z = 5000
        @notify.blink_on
      end
      @notify.update
    elsif @notify != nil
      @notify.dispose
      @notify = nil
    end
  end
 
end

zum Lesen den Text mit der Maus markieren

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Mitsch93« (13. März 2017, 17:35)


2

Sonntag, 12. März 2017, 20:29

Ich kann es gerade nicht testen und habe den Code hier im Beitragseditor geschrieben, aber reicht es nicht sowas in der Art zu machen?

Ruby Quellcode

683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
  def update_main_command
    if Input.trigger?(Input::B)
      #print "ESC"
      if @distro_window.spent.sum > 0
        @command_window.active = false
        options = ['Upps. Wollte garnicht Escape drücken.',
                   'Alles verwerfen.']
        @confirm_cancle_window = Window_Sure.new(256, options)
      end
      #$game_system.se_play($data_system.cancel_se)
      #$scene = Scene_Menu.new(0,4)
    elsif Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      if @command_window.index == 0
        @command_window.active, @distro_window.active = false, true
      elsif @distro_window.spent.sum > 0
        @command_window.active = false
        create_confirmation_window
      else
        @distro_window.index = 0
        check_command_window
      end
    end
  end


Ruby Quellcode

670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
  def update
    if @command_window.active
      @command_window.update
      update_main_command
    elsif @sure_window != nil
      @sure_window.update
      update_confirmation
    elsif @confirm_cancle_window != nil
      @confirm_cancle_window.update
      update_cancle_confirmation
    elsif @distro_window.active
      @distro_window.update
      update_distro
    end
  end


Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  def update_cancle_confirmation
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @confirm_cancle_window.dispose
      @confirm_cancle_window, @command_window.active = nil, true
    end
    if Input.trigger?(Input::C)
      case @confirm_cancle_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
      when 1
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Menu.new(0,4)
      end
      @confirm_cancle_window.dispose
      @confirm_cancle_window, @command_window.active = nil, true
    end
  end

Mitsch93

Drachentöter

  • »Mitsch93« ist der Autor dieses Themas

Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.

  • Nachricht senden

Ähnliche Themen

Social Bookmarks