• Anmelden

1

Donnerstag, 6. November 2014, 13:05

Troop ID einstellen ? Hilfe

Hallo zusammen,
ich habe wieder ein Problem, und zwar nutze ich ja das ATOA ABS mit dem Chrono Trigger CS, jetzt wollte ich ein Tutorial in mein Spiel ein binden um das KS zu erleutern soweit auch kein Problem
Battle erstellt wie gehabt bei diesem Skript, mit CALL SKRIPT das sieht dann z.b wie folgt aus.
Spoiler

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
can_escape = false
enemies = [[2,50,false]]
start_pos = [7,11]
end_pos = [7,11]
escape_pos = [7,11]
actors_pos = [[7,11]]
troop = 2
$scene.call_ct_battle(can_escape, 
enemies, start_pos, end_pos, 
escape_pos, actors_pos, troop)
zum Lesen den Text mit der Maus markieren

Der Kampf beginnt aber das was ich bei Troops ID2 in der Base Data eingegeben habe also Z.b show Text oder Play BGM blabla
wenn ich jetzt den Gleichen Text bei bei Troop ID1 dann geht alles, problem ist dann allerdings das bei jeden kampf egal welches Enemie es auch sei der text kommt -.-
Ich schätze Fast das sich der Fehler im skript irgendwo eingeschlichen hat, es gibt da nämlich eine Stelle wo (Troop = 1) definiert Zeile 1095
Spoiler

Ruby Quellcode

1
def call_ct_battle(can_escape, enemies, start_pos, end_pos, escape_pos, actors_pos, can_lose = false, troop = 1)
zum Lesen den Text mit der Maus markieren

Das wäre ziemlich blöd da ich ja Per Call Skript bestimmen möchte welcher Troop gerade im Kampf ist und ob überhaupt ein text kommt bzw ein Event.

Ich hoffe mir kann jemand dabei helfen
hier mal das Ganze Kampfskript
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
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
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
#=============================================================================
# Chrono Trigger Battle
# By Atoa
#==============================================================================
# This scripts emulates an battle thats occurs on map, very similar to
# Chrono Trigger
#
# Also this system adds an caterpillar system, that is vital to the system.
#
#--------------------------------------------------------------------------
#
# IMPORTANT: 
# - If using the scripts "Atoa ATB" or "Atoa CTB", place this script
#   bellow them.
# - The Anti-lag script must be placed above all custom scripts
#   right bellow the script "Scene_Debug"  
#
#--------------------------------------------------------------------------
# The Battle:
# For the battle you won't need to make any change on the script.
# The only thing necessary will be the battler graphics in all directions.
# You will need an basic battler for the lateral movement. (right and left)
# You will also need graphics for the up and down movement.
# These graphics must have the same file name as the normal graphic 
# plus '_down' for the face down battler, and '_up' for the face up battler.
#
# E.g.:
#  - Normal graphic: 'Crono'
#  - Face down graphic: 'Crono_down'
#  - Face down graphic:  'Crono_up'
# 
# The 'up' and 'down' graphics must have the same size and patterns as the
# normal graphics.
# Analize the demos examples.
#
#--------------------------------------------------------------------------
# Starting the battle
# To start a battle you must make an *Script Call*
# The default battle call won't work anymore.
# On the 'Script Call' you must add the following code:
#
# can_escape = true/false
# enemies = [[event, enemy, permanent]]
# start_pos = [x, y]
# end_pos = [x, y]
# escape_pos = [x, y]
# actors_pos = [[x, y],[x, y],[x, y],[x, y]]
# can_lose = true/false
# troop = enemy troop
# $scene.call_ct_battle(can_escape, enemies, start_pos, end_pos, escape_pos, actors_pos, can_lose, troop)
#
# Where:
#   can_escape: set if will be possible to escape from battle
#     must be true or false
#
#   enemies: set the events that will be enemies, the enemies ID on the
#     database and if the enemy death will be permanent
#       
#     - event: ID of the event that will be an eneny, the enemy postion is
#       set by the event postion.
#     - enemy: ID of the enemy on the database, the status and battle graphic
#       of the enemy are set by this value
#     - permanent: defines if the enemy death will be permantent.
#       - true: the death will be 'permanent' (will turn ON the Local Switch 'D')
#       - false: the death won't be permanent (the enemy will return if you leave the map)
#     E.g.: enemies = [[1, 10, false],[2, 10, false],[3, 10, false]]
#
#   start_pos: position x/y on the map where the battle will start.
#     the screen will move to the coordinates on the map before the battle begin.
#     
#   end_pos: position x/y on the map where the battle will end.
#     map coordinate where the actors will move if the battle end or if it's aborted.
#
#   escape_pos: position x/y on the map where the battle will end in case of escape.
#     map coordinate where the actors will move if escape from battle
#     (note: rememeber to set this coordinate outside the area of the start
#      battle events, or the party will be 'stuck' until they win)
#
#   actors_pos = postion x/y on the map that each actor will stay during battle.
#     remember to add the position of all actors, or will occurs errors.
#     E.g.: actors_pos = [[20,21],[18,23],[23,20],[24,21]]
#
#   can_lose: set if battle can be lost, must be true or false
#
#   troop: Enemy Troop on the database, used for in-battle events. Pode ser omitido.
#
#   IMPORTANT: All postions values are *MAP COORDINATES*
#    
#--------------------------------------------------------------------------
# Caterpillar:
#
# The battle system haves an built-in caterpillar system, this system allows
# to show all actors on the map, and they follow the party leader.
#
# You can also control the movement of the actorns on the caterpillar
# with event commands, using the 'Script Call'
#
# $game_player.caterpillar[index].x = posição X no mapa
# $game_player.caterpillar[index].y = posição Y no mapa
#
# To gather the party members: $game_player.caterpillar_gather
#
# Don't allow the actor movement if the party is separated.
# So use the gather party events before.
#==============================================================================
# Beta testers:
# Seshomaru (mundorpgmaker.com)
# DarkLuar (santuariorpgmaker.com)
#==============================================================================
 
module Atoa
 
  # Do not change or remove these lines
  Battle_Style = 3
  Show_Graphics_Transition = true
  # Do not change or remove these lines
 
  # Revive battlers dead in the end of battle (With 1 HP)
  Auto_Revive = true
 
  # Hide dead party members
  Hide_Dead = true
 
  # Max members shown on the screen
  Max_Caterpillar_Actor = 4
 
  # ID of the ID do switch that hides de caterpillar vizualization
  Caterpillar_Hide_Switch = 2
 
  # Allow to change party order with Q or W?
  Allow_Reorder = true
 
  # Max distance between the party members. (Value in pixels)
  # Leave 0 to desactivate
  Max_Distance = 30
 
end
 
 
#==============================================================================
# ** Atoa Module
#==============================================================================
$atoa_script = {} if $atoa_script.nil?
$atoa_script['Atoa Chrono Trigger Battle'] = true
$atoa_script['Atoa Caterpillar'] = true
 
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
#  Refer to "$game_temp" for the instance of this class.
#==============================================================================
 
class Game_Temp
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :in_ct_battle
  attr_accessor :enemies_position
  attr_accessor :actors_position
  attr_accessor :battle_end_transition
  attr_accessor :lock_map_postions
  attr_accessor :enemy_troop
  attr_accessor :event_troop
  attr_accessor :event_delete
  attr_accessor :battle_result
  attr_accessor :end_pos
  attr_accessor :escape_pos
  attr_accessor :start_pos
  attr_accessor :end_direction
  attr_accessor :battle_settings
  attr_accessor :actors_start_position
  attr_accessor :battle_move
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias ctbattle_initialize initialize
  def initialize
    ctbattle_initialize
    @in_ct_battle = false
    @lock_map_postions = false
    @battle_end_transition = false
    @battle_move = false
    @enemies_position = []
    @actors_position = []
    @actors_start_position =[]
    @escape_pos = []
    @enemy_troop = []
    @event_troop = []
    @event_delete = []
    @end_pos = []
    @battle_settings = []
    @end_direction = 0
    @battle_result = 0
  end
end
 
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles the map. It includes scrolling and passable determining
#  functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
 
class Game_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  def battle_start_scroll(direction, distance, speed)
    @scroll_direction = direction
    @scroll_rest = distance
    @scroll_speed = speed
  end
end
 
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
#  This class handles the party. It includes information on amount of gold 
#  and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
 
class Game_Party
  #--------------------------------------------------------------------------
  # * Increase Steps
  #--------------------------------------------------------------------------
  alias increase_steps_ctbattle increase_steps
  def increase_steps
    unless $game_temp.lock_map_postions or $game_temp.battle_end_transition
      increase_steps_ctbattle
    end
  end
end
 
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================
 
class Game_Character  
  #--------------------------------------------------------------------------
  # * Include Settings Module
  #--------------------------------------------------------------------------
  include Atoa
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :direction
  attr_accessor :x
  attr_accessor :y
  #--------------------------------------------------------------------------
  # * Turn Down
  #--------------------------------------------------------------------------
  alias ctbattle_turn_down turn_down
  def turn_down
    ctbattle_turn_down
    @diagonal = false unless @direction_fix
  end
  #--------------------------------------------------------------------------
  # * Turn Left
  #--------------------------------------------------------------------------
  alias ctbattle_turn_left turn_left
  def turn_left
    ctbattle_turn_left
    @diagonal = false unless @direction_fix
  end
  #--------------------------------------------------------------------------
  # * Turn Right
  #--------------------------------------------------------------------------
  alias ctbattle_turn_right turn_right
  def turn_right
    ctbattle_turn_right
    @diagonal = false unless @direction_fix
  end
  #--------------------------------------------------------------------------
  # * Turn Up
  #--------------------------------------------------------------------------
  alias ctbattle_turn_up turn_up
  def turn_up
    ctbattle_turn_up
    @diagonal = false unless @direction_fix
  end
end
 
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page 
#  switching via condition determinants, and running parallel process events.
#  It's used within the Game_Map class.
#==============================================================================
 
class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :erased
  attr_accessor :step_anime
  attr_accessor :direction
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias ctbattle_event_update update
  def update
    @transparent = battle_event
    ctbattle_event_update
  end
  #--------------------------------------------------------------------------
  # * Check battle event
  #--------------------------------------------------------------------------
  def battle_event
    return true if $game_temp.in_ct_battle and $game_temp.event_troop.include?(@id)
    return false
  end
end
 
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles the player. Its functions include event starting
#  determinants and map scrolling. Refer to "$game_player" for the one
#  instance of this class.
#==============================================================================
 
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :caterpillar
  attr_accessor :old_x
  attr_accessor :old_y
  attr_accessor :move_speed
  attr_accessor :alive_actors
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  alias ctbattle_refresh refresh
  def refresh
    caterpillar_update
    ctbattle_refresh
  end
  #--------------------------------------------------------------------------
  # * Update caterpillar
  #--------------------------------------------------------------------------
  def caterpillar_update
    if @caterpillar.nil?
      @caterpillar = []
      for i in 1...Max_Caterpillar_Actor
        @caterpillar << Atoa_Caterpillar.new(i)
      end
    end
    for cat in @caterpillar
      cat.refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Get Screen X center
  #--------------------------------------------------------------------------
  def center_x
    return CENTER_X
  end
  #--------------------------------------------------------------------------
  # * Get Screen Y center
  #--------------------------------------------------------------------------
  def center_y
    return CENTER_Y
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    for cat in @caterpillar
      cat.update
    end
    last_moving = moving?
    update_movement
    last_real_x = @real_x
    last_real_y = @real_y
    super
    unless $game_temp.lock_map_postions
      if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
        $game_map.scroll_down(@real_y - last_real_y)
      end
      if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
        $game_map.scroll_left(last_real_x - @real_x)
      end
      if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
        $game_map.scroll_right(@real_x - last_real_x)
      end
      if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
        $game_map.scroll_up(last_real_y - @real_y)
      end
    end
    unless moving? or $game_temp.battle_move
      if last_moving
        result = check_event_trigger_here([1,2])
        if result == false
          unless $DEBUG and Input.press?(Input::CTRL)
            @encounter_count -= 1 if @encounter_count > 0
          end
        end
      end
      if Input.trigger?(Input::C)
        check_event_trigger_here([0])
        check_event_trigger_there([0,1,2])
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update movement
  #--------------------------------------------------------------------------
  def update_movement
    unless moving? or $game_system.map_interpreter.running? or @move_route_forcing or
            $game_temp.message_window_showing or $game_temp.lock_map_postions
      input = $atoa_script['Atoa 8 Directions'] ? Input.dir8 : Input.dir4
      case input
        when 1; move_lower_left
        when 2; move_down
        when 3; move_lower_right
        when 4; move_left
        when 6; move_right
        when 7; move_upper_left
        when 8; move_up
        when 9; move_upper_right
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Straighten Position
  #--------------------------------------------------------------------------
  def straighten
    for cat in @caterpillar
      cat.straighten
    end
    super
  end
  #--------------------------------------------------------------------------
  # * Move to Designated Position
  #     x : x-coordinate
  #     y : y-coordinate
  #--------------------------------------------------------------------------
  alias ctbattle_moveto moveto
  def moveto(x, y)
    ctbattle_moveto(x, y)
    caterpillar_update if @caterpillar.nil? or @move_update.nil?
    for i in 0...@caterpillar.size
      @caterpillar[i].moveto(x, y)
    end
  end
  #--------------------------------------------------------------------------
  # * Move Down
  #--------------------------------------------------------------------------
  def move_down
    passable = passable?(@x, @y, 2)
    caterpillar_update if @caterpillar.nil? or @move_update.nil?
    super
    add_move_update('move_down') if passable
  end
  #--------------------------------------------------------------------------
  # * Move Left
  #--------------------------------------------------------------------------
  def move_left
    passable = passable?(@x, @y, 4)
    caterpillar_update if @caterpillar.nil? or @move_update.nil?
    super
    add_move_update('move_left') if passable
  end
  #--------------------------------------------------------------------------
  # * Move Right
  #--------------------------------------------------------------------------
  def move_right
    passable = passable?(@x, @y, 6)
    caterpillar_update if @caterpillar.nil? or @move_update.nil?
    super
    add_move_update('move_right') if passable
  end
  #--------------------------------------------------------------------------
  # * Move up
  #--------------------------------------------------------------------------
  def move_up
    passable = passable?(@x, @y, 8)
    caterpillar_update if @caterpillar.nil? or @move_update.nil?
    super
    add_move_update('move_up') if passable
  end
  #--------------------------------------------------------------------------
  # * Gather actors
  #--------------------------------------------------------------------------
  def caterpillar_gather
    for i in 0...@caterpillar.size   
      @caterpillar[i].gather_party
    end
  end
  #--------------------------------------------------------------------------
  # * Add movement upodate
  #     move : next move
  #--------------------------------------------------------------------------
  def add_move_update(move)
    if @caterpillar[0] != nil
      @caterpillar[0].move_update << move
    end
  end
  #--------------------------------------------------------------------------
  # * Set alive actors
  #--------------------------------------------------------------------------
  def set_alive_actors
    @alive_actors = []
    for actor in $game_party.actors
      @alive_actors << actor unless actor.dead?
    end
  end
end
 
#==============================================================================
# ** Atoa_Caterpillar
#------------------------------------------------------------------------------
#  This class handles the players on the caterpillar
#==============================================================================
 
class Atoa_Caterpillar < Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :move_update
  attr_accessor :member
  attr_accessor :next_x
  attr_accessor :next_y
  attr_accessor :x
  attr_accessor :y
  attr_accessor :move_speed
  attr_accessor :running
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     mamber : actor
  #--------------------------------------------------------------------------
  def initialize(member)
    super()
    @move_update = []
    @member = member
    moveto($game_player.x, $game_player.y)
    @running = false
    @through = true
    refresh
    @next_x = @x
    @next_y = @y
  end
  #--------------------------------------------------------------------------
  # * Move to Designated Position
  #     x : x-coordinate
  #     y : y-coordinate
  #--------------------------------------------------------------------------
  def moveto(x, y)
    super(x, y)
    @move_update.clear
  end
  #--------------------------------------------------------------------------
  # * Straighten Position
  #--------------------------------------------------------------------------
  def straighten
    @pattern = 0 if @walk_anime or @step_anime
    @anime_count = 0
    @prelock_direction = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    $game_player.set_alive_actors
    party = Hide_Dead ? $game_player.alive_actors.dup : $game_party.actors
    if party.size < @member
      @character_name = ""
      @character_hue = 0
      return
    end
    actor = party[@member]
    if actor == nil
      @character_name = ""
      @character_hue = 0
      return
    end
    @character_name = actor.character_name
    @character_hue = actor.character_hue
    @opacity = 255
    @blend_type = 0
  end
  #--------------------------------------------------------------------------
  # * Get Screen Z-Coordinates
  #     height : character height
  #--------------------------------------------------------------------------
  def screen_z(height = 0)
    if $game_player.x == @x and $game_player.y == @y
      return $game_player.screen_z - 1
    end
    super(height)
  end
  #--------------------------------------------------------------------------
  # * Same Position Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_here(triggers)
    return false
  end
  #--------------------------------------------------------------------------
  # * Front Envent Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_there(triggers)
    return false
  end
  #--------------------------------------------------------------------------
  # * Touch Event Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_touch(x, y)
    return false
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    member = @member == 1 ? $game_player : $game_player.caterpillar[@member - 2]
    move_player(member)
    super
    @transparent = $game_player.transparent
    @transparent = @transparent ? @transparent : $game_switches[Caterpillar_Hide_Switch]
  end
  #--------------------------------------------------------------------------
  # * Get player distance
  #     member : actor
  #--------------------------------------------------------------------------
  def player_distance(member)
    dist_x = (member.screen_x - self.screen_x).abs
    dist_y = (member.screen_y - self.screen_y).abs
    return (dist_x + dist_y < Max_Distance + 30)
  end
  #--------------------------------------------------------------------------
  # * Move player
  #     member : actor
  #--------------------------------------------------------------------------
  def move_player(member)
    refresh
    @move_update.clear if member.x == @x and member.y == @y
    @start_moving = false if @move_update.size <= 1
    return if moving?
    return unless need_update(member)
    move = @move_update.shift
    eval(move) if move != nil
  end
  #--------------------------------------------------------------------------
  # * Check if need updade
  #     member : actor
  #--------------------------------------------------------------------------
  def need_update(member)
    return false if (member.x == @x and member.y == @y) 
    return false if player_distance(member) and not @start_moving
    return false if @move_update.empty?
    @start_moving = true
    if @move_update[0] == 'move_left'
      return false if (member.x + 1 == @x and member.y == @y)
    elsif @move_update[0] == 'move_right'
      return false if (member.x - 1 == @x and member.y == @y)
    elsif @move_update[0] == 'move_up'
      return false if (member.y + 1 == @y and member.x == @x)
    elsif @move_update[0] == 'move_down'
      return false if (member.y - 1 == @y and member.x == @x)
    elsif @move_update[0] == 'move_upper_left'
      return false if (member.x + 1 == @x and member.y + 1 == @y)
    elsif @move_update[0] == 'move_upper_right'
      return false if (member.x - 1 == @x and member.y + 1 == @y)
   elsif @move_update[0] == 'move_lower_left'
      return false if (member.x + 1 == @x and member.y - 1 == @y)
    elsif @move_update[0] == 'move_lower_right'
      return false if (member.x - 1 == @x and member.y - 1 == @y)
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Add move to update
  #     move : move option
  #--------------------------------------------------------------------------
  def add_move_update(move)
    member = $game_player.caterpillar[@member]
    if member != nil
      member.move_update << move
    end
  end
  #--------------------------------------------------------------------------
  # * Gather party
  #--------------------------------------------------------------------------
  def gather_party
    for i in 0...$game_party.actors.size
      move_toward_player
    end
    @x = $game_player.x
    @y = $game_player.y
    @move_update.clear
  end
  #--------------------------------------------------------------------------
  # * Move Down
  #     turn_enabled : a flag permits direction change on that spot
  #--------------------------------------------------------------------------
  def move_down(turn_enabled = true)
    @y += 1 if passable?(@x, @y, 2)
    turn_down if turn_enabled
    add_move_update('move_down')
  end
  #--------------------------------------------------------------------------
  # * Move Left
  #     turn_enabled : a flag permits direction change on that spot
  #--------------------------------------------------------------------------
  def move_left(turn_enabled = true)
    @x -= 1 if passable?(@x, @y, 4)
    turn_left  if turn_enabled
    add_move_update('move_left')
  end
  #--------------------------------------------------------------------------
  # * Move Right
  #     turn_enabled : a flag permits direction change on that spot
  #--------------------------------------------------------------------------
  def move_right(turn_enabled = true)
    @x += 1 if passable?(@x, @y, 6)
    turn_right if turn_enabled
    add_move_update('move_right')
  end
  #--------------------------------------------------------------------------
  # * Move Up
  #     turn_enabled : a flag permits direction change on that spot
  #--------------------------------------------------------------------------
  def move_up(turn_enabled = true)
    @y -= 1 if passable?(@x, @y, 8)
    turn_up if turn_enabled
    add_move_update('move_up')
  end
  #--------------------------------------------------------------------------
  # * Move Down-Left
  #--------------------------------------------------------------------------
  def move_lower_left
    if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
       (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
      @x -= 1
      @y += 1
    end
    turn_lower_left if $atoa_script['Atoa 8 Directions']
    add_move_update('move_lower_left')
  end
  #--------------------------------------------------------------------------
  # * Move Down-Right
  #--------------------------------------------------------------------------
  def move_lower_right
    if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
       (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
      @x += 1
      @y += 1
    end
    turn_lower_right if $atoa_script['Atoa 8 Directions']
    add_move_update('move_lower_right')
  end
  #--------------------------------------------------------------------------
  # * Move Up-Left
  #--------------------------------------------------------------------------
  def move_upper_left
    if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
       (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
      @x -= 1
      @y -= 1
    end
    turn_upper_left if $atoa_script['Atoa 8 Directions']
    add_move_update('move_upper_left')
  end
  #--------------------------------------------------------------------------
  # * Move Up-Right
  #--------------------------------------------------------------------------
  def move_upper_right
    if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
       (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
      @x += 1
      @y -= 1
    end
    turn_upper_right if $atoa_script['Atoa 8 Directions']
    add_move_update('move_upper_right')
  end
end
 
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc.
#  It's used within the Scene_Map class.
#==============================================================================
 
class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias ctbattle_initialize initialize
  def initialize
    ctbattle_initialize
    for caterpillar in $game_player.caterpillar.reverse
      sprite = Sprite_Character.new(@viewport1, caterpillar)
      @character_sprites.push(sprite)
    end
  end 
end
 
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
#  This class brings together battle screen sprites. It's used within
#  the Scene_Battle class.
#==============================================================================
 
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # * Set sprites
  #--------------------------------------------------------------------------
  alias ctbattle_set_sprites set_sprites
  def set_sprites
    if $game_temp.in_ct_battle
      @tilemap = Tilemap.new(@viewport2)
      @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
      for i in 0..6
        autotile_name = $game_map.autotile_names[i]
        @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
      end
      @tilemap.map_data = $game_map.data
      @tilemap.priorities = $game_map.priorities
      @panorama = Plane.new(@viewport2)
      @panorama.z = -1000
      @fog = Plane.new(@viewport2)
      @fog.z = 3000
      @character_sprites = []
      for i in $game_map.events.keys.sort
        sprite = Sprite_Character.new(@viewport2, $game_map.events[i])
        @character_sprites.push(sprite)
      end
    end
    ctbattle_set_sprites
  end
  #--------------------------------------------------------------------------
  # * Sprites update
  #--------------------------------------------------------------------------
  alias ctbattle_update_sprites update_sprites
  def update_sprites
    if $game_temp.in_ct_battle
      if @panorama_name != $game_map.panorama_name or
        @panorama_hue != $game_map.panorama_hue
        @panorama_name = $game_map.panorama_name
        @panorama_hue = $game_map.panorama_hue
        if @panorama.bitmap != nil
          @panorama.bitmap.dispose
          @panorama.bitmap = nil
        end
        if @panorama_name != ""
          @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
        end
        Graphics.frame_reset
      end
      if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
        @fog_name = $game_map.fog_name
        @fog_hue = $game_map.fog_hue
        if @fog.bitmap != nil
          @fog.bitmap.dispose
          @fog.bitmap = nil
        end
        if @fog_name != ""
          @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
        end
        Graphics.frame_reset
      end
      @tilemap.ox = $game_map.display_x / 4
      @tilemap.oy = $game_map.display_y / 4
      @tilemap.update
      @panorama.ox = $game_map.display_x / 8
      @panorama.oy = $game_map.display_y / 8
      @fog.zoom_x = $game_map.fog_zoom / 100.0
      @fog.zoom_y = $game_map.fog_zoom / 100.0
      @fog.opacity = $game_map.fog_opacity
      @fog.blend_type = $game_map.fog_blend_type
      @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
      @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
      @fog.tone = $game_map.fog_tone
    end
    ctbattle_update_sprites
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  alias ctbattle_dispose dispose
  def dispose
    if $game_temp.in_ct_battle
      @tilemap.tileset.dispose
      for i in 0..6
        @tilemap.autotiles[i].dispose
      end
      @tilemap.dispose
      @panorama.dispose
      @fog.dispose
    end
    ctbattle_dispose
  end
end
 
#==============================================================================
# ** Game_Troop
#------------------------------------------------------------------------------
#  This class deals with troops. Refer to "$game_troop" for the instance of
#  this class.
#==============================================================================
 
class Game_Troop
  #--------------------------------------------------------------------------
  # * Setup
  #     troop_id    : troop ID
  #     enemy_troop : enemies in troop
  #--------------------------------------------------------------------------
  alias ctbattle_setup setup
  def setup(troop_id, enemy_troop = nil)
    if enemy_troop.nil?
      ctbattle_setup(troop_id) unless $data_troops[troop_id].nil?
    else
      @enemies = []
      troop = $data_troops[troop_id]
      for i in 0...enemy_troop.size
        @enemies.push(Game_Enemy.new(troop_id, i, enemy_troop[i]))
      end
    end
  end
end
 
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
 
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :battler_character
  #--------------------------------------------------------------------------
  # * Get Battle Screen X-Coordinate
  #--------------------------------------------------------------------------
  alias ctbattle_screen_x screen_x
  def screen_x
    if self.index != nil and not $game_temp.battle_settings.empty?
      return $game_temp.actors_position[self.index][0]
    else
      return ctbattle_screen_x
    end
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen Y-Coordinate
  #--------------------------------------------------------------------------
  alias ctbattle_screen_y screen_y
  def screen_y
    if self.index != nil and not $game_temp.battle_settings.empty?
      return $game_temp.actors_position[self.index][1]
    else
      return ctbattle_screen_y
    end
  end
end
 
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
#  This class handles enemies. It's used within the Game_Troop class
#  ($game_troop).
#==============================================================================
 
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # * Set initial position
  #--------------------------------------------------------------------------
  def battler_position_setup
    if $game_temp.enemies_position[self.index] != nil
      base_x = $game_temp.enemies_position[self.index][0]
      base_y = $game_temp.enemies_position[self.index][1]
    else
      base_x = $data_troops[@troop_id].members[@member_index].x + Enemy_Position_AdjustX
      base_y = $data_troops[@troop_id].members[@member_index].y + Enemy_Position_AdjustY
    end
    @base_x = @original_x = @actual_x = @target_x = @initial_x = @hit_x = @damage_x = base_x
    @base_y = @original_y = @actual_y = @target_y = @initial_y = @hit_y = @damage_y = base_y
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen X-Coordinate
  #--------------------------------------------------------------------------
  def screen_x
    if $game_temp.enemies_position[self.index] != nil
      return $game_temp.enemies_position[self.index][0]
    else
      return $data_troops[@troop_id].members[@member_index].x + Enemy_Position_AdjustX
    end 
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen Y-Coordinate
  #--------------------------------------------------------------------------
  def screen_y
    if $game_temp.enemies_position[self.index] != nil
      return $game_temp.enemies_position[self.index][1]
    else
      return $data_troops[@troop_id].members[@member_index].y + Enemy_Position_AdjustY
    end
  end
end
 
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================
 
class Scene_Map
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    @spriteset = Spriteset_Map.new
    @message_window = Window_Message.new
    $game_player.refresh
    @in_ct_battle = false
    @battle_move = false
    if $game_temp.battle_end_transition
      set_screen_postion($game_temp.start_pos)
      Graphics.transition(0)
      wait(2)
      retutn_map_postions
      set_screen_postion($game_temp.start_pos, true)
      $game_temp.battle_end_transition = false
    else
      Graphics.transition
    end
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    @spriteset.dispose
    @message_window.dispose
    Graphics.transition if $scene.is_a?(Scene_Title)
    Graphics.freeze if $scene.is_a?(Scene_Title)
    $game_temp.in_ct_battle = true if @in_ct_battle
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias ctbattle_update update
  def update
    ctbattle_update
    if (Input.trigger?(Input::L) or Input.trigger?(Input::R)) and Allow_Reorder
      $game_system.se_play($data_system.decision_se)
      reorder_party(Input.trigger?(Input::L))
    end
    if $game_party.actors[0].dead?
      reorder_party(true)
    end
  end
  #--------------------------------------------------------------------------
  # * Reorder party
  #     invert : invert flag
  #--------------------------------------------------------------------------
  def reorder_party(invert)
    if invert
      party = $game_party.actors.shift
      $game_party.actors << party
    else
      party = $game_party.actors.pop
      $game_party.actors.unshift(party)
    end
    $game_player.refresh
  end
  #--------------------------------------------------------------------------
  # * Battle Call
  #--------------------------------------------------------------------------
  alias call_battle_ctbattle call_battle
  def call_battle
    $game_temp.battle_settings = []
    call_battle_ctbattle
  end
  #--------------------------------------------------------------------------
  # * Start map battle
  #     can_escape : can escape
  #     enemies    : enemies list
  #     start_pos  : start position
  #     end_pos    : end position
  #     escape_pos : escape position
  #     actors_pos : actors position
  #     can_lose   : can lose
  #     troop      : enemy troop
  #--------------------------------------------------------------------------
  def call_ct_battle(can_escape, enemies, start_pos, end_pos, escape_pos, actors_pos, can_lose = false, troop = 1)
    set_enemies(enemies)
    return if @enemy_party.empty?
    $game_temp.battle_can_escape = can_escape
    $game_temp.battle_can_lose = can_lose
    $game_temp.lock_map_postions = true
    $game_player.straighten
    $game_temp.battle_calling = $game_temp.menu_calling = $game_temp.menu_beep = false
    $game_temp.end_pos = end_pos
    $game_temp.escape_pos = escape_pos
    $game_temp.start_pos = start_pos
    set_screen_postion(start_pos)
    set_actor_postions(actors_pos)
    set_enemy_postions
    get_end_ecape_positions(end_pos, escape_pos)
    $game_temp.battle_settings = [$game_temp.enemy_troop, troop, @end_pos, @escape_pos]
    $scene = Scene_Battle.new
    @in_ct_battle = $game_temp.hide_windows = true
    prepare_for_battle
  end
  #--------------------------------------------------------------------------
  # * Set battle end positions
  #     end_pos    : battle end position
  #     escape_pos : escape end position
  #--------------------------------------------------------------------------
  def get_end_ecape_positions(end_pos, escape_pos)
    base_pos = [$game_player.x, $game_player.y]
    base_screen = [$game_player.screen_x, $game_player.screen_y]
    @end_pos = set_pos(base_pos, base_screen, end_pos)
    @escape_pos = set_pos(base_pos, base_screen, escape_pos)
  end
  #--------------------------------------------------------------------------
  # * Set positions
  #     base_pos    : map postion
  #     base_screen : screen position
  #     set_pos     : final position
  #--------------------------------------------------------------------------
  def set_pos(base_pos, base_screen, set_pos)
    diff_x = (base_screen[0] + ((set_pos[0] - base_pos[0]) * 32))
    diff_y = (base_screen[1] + ((set_pos[1] - base_pos[1]) * 32))
    return [diff_x, diff_y]
  end
  #--------------------------------------------------------------------------
  # * Set Screen positions
  #     start_pos : start position
  #     resetar   : restart position flag
  #--------------------------------------------------------------------------
  def set_screen_postion(start_pos, reset = false)
    position = reset ? [$game_player.x,$game_player.y] : start_pos 
    pos = set_screen_move_postion(position)
    set_screen(pos[0], $game_map.display_x, true)
    set_screen(pos[1], $game_map.display_y, false)
  end
  #--------------------------------------------------------------------------
  # * Set move position on screen
  #     pos : position
  #--------------------------------------------------------------------------
  def set_screen_move_postion(pos)
    max_x = ($game_map.width - 20) * 128
    max_y = ($game_map.height - 15) * 128
    pos_x = [0, [pos[0] * 128 - $game_player.center_x, max_x].min].max
    pos_y = [0, [pos[1] * 128 - $game_player.center_y, max_y].min].max
    return [pos_x, pos_y]
  end
  #--------------------------------------------------------------------------
  # * Set actor move position on screen
  #     pos : position
  #--------------------------------------------------------------------------
  def set_actors_screen_postion(pos)
    base_pos = [pos[0] - $game_player.x, pos[1] - $game_player.y]
    pos_x = $game_player.screen_x + (base_pos[0] * 32)
    pos_y = $game_player.screen_y + (base_pos[1] * 32)
    return [pos_x, pos_y]
  end
  #--------------------------------------------------------------------------
  # * Set screen position
  #     pos : initial position
  #     set : final position
  #     x   : direction
  #--------------------------------------------------------------------------
  def set_screen(pos, set, x)
    if pos != set
      dist = pos - set
      dir = dist > 0 ? (x ? 6 : 2) : (x ? 4 : 8)
      $game_map.battle_start_scroll(dir, dist.abs, 4)
    end
    update_scroll
  end
  #--------------------------------------------------------------------------
  # * Update screen scroll
  #--------------------------------------------------------------------------
  def update_scroll
    loop do
      update_basic(false, true, true)
      break unless $game_map.scrolling?
    end
    update_basic(false, true, true)
  end
  #--------------------------------------------------------------------------
  # * Wait time
  #     duration : wait duration in frames
  #--------------------------------------------------------------------------
  def wait(duration)
    for i in 0...duration
      update_basic(false, true, true)
    end
  end
  #--------------------------------------------------------------------------
  # * Set enemies
  #     enemies : enemy list
  #--------------------------------------------------------------------------
  def set_enemies(enemies)
    @enemy_party = []
    for i in 0...enemies.size
      next if $game_self_switches[[$game_map.map_id, enemies[i][0], 'D']] or 
        $game_map.events[enemies[i][0]].erased
      @enemy_party << enemies[i]
    end
  end
  #--------------------------------------------------------------------------
  # * Set enemies positions
  #--------------------------------------------------------------------------
  def set_enemy_postions
    $game_temp.enemies_position.clear
    $game_temp.enemy_troop.clear
    $game_temp.event_troop.clear
    for i in 0...@enemy_party.size
      x = $game_map.events[@enemy_party[i][0]].screen_x
      y = $game_map.events[@enemy_party[i][0]].screen_y
      $game_temp.enemies_position[i] = [x, y]
      $game_temp.event_troop[i] = @enemy_party[i][0]
      $game_temp.enemy_troop[i] = @enemy_party[i][1]
      $game_temp.event_delete[i] = @enemy_party[i][2]
    end
  end
  #--------------------------------------------------------------------------
  # * Set actors positions
  #     actor_pos : position
  #--------------------------------------------------------------------------
  def set_actor_postions(actors_pos)
    $game_temp.battle_move = true
    $game_temp.actors_start_position = []
    @moving_actors = []
    for i in 0...$game_party.actors.size
      $game_temp.actors_position[i] = set_actors_screen_postion(actors_pos[i])
      @moving_actors[i] = i == 0 ? $game_player : $game_player.caterpillar[i-1]
      @moving_actors[i].move_update.clear if i > 0
    end
    loop do
      for i in 0...$game_party.actors.size
        set_battle_position(@moving_actors[i], actors_pos[i])
        $game_temp.actors_position[i] = set_actors_screen_postion(actors_pos[i])
      end
      update_basic(false, true, true)
      break if all_in_postion(actors_pos)
    end
    $game_temp.battle_move = false
    wait(10)
  end
  #--------------------------------------------------------------------------
  # * Return to map positions
  #--------------------------------------------------------------------------
  def retutn_map_postions
    $game_temp.battle_move = true
    pos = $game_temp.battle_result == 1 ? $game_temp.escape_pos : $game_temp.end_pos
    @moving_actors = []
    for i in 0...$game_party.actors.size
      @moving_actors[i] = i == 0 ? $game_player : $game_player.caterpillar[i-1]
      @moving_actors[i].move_update.clear if i > 0
    end
    started_moving = false
    loop do
      if started_moving == true
        for i in 0...$game_party.actors.size
          set_battle_position(@moving_actors[i], @actors_pos[i])
        end
      else
        for i in 0...$game_party.actors.size
          set_battle_position(@moving_actors[i], pos)
        end
        @actors_pos = set_end_postion(pos)
      end
      started_moving = true
      update_basic(false, true, true)
      break if all_in_postion(@actors_pos)
    end
    set_plus_postion
    $game_temp.battle_move = false
    wait(10)
  end
  #--------------------------------------------------------------------------
  # * Set end position
  #     pos : position
  #--------------------------------------------------------------------------
  def set_end_postion(pos)
    actor_pos = []
    dir = $game_player.direction
    for i in 0...$game_party.actors.size
      if i == 0
        actor_pos[i] = pos
      else
        cat = $game_player.caterpillar[i - 1]
        case dir
        when 2 then actor_pos[i] = [pos[0], pos[1] - cat.member]
        when 4 then actor_pos[i] = [pos[0] + cat.member, pos[1]]
        when 6 then actor_pos[i] = [pos[0] - cat.member, pos[1]]
        when 8 then actor_pos[i] = [pos[0], pos[1] + cat.member]
        end
      end
    end
    return actor_pos
  end
  #--------------------------------------------------------------------------
  # * Set plus postion
  #--------------------------------------------------------------------------
  def set_plus_postion
    dir = $game_player.direction
    for cat in $game_player.caterpillar
      cat.move_update.clear
      cat.turn_toward_player
      case cat.direction
      when 2 then cat.move_update << 'move_down'
      when 4 then cat.move_update << 'move_left'
      when 6 then cat.move_update << 'move_right'
      when 8 then cat.move_update << 'move_up'
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Check if all in position
  #     actor_pos : actors position
  #--------------------------------------------------------------------------
  def all_in_postion(actors_pos)
    for i in 1...$game_party.actors.size
      actor = i == 0 ? $game_player : $game_player.caterpillar[i-1]
      return false if actors_pos[i] != [actor.x, actor.y]
    end
    return true
  end  
  #--------------------------------------------------------------------------
  # * Set battle postin
  #     actor : actor
  #     pos   : position
  #--------------------------------------------------------------------------
  def set_battle_position(actor, pos)
    return if actor.moving? or pos == [actor.x, actor.y]
    if actor.x == pos[0] and actor.y > pos[1]
      actor.y -= 1
      actor.turn_up
    elsif actor.x == pos[0] and actor.y < pos[1]
      actor.y += 1
      actor.turn_down
    elsif actor.x > pos[0] and actor.y == pos[1]
      actor.x -= 1
      actor.turn_left
    elsif actor.x < pos[0] and actor.y == pos[1]
      actor.x += 1
      actor.turn_right
    elsif actor.x < pos[0] and actor.y > pos[1]
      actor.turn_up
      actor.y -= 1
      actor.x += 1
    elsif actor.x > pos[0] and actor.y < pos[1]
      actor.turn_down
      actor.y += 1
      actor.x -= 1
    elsif actor.x > pos[0] and actor.y > pos[1]
      actor.turn_left
      actor.y -= 1
      actor.x -= 1
    elsif actor.x < pos[0] and actor.y < pos[1]
      actor.turn_right
      actor.y += 1
      actor.x += 1
    end
    actor.increase_steps
  end
  #--------------------------------------------------------------------------
  # * Prepare for battle
  #--------------------------------------------------------------------------
  def prepare_for_battle
    $game_player.straighten
    update_basic(false, true, true)
  end
end
 
 
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
 
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    unless $game_temp.battle_settings.empty?
      @enemies = $game_temp.battle_settings[0]
      @enemy_troop_id = $game_temp.battle_settings[1]
      @end_pos = $game_temp.battle_settings[2]
      @escape_pos = $game_temp.battle_settings[3]
      @hide_bars = true
    end
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  alias ctbattle_main main
  def main
    ctbattle_main
    $game_temp.in_ct_battle = false
    $game_temp.lock_map_postions = false
    $game_temp.battle_end_transition = true unless $game_temp.battle_settings.empty?
  end
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  alias ctbattle_start start
  def start
    ctbattle_start
    unless $game_temp.battle_settings.empty?
      $game_troop.setup(@enemy_troop_id, @enemies)
      @troop_id = @enemy_troop_id
    end
  end
  #--------------------------------------------------------------------------
  # * Create Display Viewport
  #--------------------------------------------------------------------------
  alias create_viewport_ctbattle create_viewport
  def create_viewport
    map_update
    for battler in $game_party.actors + $game_troop.enemies
      battler.battler_position_setup
    end
    create_viewport_ctbattle
  end
  #--------------------------------------------------------------------------
  # * Show transition
  #--------------------------------------------------------------------------
  alias show_transition_ctbattle show_transition
  def show_transition
    unless $game_temp.battle_settings.empty?
      Graphics.transition(0)
    else
      show_transition_ctbattle
    end
  end
  #--------------------------------------------------------------------------
  # * Update Map
  #--------------------------------------------------------------------------
  def map_update
    $game_map.update
    $game_player.update
  end
  #--------------------------------------------------------------------------
  # * Update Graphics
  #--------------------------------------------------------------------------
  alias ctbattle_update_graphics update_graphics
  def update_graphics
    map_update unless $game_temp.battle_settings.empty?
    ctbattle_update_graphics
  end
  #--------------------------------------------------------------------------
  # * Basic Update Processing
  #--------------------------------------------------------------------------
  alias ctbattle_update_basic update_basic
  def update_basic
    ctbattle_update_basic
    map_update unless $game_temp.battle_settings.empty?
  end
  #--------------------------------------------------------------------------
  # * Set intro battlecry
  #--------------------------------------------------------------------------
  alias ctbattle_set_intro set_intro
  def set_intro
    ctbattle_set_intro
    intro_finish
  end
  #--------------------------------------------------------------------------
  # * Process intro animation
  #--------------------------------------------------------------------------
  alias ctbattle_intro_anime intro_anime
  def intro_anime
    ctbattle_intro_anime
    wait(10)
    @battle_start = false
  end
  #--------------------------------------------------------------------------
  # * Finsish Intro
  #--------------------------------------------------------------------------
  def intro_finish
    unless $game_temp.battle_settings.empty?
      $game_temp.hide_windows = false
      @status_window.visible = true
      @status_window.update
      $game_temp.map_bgm = $game_system.playing_bgm
      $game_system.bgm_play($game_system.battle_bgm)
    end
  end
  #--------------------------------------------------------------------------
  # * Battle Ends
  #     result : results (0:win 1:escape 2:lose 3:abort)
  #--------------------------------------------------------------------------
  alias ctbattle_battle_end battle_end
  def battle_end(result)
    set_dead_enemies_self_switches
    ctbattle_battle_end(result)
    $game_temp.battle_result = result
    auto_revive if Auto_Revive and not $scene.is_a?(Scene_Gameover)
  end
  #--------------------------------------------------------------------------
  # * Set dead enemies self switches
  #--------------------------------------------------------------------------
  def set_dead_enemies_self_switches
    for i in 0...$game_temp.enemy_troop.size
      event_id = $game_temp.event_troop[i]
      delete = $game_temp.event_delete[i]
      enemy = $game_troop.enemies[i]
      if enemy != nil and enemy.dead? and delete
        key = [$game_map.map_id, event_id, 'D']
        $game_self_switches[key] = true
      elsif enemy != nil and enemy.dead? and not delete
        $game_map.events[event_id].erase
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Auto revive
  #--------------------------------------------------------------------------
  def auto_revive
    for actor in $game_party.actors
      actor.hp = 1 if actor != nil and actor.dead?
    end
  end
end
zum Lesen den Text mit der Maus markieren


Vielen dank schonmal :freunde:
Bild

Mitsch93

Drachentöter

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

2

Donnerstag, 6. November 2014, 15:03

Also nur, um das nochmal klarzustellen:
Dein Kampftutorial ist im Battle Event deiner Troop Nummer2?
Und dieses Battle Event wird bei jedem Kampf aufgerufen?

Laut der Beschreibung im Skript, ist der Parameter "Troop" nur dafür zuständig, welche Battle
Events in der Gruppe eingelesen werden.

Das heißt also, dass du den Parameter "Troop" (Kampfaufruf) bei anderen Gegnern ändern musst.

Konkret:
Bei deinem Tutorial musst du also Troop = 2 im Kampfaufruf einstellen.
Bei anderen Kämfen musst du aber eine andere Troop im Kampfaufruf angeben, da sonst auch bei diesen
Kämpfen das Battle Event aus Troop 2 aufgerufen wird.


Ich kenne das KS nicht genau, aber finde die Lösung logisch in Bezug auf dein Problem und deine Beschreibung.

3

Donnerstag, 6. November 2014, 17:12

Leider nicht ganz, wenn es gehen würde, dann müsste ich mich nicht an euch wenden :(
problem ist das eben nicht geht... oder ich verstehe einfach die anforderung falsch

troop: Enemy Troop on the database, used for in-battle events.
troop = enemy troop

Ich verstehe es so das ich
troop = 2
zb eingeben soll aber dann passiert ja nixweiter :(
Bild

Mitsch93

Drachentöter

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

4

Donnerstag, 6. November 2014, 17:15

Du verwirrst mich gerade ein wenig.
Wann und bei welcher Gruppe passiert jetzt was? Also welchen Aufruf verwendest du bei der
Gruppe, wo es geht.
Und bei welcher Gruppe SOLL es passieren?

5

Donnerstag, 6. November 2014, 17:22

sorry das ich mich so dumm ausdrücke :D

Es geht generell nicht, aber wenn ich im skript die Zeile 1095 bei troop = 2 einstelle anstatt troop =1 einstell geht es aber dann kommt bei jedem battle das Event von troop 2 :(

ich glaube fast die zeile definiert was getan werden soll, wenn nicht per Call Skript was anderes definiert wird aber das mit dem Call Skript klappt ja generell nicht da ist das Problem :(
Bild

Mitsch93

Drachentöter

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

6

Donnerstag, 6. November 2014, 17:31

Also das meine ich ja oben.

Laut Skript musst du folgenden Skriptbefehl ja vor jedem Kampf aufrufen.
(nicht IM Skript einstellen, sondern als Skriptbefehl (Event -> Seite 3 rechts unten).

Gucken wir uns den Skriptaufruf mal an:

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
can_escape = false
enemies = [[2,50,false]]
start_pos = [7,11]
end_pos = [7,11]
escape_pos = [7,11]
actors_pos = [[7,11]]
troop = 2
$scene.call_ct_battle(can_escape, 
enemies, start_pos, end_pos, 
escape_pos, actors_pos, troop)


Im Skript beschreibt der Autor den Parameter troop.
Dieser Parameter "sucht" dir die eingebene Troop heraus und führt die Eventbefehle dieser Troop dann aus.

Wenn du nun irgendwo diesen Parameter auf 2 setzt und nicht mehr auf einen anderen Wert setzt, wird in jedem
Kampf die Eventbefehle der Troop 2 ausgeführt.

Edit
Du hast ja gesagt, dass im Skript troop = 1 gesetzt wird.
Das ist nur der Fall, wenn du den Parameter troop im Skriptaufruf nicht explizit auf einen Wert
setzt. Wenn du so willst ist 1 also der default- Wert. Also eben der Wert, auf den troop gesetzt
wird, wenn nichts anderes angegeben ist.

7

Donnerstag, 6. November 2014, 18:00

Hab mal ein Bsp erstellt da kannstes ja mal selbst probieren :)
es geht ums verrecken einfach nicht :(
»Domster« hat folgende Datei angehängt:
Bild

Mitsch93

Drachentöter

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

8

Donnerstag, 6. November 2014, 19:01

Besser du schickst mir mal eine Demo von deinen aktuellen Projekt über PN.


Edit
Also es ist definitiv kein Skriptfehler.

Habe vor dem ersten Kampf folgende Aufruf getätigt:

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
$p1 = true
$p2 = [[1,12, false], [2,12, false], 
[3,12, false]]
$p3 = [22,24]
$p4 = [20,22]
$p5 = [14,22]
$p6 = [[20,21],[18,23],[23,20],
[24,21]]
$p7 = false
$scene.call_ct_battle($p1,$p2,$p3,
$p4,$p4,$p6,$p7)

Hier habe ich keine Troop angegeben, also wird der Default- Wert 1 benutzt.
Es kam der Aufruf, den ich in Troop 1 eingebaut habe.

Bei der nächsten Gruppe habe ich folgenden Aufruf getätigt:

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
$a1 = false
$a2 = [[21,13,true]]
$a3 = [40,24]
$a4 = [40,26]
$a5 = [35,32]
$a6 = [[41,28],[38,26],[44,26],
[43,27]]
$a7 = false
$scene.call_ct_battle($a1,$a2,$a3,
$a4,$a4,$a6,$a7,2)


Hier habe ich als Parameter Troop 2 angegeben, folglich wurde das Battle Event der Troop 2 aus der Database
aufgerufen und es klappte auch.

Fazit: Konnte keinen Fehler im Skript feststellen. Dein Aufruf muss fehlerhaft sein.

Zu deinem Platzproblem bei Call Script:
Würde die Kämpfe so aufrufen, wie ich es hier gemacht habe mit $p...
Übrigens brauchst du nicht für jeden Kampf die Parameter (also wie ich in Kampf 2 mit $a).
Das macht die Bedienung um einiges handlicher.

Wenn es bei dir immer noch nicht klappen sollte, poste mal Screenshots des Battle Events von Troop 1 und Troop 2
sowie deiner Kampfaufrufe (also die Call Script Befehle).

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Mitsch93« (6. November 2014, 19:01)


9

Donnerstag, 6. November 2014, 19:43

kannst du das nochmal mit dem Projekt posten :D weil jetzt check ichs nimmer aus :D wenn ich das jetzt als Call Skript mache kommt nurn fehler
^^
Bild

10

Donnerstag, 6. November 2014, 19:56

Was für ein Fehler? Vielleicht hast Du nich nur vertippt, zeig mal den Code im Event.

@Mitsch: Benutz besser lokale Variablen, statt globale (also lass das Dollarzeichen am Variablennamen weg). Du brauchst die Variablen nach dem Aufruf nicht, also ist es egal das sie verfallen. Die Werte, wie [[1,12, false], [2,12, false], [3,12, false]] dauerhaft bis Programmende im Speicher zu halten ist unnötig und unschön.
Also:

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
p1 = true
p2 = [[1,12, false], [2,12, false], 
[3,12, false]]
p3 = [22,24]
p4 = [20,22]
p5 = [14,22]
p6 = [[20,21],[18,23],[23,20],
[24,21]]
p7 = false
$scene.call_ct_battle(p1,p2,p3,
p4,p4,p6,p7)


Was auch gehen sollte, ohne Variablen den Aufruf:

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
$scene.call_ct_battle(
true, #can_escape
[[1,12, false],[2,12, false], 
               [3,12, false]],
[22,24],
[20,22],
[14,22],
[[20,21],[18,23],[23,20],
                  [24,21]],
false, #can_lose
2)


PS: Domsters Aufruf fehlt can_lose als Parameter übrigens. Vielleicht ist die Lösung so simpel.

Mitsch93

Drachentöter

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

11

Donnerstag, 6. November 2014, 20:39

Hier mal das Projekt.
Die beiden Stellen auf die du unbedingt drauflaufen musst für den Kampf sind
gräulich (der Schatten aus dem RTP). Aber wenn du die Events öffnest, siehst du es auch.

@Playm: Oh ja, das hätte ich machen können. Habe eben nicht mehr dran gedacht, weil ich erst
das ganze zentraler lösen wollte, so wie ich es mit den Quests bei mir im Projekt mache, bis mir eingefallen ist,
dass das bei dem Aufruf relativ sinnfrei ist.
Allerdings wird es wieder nötig, wenn man die Troops dabei packen will. Dafür benötigt man eine weitere Zeile, der es
an Platz mangelt.

@Doomster:

Also nochmal zur Erklärung:
Der Aufruf vor jedem Kampf lautet:

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
p1 = true
p2 = [[1,12, false], [2,12, false], 
[3,12, false]]
p3 = [22,24]
p4 = [20,22]
p5 = [14,22]
p6 = [[20,21],[18,23],[23,20],
[24,21]]
p7 = false
$scene.call_ct_battle(p1,p2,p3,
p4,p4,p6,p7)


Statt enemy, can_escape usw. habe ich die Parameter einfach p1 ... p7 genannt, um schonmal Platz zu sparen.
Wenn du noch die Troop als Parameter dabei haben willst, müsste es so aussehen:

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
p1 = true
p2 = [[1,12, false], [2,12, false], 
[3,12, false]]
p3 = [22,24]
p4 = [20,22]
p5 = [14,22]
p6 = [[20,21],[18,23],[23,20],
[24,21]]
p7 = false
p8 =2
$scene.call_ct_battle(p1,p2,p3,
p4,p4,p6,p7,p8)


Hier fangen aber die Platzprobleme an. Daher könntest du das mit zwei Scriptbefehlen lösen.
Der erste lautet:

Ruby Quellcode

1
$p8=2

Also $p8 die Nummer der Troop an.
Der zweite Scriptbefehl würde dann:

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
p1 = true
p2 = [[1,12, false], [2,12, false], 
[3,12, false]]
p3 = [22,24]
p4 = [20,22]
p5 = [14,22]
p6 = [[20,21],[18,23],[23,20],
[24,21]]
p7 = false
$scene.call_ct_battle(p1,p2,p3,
p4,p4,p6,p7,$p8)
»Mitsch93« hat folgende Datei angehängt:

12

Donnerstag, 6. November 2014, 21:09

Zitat

Hier fangen aber die Platzprobleme an.

In Ruby kann man mehrere Befehle in eine Zeile schreiben, wenn man sie durch Semikolon trennt:

Ruby Quellcode

1
p3=[22,24]; p4=[20,22]; p5=[14,22]


Wenn Du direkt alles ohne Variablen in den Methodenaufruf schreibst:

Ruby Quellcode

1
2
3
4
$scene.call_ct_battle( true,
 [[1,12,false],[2,12,false],[3,12,
 false]] , [22,24] , [20,22] ,[14,22],
....
wird es zwar unübersichtlicher, aber es sparrt viel Platz.

@Mitsch: Statt der globalen $p8 könnte man sich überlegen Werte in Game_Temp auszulagern, und das Skript dahingehend anzupassen.*

* Ja, ich bin sehr gegen diese globalen Variablen (und eine Instanzvariable finde ich zwar das kleinere Übel, aber immernoch ein Übel. Lieber lokal oder etwas ähnliches).

13

Freitag, 7. November 2014, 08:33

Danke euch beiden es klappt endlich alles so wie ich es will :)
Ich habe glück das es nicht an platz mangelt da ich maximal nur 3 Actor habe ^^
Spoiler

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
p1 = true
p2 = [[1,12, false], [2,12, false], 
[3,12, false]]
p3 = [22,24]
p4 = [20,22]
p5 = [14,22]
p6 = [[20,21],[18,23],[23,20]]
p7 = false
p8 = 2
$scene.call_ct_battle(p1,p2,p3,
p4,p4,p6,p7,p8)
zum Lesen den Text mit der Maus markieren

habe es jetzt bei meinem Kampf so geschrieben und es hat geklappt :)
Danke euch beiden für eure Zeit
dann lag es tatsächlich am fehlenden Can lose :epic:
:dance: :dance:
:cookie:

MFG Domster :cookie3:
Bild

Verwendete Tags

ATOA, KS, rmxp

Social Bookmarks