Day.png);">
Apprendre


Vous êtes
nouveau sur
Oniromancie?

Visite guidée
du site


Découvrir
RPG Maker


Apprendre
RPG Maker

Tutoriels
Guides
Making-of

Dans le
Forum

Section Entraide

Jeux: puie z / Jeux: Citymaime - Chapitre 1 / Jeux: Mer, îles et fous / News: Du neuf dans le making / News: Muma|Rope est disponible en (...) / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

571 connectés actuellement

30729186 visiteurs
depuis l'ouverture

2803 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

ConsoleFun

Lumen

New RPG Maker

Tous nos partenaires

Devenir
partenaire



A-RPG amélioré

Système de A-RPG avec des flèches à distance.

Script pour RPG Maker XP
Ecrit par Near Fantastica
Publié par MWAHAHA OLO MDR ! (lui envoyer un message privé)
Signaler un script cassé

❤ 0

Ce système d'A-RPG se divise en trois scripts, à insérer au-dessus de Main.

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#==============================================================================
# ■ Keyboard Input Module
#==============================================================================
 
module Keyboard
  #-----------------------------------------------------------
  @keys = []
  @pressed = []
  Mouse_Left = 1
  Mouse_Right = 2
  Back= 8
  Tab = 9
  Enter = 13
  Shift = 16
  Ctrl = 17
  Alt = 18
  Esc = 27
  Space = 32
  Numberkeys = {}
  Numberkeys[0] = 48
  Numberkeys[1] = 49
  Numberkeys[2] = 50
  Numberkeys[3] = 51
  Numberkeys[4] = 52
  Numberkeys[5] = 53
  Numberkeys[6] = 54
  Numberkeys[7] = 55
  Numberkeys[8] = 56
  Numberkeys[9] = 57
  Numberpad = {}
  Numberpad[0] = 45
  Numberpad[1] = 35
  Numberpad[2] = 40
  Numberpad[3] = 34
  Numberpad[4] = 37
  Numberpad[5] = 12
  Numberpad[6] = 39
  Numberpad[7] = 36
  Numberpad[8] = 38
  Numberpad[9] = 33
  Letters = {}
  Letters["A"] = 65
  Letters["B"] = 66
  Letters["C"] = 67
  Letters["D"] = 68
  Letters["E"] = 69
  Letters["F"] = 70
  Letters["G"] = 71
  Letters["H"] = 72
  Letters["I"] = 73
  Letters["J"] = 74
  Letters["K"] = 75
  Letters["L"] = 76
  Letters["M"] = 77
  Letters["N"] = 78
  Letters["O"] = 79
  Letters["P"] = 80
  Letters["Q"] = 81
  Letters["R"] = 82
  Letters["S"] = 83
  Letters["T"] = 84
  Letters["U"] = 85
  Letters["V"] = 86
  Letters["W"] = 87
  Letters["X"] = 88
  Letters["Y"] = 89
  Letters["Z"] = 90
  Fkeys = {}
  Fkeys[1] = 112
  Fkeys[2] = 113
  Fkeys[3] = 114
  Fkeys[4] = 115
  Fkeys[5] = 116
  Fkeys[6] = 117
  Fkeys[7] = 118
  Fkeys[8] = 119
  Fkeys[9] = 120
  Fkeys[10] = 121
  Fkeys[11] = 122
  Fkeys[12] = 123
  Collon = 186
  Equal = 187
  Comma = 188
  Underscore = 189
  Dot = 190
  Backslash = 191
  Lb = 219
  Rb = 221
  Quote = 222
  State = Win32API.new("user32","GetKeyState",['i'],'i')
  Key = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
  #--------------------------------------------------------------------------  
  def Keyboard.getstate(key)
    return true unless State.call(key).between?(0, 1)
    return false
  end
  #--------------------------------------------------------------------------
  def Keyboard.testkey(key)
    Key.call(key) & 0x01 == 1
  end
  #--------------------------------------------------------------------------
  def Keyboard.update
    @keys = []
    @keys.push(Keyboard::Mouse_Left) if Keyboard.testkey(Keyboard::Mouse_Left)
    @keys.push(Keyboard::Mouse_Right) if Keyboard.testkey(Keyboard::Mouse_Right)
    @keys.push(Keyboard::Back) if Keyboard.testkey(Keyboard::Back)
    @keys.push(Keyboard::Tab) if Keyboard.testkey(Keyboard::Tab)
    @keys.push(Keyboard::Enter) if Keyboard.testkey(Keyboard::Enter)
    @keys.push(Keyboard::Shift) if Keyboard.testkey(Keyboard::Shift)
    @keys.push(Keyboard::Ctrl) if Keyboard.testkey(Keyboard::Ctrl)
    @keys.push(Keyboard::Alt) if Keyboard.testkey(Keyboard::Alt)
    @keys.push(Keyboard::Esc) if Keyboard.testkey(Keyboard::Esc)
    @keys.push(Keyboard::Space) if Keyboard.testkey(Keyboard::Space)
    for key in Keyboard::Numberkeys.values
      @keys.push(key) if Keyboard.testkey(key)
    end
    for key in Keyboard::Numberpad.values
      @keys.push(key) if Keyboard.testkey(key)
    end
    for key in Keyboard::Letters.values
      @keys.push(key) if Keyboard.testkey(key)
    end
    for key in Keyboard::Fkeys.values
      @keys.push(key) if Keyboard.testkey(key)
    end
    @keys.push(Keyboard::Collon) if Keyboard.testkey(Keyboard::Collon)
    @keys.push(Keyboard::Equal) if Keyboard.testkey(Keyboard::Equal)
    @keys.push(Keyboard::Comma) if Keyboard.testkey(Keyboard::Comma)
    @keys.push(Keyboard::Underscore) if Keyboard.testkey(Keyboard::Underscore)
    @keys.push(Keyboard::Bot) if Keyboard.testkey(Keyboard::Bot)
    @keys.push(Keyboard::Backslash) if Keyboard.testkey(Keyboard::Backslash)
    @keys.push(Keyboard::Lb) if Keyboard.testkey(Keyboard::Lb)
    @keys.push(Keyboard::Rb) if Keyboard.testkey(Keyboard::Rb)
    @keys.push(Keyboard::Quote) if Keyboard.testkey(Keyboard::Quote)
    @pressed = []
    @pressed.push(Keyboard::Mouse_Left) if Keyboard.getstate(Keyboard::Mouse_Left)
    @pressed.push(Keyboard::Mouse_Right) if Keyboard.getstate(Keyboard::Mouse_Right)
    @pressed.push(Keyboard::Back) if Keyboard.getstate(Keyboard::Back)
    @pressed.push(Keyboard::Tab) if Keyboard.getstate(Keyboard::Tab)
    @pressed.push(Keyboard::Enter) if Keyboard.getstate(Keyboard::Enter)
    @pressed.push(Keyboard::Shift) if Keyboard.getstate(Keyboard::Shift)
    @pressed.push(Keyboard::Ctrl) if Keyboard.getstate(Keyboard::Ctrl)
    @pressed.push(Keyboard::Alt) if Keyboard.getstate(Keyboard::Alt)
    @pressed.push(Keyboard::Esc) if Keyboard.getstate(Keyboard::Esc)
    @pressed.push(Keyboard::Space) if Keyboard.getstate(Keyboard::Space)
    for key in Keyboard::Numberkeys.values
      @pressed.push(key) if Keyboard.getstate(key)
    end
    for key in Keyboard::Numberpad.values
      @pressed.push(key) if Keyboard.getstate(key)
    end
    for key in Keyboard::Letters.values
      @pressed.push(key) if Keyboard.getstate(key)
    end
    for key in Keyboard::Fkeys.values
      @pressed.push(key) if Keyboard.getstate(key)
    end
    @pressed.push(Keyboard::Collon) if Keyboard.getstate(Keyboard::Collon)
    @pressed.push(Keyboard::Equal) if Keyboard.getstate(Keyboard::Equal)
    @pressed.push(Keyboard::Comma) if Keyboard.getstate(Keyboard::Comma)
    @pressed.push(Keyboard::Underscore) if Keyboard.getstate(Keyboard::Underscore)
    @pressed.push(Keyboard::Bot) if Keyboard.getstate(Keyboard::Bot)
    @pressed.push(Keyboard::Backslash) if Keyboard.getstate(Keyboard::Backslash)
    @pressed.push(Keyboard::Lb) if Keyboard.getstate(Keyboard::Lb)
    @pressed.push(Keyboard::Rb) if Keyboard.getstate(Keyboard::Rb)
    @pressed.push(Keyboard::Quote) if Keyboard.getstate(Keyboard::Quote)  
  end
  #--------------------------------------------------------------------------
  def Keyboard.trigger?(key)
    return true if @keys.include?(key)
    return false
  end
  #--------------------------------------------------------------------------
  def Keyboard.pressed?(key)
    return true if @pressed.include?(key)
    return false
  end
end



Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
#==============================================================================
# ■ Action Battle System
#==============================================================================
#  By: Near Fantastica
#  Date: 03.10.05
#  Version: 4
#==============================================================================
# ■ ABS Key Commands
#==============================================================================
#   A    ● Dash
#   S    ● Sneak
#   D     ● Attack
#   1    ● Skill Key 1
#   2    ● Skill Key 2
#   3    ● Skill Key 3
#   4    ● Skill Key 4
#   5    ● Skill Key 5
#   6    ● Skill Key 6
#   7    ● Skill Key 7
#   8    ● Skill Key 8
#   9    ● Skill Key 9
#   0    ● Skill Key 0
#==============================================================================
# ■ ABS Enemy Ai List
#==============================================================================
#   Name
#   Name Of the Enemy in The Data Base
#---------------------------------------------------------------------------
#   Behavior
#   Passive = 0 ● The Event (Enemy) will only attack when attacked
#   Aggressive = 1 ● The Event will attack when one of its Detection level are set true
#   Linking = 2 ● Event will only attack when another Event is attacked with in its Detection level
#   Aggressive Linking = 3 ● Event will attack when either Aggressive or Linking is true
#---------------------------------------------------------------------------
#   Detection
#   Sound = range ● The range of sound the enemy can hear inactive if set to zero
#   Sight = range ● The range of sightthe enemy can see inactive if set to zero
#---------------------------------------------------------------------------
#   Aggressiveness
#   Aggressiveness = Level ● The high number the less Aggressive the Event
#---------------------------------------------------------------------------
#   Movement
#   Speed = Level ● The movment Speed of the event when engaged
#   Frequency = Level  ● The movment Frequency of the event when engaged 
#---------------------------------------------------------------------------
#   Trigger
#   Erased = 0  ● The event will be erased on death
#   Switch = 1  ● The event will be trigger Switch[ID] on death
#   Varible = 2  ● The event will be set the Varible[ID] = VALUE on death
#   Local Switch = 3 ● The event will trigger Local_Switch[ID] on death
#==============================================================================
# ■ ABS Range Constant
#==============================================================================
#   RANGE_WEAPONS[Weapon Id] = 
#   ["Character Set Name", Ammo Speed, Anmiation Id, Ammo Item Id, Range]
#   RANGE_SKILLS[Skill Id] = 
#   [Range, Ammo Speed, "Character Set Name"]
#==============================================================================
class ABS
  #--------------------------------------------------------------------------
  RANGE_WEAPONS = {}
  RANGE_WEAPONS[17] = ["Arrow", 5, 4, 33, 10]
  RANGE_WEAPONS[18] = ["Arrow", 5, 4, 33, 10]
  RANGE_WEAPONS[19] = ["Arrow", 5, 4, 33, 10]
  RANGE_WEAPONS[20] = ["Arrow", 5, 4, 33, 10]
  #--------------------------------------------------------------------------
  RANGE_SKILLS = {}
  RANGE_SKILLS[7] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[8] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[10] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[11] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[13] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[14] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[16] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[17] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[19] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[20] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[22] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[23] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[25] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[26] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[28] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[29] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[31] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[33] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[35] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[37] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[39] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[41] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[43] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[45] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[47] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[49] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[51] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[57] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[58] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[59] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[60] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[61] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[62] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[63] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[64] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[65] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[66] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[67] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[68] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[69] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[70] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[71] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[72] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[73] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[74] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[75] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[76] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[77] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[78] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[79] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[80] = [1, 5, "Magic Balls"]
  #--------------------------------------------------------------------------
  DASH_KEY = Keyboard::Letters["A"]
  SNEAK_KEY = Keyboard::Letters["S"]
  ATTACK_KEY = Keyboard::Letters["D"]
  SKILL_KEYS = Keyboard::Numberkeys
  #--------------------------------------------------------------------------
  attr_accessor :enemies
  attr_accessor :range
  attr_accessor :skills
  attr_accessor :dash_level
  attr_accessor :sneak_level
  #--------------------------------------------------------------------------
  def initialize
    # Enemies
    @enemies = {}
    # Range
    @range = []
    # Skills
    @skills = []
    # Dashing
    @dashing = false
    @dash_restore = false
    @dash_reduce= false
    @dash_timer = 0
    @dash_level = 5
    @dash_sec = 0
    # Sneaking
    @sneaking = false
    @sneak_restore = false
    @sneak_reduce= false
    @sneak_timer = 0
    @sneak_level = 5
    @sneak_sec = 0
    # Button Mashing
    @mash_bar = 0
  end
  #--------------------------------------------------------------------------
  def ATTACK_KEY
    return ATTACK_KEY
  end
  #--------------------------------------------------------------------------
  def SKILL_KEYS
    return SKILL_KEYS
  end
  #--------------------------------------------------------------------------
  def RANGE_WEAPONS
    return RANGE_WEAPONS
  end
  #--------------------------------------------------------------------------
  def RANGE_SKILLS
    return RANGE_SKILLS
  end
  #--------------------------------------------------------------------------
  def refresh(event, list, character_name)
    @enemies.delete(event.id)
    return if character_name == ""
    return if list == nil
    for i in 0...list.size
      if list[i].code == 108 and list[i].parameters == ["ABS Event Command List"]
        name = list[i+1].parameters[0].split
        for x in 1...$data_enemies.size
          enemy = $data_enemies[x]
          if name[1].upcase == enemy.name.upcase
            @enemies[event.id] = Game_ABS_Enemy.new(enemy.id)
            @enemies[event.id].event_id = event.id
            default_setup(event.id)
            level = list[i+2].parameters[0].split
            @enemies[event.id].level = level[1].to_i
            behavior = list[i+3].parameters[0].split
            @enemies[event.id].behavior = behavior[1].to_i
            sound = list[i+4].parameters[0].split
            @enemies[event.id].detection_sound = sound[1].to_i
            sight = list[i+5].parameters[0].split
            @enemies[event.id].detection_sight = sight[1].to_i
            aggressiveness = list[i+6].parameters[0].split
            @enemies[event.id].aggressiveness = aggressiveness[1].to_i
            speed = list[i+7].parameters[0].split
            @enemies[event.id].speed = speed[1].to_i
            frequency = list[i+8].parameters[0].split
            @enemies[event.id].frequency = frequency[1].to_i
            trigger = list[i+9].parameters[0].split
            @enemies[event.id].trigger= [trigger[1].to_i, trigger[2].to_i, trigger[3].to_i]
          end
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def default_setup(id)
    @enemies[id].level = 1
    @enemies[id].behavior = 1
    @enemies[id].detection_sight = 1
    @enemies[id].detection_sound = 4
    @enemies[id].aggressiveness = 2
    @enemies[id].engaged = false
    @enemies[id].speed = 4
    @enemies[id].frequency = 5
  end
  #--------------------------------------------------------------------------
  def update
    update_dash if @sneaking == false 
    update_sneak if @dashing == false
    update_enemies
    update_player
    update_range
    Graphics.frame_reset
  end
  #--------------------------------------------------------------------------
  def update_range
    for range in @range
      range.update
    end
  end
  #--------------------------------------------------------------------------
  def update_player
    actor = $game_party.actors[0]
    @mash_bar = 100 if @mash_bar >= 100
    @mash_bar += 1 #(actor.dex/10)
  end
  #--------------------------------------------------------------------------
  def update_dash
    if Keyboard.pressed?(DASH_KEY)
      if $game_player.moving?
        @dashing = true
        $game_player.move_speed = 5
        @dash_restore = false
        if @dash_reduce == false
          @dash_timer = 50 # Initial time off set
          @dash_reduce = true
        else
          @dash_timer-= 1
        end
        @dash_sec = (@dash_timer / Graphics.frame_rate)%60
        if @dash_sec == 0
          if @dash_level != 0
            @dash_level -= 1
            @dash_timer = 50 # Timer Count
          end
        end
        if @dash_level == 0
          @dashing = false
          $game_player.move_speed = 4
        end
      end
    else
      @dashing = false
      $game_player.move_speed = 4
      @dash_reduce = false
      if @dash_restore == false
        @dash_timer = 80 # Initial time off set
        @dash_restore = true
      else
        @dash_timer-= 1
      end
      @dash_sec = (@dash_timer / Graphics.frame_rate)%60
      if @dash_sec == 0
        if @dash_level != 5
          @dash_level+= 1
          @dash_timer = 60
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def update_sneak
    if Keyboard.pressed?(SNEAK_KEY)
      if $game_player.moving?
        @sneaking = true
        $game_player.move_speed = 3
        @sneak_restore = false
        if @sneak_reduce == false
          @sneak_timer = 50 # Initial time off set
          @sneak_reduce = true
        else
          @sneak_timer-= 1
        end
        @sneak_sec = (@sneak_timer / Graphics.frame_rate)%60
        if @sneak_sec == 0
          if @sneak_level != 0
            @sneak_level -= 1
            @sneak_timer = 100 # Timer Count
          end
        end
        if @sneak_level == 0
          @sneaking = false
          $game_player.move_speed = 4
        end
      end
    else
      @sneaking = false
      $game_player.move_speed = 4
      @sneak_reduce = false
      if @sneak_restore == false
        @sneak_timer = 80 # Initial time off set
        @sneak_restore = true
      else
        @sneak_timer-= 1
      end
      @sneak_sec = (@sneak_timer / Graphics.frame_rate)%60
      if @sneak_sec == 0
        if @sneak_level != 5
          @sneak_level+= 1
          @sneak_timer = 60 # Timer Count
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def update_enemies
    for enemy in @enemies.values
      case enemy.behavior
      when 0
        if enemy.engaged == true
          next if engaged_enemy_detection_sight?(enemy) == true
          next if engaged_enemy_detection_sound?(enemy) == true
        end
      when 1
        if enemy.engaged == true
          next if engaged_enemy_detection_sight?(enemy) == true
          next if engaged_enemy_detection_sound?(enemy) == true
        else
          next if enemy_detection_sight?(enemy) == true
          next if enemy_detection_sound?(enemy) == true
        end
      when 2
        if enemy.engaged == true
          next if engaged_enemy_linking_sight?(enemy) == true
          next if engaged_enemy_linking_sound?(enemy) == true
        else
          next if enemy_linking?(enemy) == true
        end
      when 3
        if enemy.engaged == true
          next if engaged_enemy_linking_sight?(enemy) == true
          next if engaged_enemy_linking_sound?(enemy) == true
        else
          next if enemy_detection_sight?(enemy) == true
          next if enemy_detection_sound?(enemy) == true
          next if enemy_linking?(enemy) == true
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def set_event_movement(enemy)
    event = $game_map.events[enemy.event_id]
    enemy.move_type = event.move_type
    enemy.move_frequency = event.move_frequency
    enemy.move_speed = event.move_speed
    enemy.engaged = true
    event.move_type = 2
    event.move_frequency = enemy.frequency 
    event.move_speed = enemy.speed
  end
  #--------------------------------------------------------------------------
  def return_event_movement(enemy)
    event = $game_map.events[enemy.event_id]
    event.move_type = enemy.move_type
    event.move_frequency = enemy.move_frequency
    event.move_speed = enemy.move_speed
  end
  #--------------------------------------------------------------------------
  def engaged_enemy_linking_sight?(enemy)
    if enemy.detection_sight != 0
      if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sight)
        enemy.linking = false
        enemy_attack(enemy)
        return true
      else
        if enemy.linking == false
          enemy.engaged = false
          return_event_movement(enemy)
          return false
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def engaged_enemy_linking_sound?(enemy)
    if enemy.detection_sound != 0
      if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sound)
        enemy.linking = false
        enemy_attack(enemy)
        return true
      else
        if enemy.linking == false
          enemy.engaged = false
          return_event_movement(enemy)
          return false
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def enemy_linking?(enemy)
    for key in @enemies.keys
      if in_range?($game_map.events[enemy.event_id], $game_map.events[key], enemy.detection_sight)
        if @enemies[key].engaged == true
          enemy.engaged = true
          enemy.linking = true
          set_event_movement(enemy)
          return true
        end
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  def enemy_detection_sound?(enemy)
    if enemy.detection_sound != 0
      return false if enemy.level < $game_party.actors[0].level
      if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sound)
        if @sneaking == true
          return false
        end
        enemy.engaged = true
        set_event_movement(enemy)
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  def enemy_detection_sight?(enemy)
    if enemy.detection_sight != 0
      return false if enemy.level < $game_party.actors[0].level
      if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sight)
        if facing?($game_map.events[enemy.event_id], $game_player)
          enemy.engaged = true
          set_event_movement(enemy)
          return true
        end
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  def engaged_enemy_detection_sight?(enemy)
    if enemy.detection_sight != 0
      if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sight)
        enemy_attack(enemy)
        return true
      else
        enemy.engaged = false
        return_event_movement(enemy)
        return false
      end
    end
  end
  #--------------------------------------------------------------------------
  def engaged_enemy_detection_sound?(enemy)
    if enemy.detection_sound != 0
      if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sound)
        enemy_attack(enemy)
        return true
      else
        enemy.engaged = false
        return_event_movement(enemy)
        return false
      end
    end
  end
  #--------------------------------------------------------------------------
  def in_range?(element, object, range)
    x = (element.x - object.x) * (element.x - object.x)
    y = (element.y - object.y) * (element.y - object.y)
    r = x + y
    if r <= (range * range)
       return true
    else
      return false
    end
  end
  #--------------------------------------------------------------------------
  def in_range(element, range)
    objects = []
    x = (element.x - $game_player.x) * (element.x - $game_player.x)
    y = (element.y - $game_player.y) * (element.y - $game_player.y)
    r = x + y
    if r <= (range * range)
      objects.push($game_party.actors[0])
    end
    return objects
  end
  #--------------------------------------------------------------------------
  def facing?(element, object)
    if element.direction == 2
      if object.y >= element.y
        return true
      end
    end
    if element.direction == 4
      if object.x <= element.x
        return true
      end
    end
    if element.direction == 6
      if object.x  >= element.x
        return true
      end
    end
    if element.direction == 8
      if object.y <= element.y
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  def in_line?(element, object)
    if element.direction == 2
      if object.x == element.x
        return true
      end
    end
    if element.direction == 4
      if object.y == element.y
        return true
      end
    end
    if element.direction == 6
      if object.y == element.y
        return true
      end
    end
    if element.direction == 8
      if object.x == element.x
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  def enemy_pre_attack(enemy, actions)
    if enemy.hp * 100.0 / enemy.maxhp > actions.condition_hp
      return true
    end
    if $game_party.max_level < actions.condition_level
      return true
    end
    switch_id = actions.condition_switch_id
    if actions.condition_switch_id > 0 and $game_switches[switch_id] == false
      return true
    end
    n = rand(11) 
    if actions.rating < n
      return true
    end
    return false
  end
  #--------------------------------------------------------------------------
  def hit_player(enemy)
    $game_player.jump(0, 0)
    $game_player.animation_id = enemy.animation2_id
  end
  #--------------------------------------------------------------------------
  def actor_non_dead?(actor, enemy)
    if actor.dead?
      if not enemy.is_a?(Game_Actor)
        return_event_movement(enemy)
        enemy.engaged = false
      end
      $game_temp.gameover = true
      return false
    end
    return true
  end
  #--------------------------------------------------------------------------
  def enemy_attack(enemy)
    for actions in enemy.actions
      next if enemy_pre_attack(enemy, actions) == true
      case actions.kind
      when 0 #Basic
        if Graphics.frame_count % (enemy.aggressiveness * 30) == 0          
          case actions.basic
          when 0 #Attack
            if in_range?($game_map.events[enemy.event_id], $game_player, 1) and 
            facing?($game_map.events[enemy.event_id], $game_player)
              actor = $game_party.actors[0]
              actor.attack_effect(enemy)
              if $game_party.actors[0].damage != "Miss" and $game_party.actors[0].damage != 0
                hit_player(enemy)
              end
              actor_non_dead?(actor, enemy)
              return
            end
          when 1..3 #Nothing
            return
          end
        end
      when 1..2#Skill
        skill = $data_skills[actions.skill_id]
        case skill.scope
        when 1 # One Enemy
          if Graphics.frame_count % (enemy.aggressiveness * 30) == 0
            if in_line?($game_map.events[enemy.event_id], $game_player)
              next if enemy.can_use_skill?(skill) == false
              @range.push(Game_Ranged_Skill.new($game_map.events[enemy.event_id], enemy, skill))
              enemy.sp -= skill.sp_cost
            end
          end
        when 3..4, 7 # User          
          if Graphics.frame_count % (enemy.aggressiveness * 100) == 0
            if enemy.hp < skill.power.abs
              enemy.effect_skill(enemy, skill)
              enemy.sp -= skill.sp_cost
              $game_map.events[enemy.event_id].animation_id = skill.animation2_id
            end
            return
          end
        end
        return
      end
    end
  else
    return
  end
  #--------------------------------------------------------------------------
  def hit_event(event, animation)
    event.jump(0, 0)
    return if animation == 0
    event.animation_id = animation
  end
  #--------------------------------------------------------------------------
  def event_non_dead?(enemy, actor = 0)
    if enemy.dead?
      treasure(enemy) if actor = 0
      id = enemy.event_id
      @enemies.delete(id)
      event = $game_map.events[enemy.event_id]
      event.character_name = ""
      case enemy.trigger[0]
      when 0
        event.erase
      when 1
        print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
        $game_switches[enemy.trigger[1]] = true
        $game_map.need_refresh = true
      when 2
        print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
         if enemy.trigger[2] == 0
           $game_variables[enemy.trigger[1]] += 1
          $game_map.need_refresh = true
        else
          $game_variables[enemy.trigger[1]] = enemy.trigger[2]
          $game_map.need_refresh = true
        end
      when 3
        value = "A" if enemy.trigger[1] == 1
        value = "B" if enemy.trigger[1] == 2
        value = "C" if enemy.trigger[1] == 3
        value = "D" if enemy.trigger[1] == 4
        print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if value == 0
        key = [$game_map.map_id, event.id, value]
        $game_self_switches[key] = true
        $game_map.need_refresh = true
      end
      return false
    end
    return true
  end
  #--------------------------------------------------------------------------
  def treasure(enemy)
    exp = 0
    gold = 0
    treasures = []
    unless enemy.hidden
      exp += enemy.exp
      gold += enemy.gold
      if rand(100) < enemy.treasure_prob
        if enemy.item_id > 0
          treasures.push($data_items[enemy.item_id])
        end
        if enemy.weapon_id > 0
          treasures.push($data_weapons[enemy.weapon_id])
        end
        if enemy.armor_id > 0
          treasures.push($data_armors[enemy.armor_id])
        end
      end
    end
    treasures = treasures[0..5]
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          actor.hp = actor.maxhp
          actor.sp = actor.maxsp
        end
      end
    end
    $game_party.gain_gold(gold)
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
  end
  #--------------------------------------------------------------------------
  def player_attack
    actor = $game_party.actors[0]
    if RANGE_WEAPONS.has_key?(actor.weapon_id) 
      # Range Attack
      range_weapon = RANGE_WEAPONS[actor.weapon_id]
      return if $game_party.item_number(range_weapon[3]) == 0
      $game_party.lose_item(range_weapon[3], 1)
      @range.push(Game_Ranged_Weapon.new($game_player, actor, actor.weapon_id))
    else
      # Test Button Mash
      hit = rand(90) + 10 
      if hit > @mash_bar
        @mash_bar = 0
        return
      end
      @mash_bar = 0
      # Melee Attack
      for enemy in @enemies.values
        event = $game_map.events[enemy.event_id]
        if facing?($game_player, event) and in_range?($game_player, event, 1)
          actor = $game_party.actors[0]
          enemy.attack_effect(actor)
          hit_event(event, $data_weapons[actor.weapon_id].animation2_id) if enemy.damage != "Miss" and enemy.damage != 0
          if event_non_dead?(enemy)
            if enemy.engaged == false
              enemy.engaged = true
              set_event_movement(enemy)
            end
          end
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def player_skill(key)
    return if @skills[key] == nil
    skill = $data_skills[@skills[key]]
    return if skill == nil
    actor = $game_party.actors[0]
    return if not actor.skills.include?(skill.id)
    return if actor.can_use_skill?(skill) == false
    case skill.scope
    when 1 # One Enemy
      @range.push(Game_Ranged_Skill.new($game_player, actor, skill))
      actor.sp -= skill.sp_cost
    when 2 # All Emenies
      $game_player.animation_id = skill.animation2_id
      actor.sp -= skill.sp_cost
      for enemy in @enemies.values
        next if enemy == nil
        enemy.effect_skill(actor, skill)
        if enemy.damage != "Miss" and enemy.damage != 0
          event = $game_map.events[enemy.event_id]
          hit_event(event, 0)
        end
        if event_non_dead?(enemy)
          if enemy.engaged == false
            enemy.behavior = 3
            enemy.linking = true
            enemy.engaged = true
            set_event_movement(enemy)
          end
        end
      end
      return
    when 3..4, 7 # User
      return if actor.can_use_skill?(skill) == false
      actor.effect_skill(actor, skill)
      actor.sp -= skill.sp_cost
      $game_player.animation_id = skill.animation2_id
      return
    end
  end
end



Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
#============================================================================
# ■ Game ABS Enemy
#============================================================================
 
class Game_ABS_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  attr_accessor :event_id
  attr_accessor :level
  attr_accessor :behavior
  attr_accessor :detection_sight
  attr_accessor :detection_sound
  attr_accessor :aggressiveness
  attr_accessor :trigger
  attr_accessor :speed
  attr_accessor :frequency
  attr_accessor :engaged
  attr_accessor :linking
  attr_accessor :move_type
  attr_accessor :move_frequency
  attr_accessor :move_speed
  attr_accessor :ranged
  #--------------------------------------------------------------------------
  def initialize(enemy_id)
    super()
    @event_id= 0
    @level = 0
    @behavior = 0
    @detection_sight = 0
    @detection_sound = 0
    @aggressiveness = 1
    @trigger = []
    @enemy_id = enemy_id
    @engaged = false
    @linking = false
    @speed = 0
    @frequency = 0
    @move_type = 0
    @move_frequency = 0
    @move_speed = 0
    @hp = maxhp
    @sp = maxsp
  end
  #--------------------------------------------------------------------------
  def id
    return @enemy_id
  end
  #--------------------------------------------------------------------------
  def index
    return @member_index
  end
  #--------------------------------------------------------------------------
  def name
    return $data_enemies[@enemy_id].name
  end
  #--------------------------------------------------------------------------
  def base_maxhp
    return $data_enemies[@enemy_id].maxhp
  end
  #--------------------------------------------------------------------------
  def base_maxsp
    return $data_enemies[@enemy_id].maxsp
  end
  #--------------------------------------------------------------------------
  def base_str
    return $data_enemies[@enemy_id].str
  end
  #--------------------------------------------------------------------------
  def base_dex
    return $data_enemies[@enemy_id].dex
  end
  #--------------------------------------------------------------------------
  def base_agi
    return $data_enemies[@enemy_id].agi
  end
  #--------------------------------------------------------------------------
  def base_int
    return $data_enemies[@enemy_id].int
  end
  #--------------------------------------------------------------------------
  def base_atk
    return $data_enemies[@enemy_id].atk
  end
  #--------------------------------------------------------------------------
  def base_pdef
    return $data_enemies[@enemy_id].pdef
  end
  #--------------------------------------------------------------------------
  def base_mdef
    return $data_enemies[@enemy_id].mdef
  end
  #--------------------------------------------------------------------------
  def base_eva
    return $data_enemies[@enemy_id].eva
  end
  #--------------------------------------------------------------------------
  def animation1_id
    return $data_enemies[@enemy_id].animation1_id
  end
  #--------------------------------------------------------------------------
  def animation2_id
    return $data_enemies[@enemy_id].animation2_id
  end
  #--------------------------------------------------------------------------
  def element_rate(element_id)
    table = [0,200,150,100,50,0,-100]
    result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
    for i in @states
      if $data_states[i].guard_element_set.include?(element_id)
        result /= 2
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  def state_ranks
    return $data_enemies[@enemy_id].state_ranks
  end
  #--------------------------------------------------------------------------
  def state_guard?(state_id)
    return false
  end
  #--------------------------------------------------------------------------
  def element_set
    return []
  end
  #--------------------------------------------------------------------------
  def plus_state_set
    return []
  end
  #--------------------------------------------------------------------------
  def minus_state_set
    return []
  end
  #--------------------------------------------------------------------------
  def actions
    return $data_enemies[@enemy_id].actions
  end
  #--------------------------------------------------------------------------
  def exp
    return $data_enemies[@enemy_id].exp
  end
  #--------------------------------------------------------------------------
  def gold
    return $data_enemies[@enemy_id].gold
  end
  #--------------------------------------------------------------------------
  def item_id
    return $data_enemies[@enemy_id].item_id
  end
  #--------------------------------------------------------------------------
  def weapon_id
    return $data_enemies[@enemy_id].weapon_id
  end
  #--------------------------------------------------------------------------
  def armor_id
    return $data_enemies[@enemy_id].armor_id
  end
  #--------------------------------------------------------------------------
  def treasure_prob
    return $data_enemies[@enemy_id].treasure_prob
  end
end
 
#============================================================================
# ■ Game Battler
#============================================================================
 
class Game_Battler
  #--------------------------------------------------------------------------
  def can_use_skill?(skill)
    if skill.sp_cost > self.sp
      return false
    end
    if dead?
      return false
    end
    if skill.atk_f == 0 and self.restriction == 1
      return false
    end
    occasion = skill.occasion
    case occasion
    when 0..1
      return true
    when 2..3
      return false
    end
  end
  #--------------------------------------------------------------------------
  def effect_skill(user, skill)
    self.critical = false
    if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
       ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
      return false
    end
    effective = false
    effective |= skill.common_event_id > 0
    hit = skill.hit
    if skill.atk_f > 0
      hit *= user.hit / 100
    end
    hit_result = (rand(100) < hit)
    effective |= hit < 100
    if hit_result == true
      power = skill.power + user.atk * skill.atk_f / 100
      if power > 0
        power -= self.pdef * skill.pdef_f / 200
        power -= self.mdef * skill.mdef_f / 200
        power = [power, 0].max
      end
      rate = 20
      rate += (user.str * skill.str_f / 100)
      rate += (user.dex * skill.dex_f / 100)
      rate += (user.agi * skill.agi_f / 100)
      rate += (user.int * skill.int_f / 100)
      self.damage = power * rate / 20
      self.damage *= elements_correct(skill.element_set)
      self.damage /= 100
      if self.damage > 0
        if self.guarding?
          self.damage /= 2
        end
      end
      if skill.variance > 0 and self.damage.abs > 0
        amp = [self.damage.abs * skill.variance / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      eva = 8 * self.agi / user.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
      effective |= hit < 100
    end
    if hit_result == true
      if skill.power != 0 and skill.atk_f > 0
        remove_states_shock
        effective = true
      end
      last_hp = self.hp
      self.hp -= self.damage
      effective |= self.hp != last_hp
      @state_changed = false
      effective |= states_plus(skill.plus_state_set)
      effective |= states_minus(skill.minus_state_set)
      if skill.power == 0
        self.damage = ""
        unless @state_changed
          self.damage = "Miss"
        end
      end
    else
      self.damage = "Miss"
    end
    return effective
  end
end
 
#============================================================================
# ■ Game Character
#============================================================================
 
class Game_Character
  attr_accessor   :move_type
  attr_accessor   :move_frequency
  attr_accessor   :move_speed
  attr_accessor   :character_name
end
 
#============================================================================
# ■ Game Ranged Weapon
#============================================================================
 
class Game_Ranged_Weapon < Game_Character
  #--------------------------------------------------------------------------
  attr_accessor :draw
  attr_accessor :dead
  #--------------------------------------------------------------------------
  def initialize(parent, actor, attack)
    @range = 0
    @step = 0
    @parent = parent
    @actor = actor
    @draw = true
    @dead  = false
    @range_wepaon = $ABS.RANGE_WEAPONS[attack]
    super()
    refresh
  end
  #--------------------------------------------------------------------------
  def refresh
    @move_direction = @parent.direction
    moveto(@parent.x, @parent.y)
    @character_name = @range_wepaon[0]
    @move_speed = @range_wepaon[1]
    @range = @range_wepaon[4]
  end
  #--------------------------------------------------------------------------
  def check_event_trigger_touch(x, y)
    hit_player if x == $game_player.x and y == $game_player.y
    for event in $game_map.events.values
      if event.x == x and event.y == y
        if event.character_name == ""
          froce_movement
        else
          hit_event(event.id)
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def froce_movement
    case @move_direction
    when 2
      @y += 1
    when 4
      @x -= 1
    when 6
      @x += 1
    when 8
      @y -= 1
    end
  end
  #--------------------------------------------------------------------------
  def update
    super
    return if moving?
    case @move_direction
    when 2
      move_down
    when 4
      move_left
    when 6
      move_right
    when 8
      move_up
    end
    update_step
  end
  #--------------------------------------------------------------------------
  def update_step
    kill if @step >= @range
    @step += 1
  end
  #--------------------------------------------------------------------------
  def hit_player
    actor = $game_party.actors[0]
    enemy = @actor
    actor.attack_effect(enemy)
    $game_player.animation_id = @range_wepaon[2] if actor.damage != "Miss" and actor.damage != 0
    $ABS.actor_non_dead?(actor, enemy)
    kill
  end
  #--------------------------------------------------------------------------
  def hit_event(id)
    actor = $ABS.enemies[id]
    return if actor == nil
    if @parent.is_a?(Game_Player)
      enemy = $game_party.actors[0]
      actor.attack_effect(enemy)
      $game_map.events[id].animation_id = @range_wepaon[2] if actor.damage != "Miss" and actor.damage != 0
      if $ABS.event_non_dead?(actor)
        if actor.engaged == false
          actor.behavior = 3
          actor.linking = true
          actor.engaged = true
          $ABS.set_event_movement(actor)
        end
      end
    else
      enemy = $ABS.enemies[@parent.id]
      actor.attack_effect(enemy)
      $game_map.events[id].animation_id = @range_wepaon[2] if actor.damage != "Miss" and actor.damage != 0
      $ABS.event_non_dead?(actor, enemy)
    end
    kill
  end
  #--------------------------------------------------------------------------
  def kill
    @dead = true
  end
end
 
#============================================================================
# ■ Game Ranged Skill
#============================================================================
 
class Game_Ranged_Skill < Game_Character
  #--------------------------------------------------------------------------
  attr_accessor :draw
  attr_accessor :dead
  #--------------------------------------------------------------------------
  def initialize(parent, actor, skill)
    @range = 0
    @step = 0
    @parent = parent
    @skill = skill
    @actor = actor
    @range_skill = $ABS.RANGE_SKILLS[skill.id]
    @draw = true
    @dead  = false
    super()
    refresh
  end
  #--------------------------------------------------------------------------
  def refresh
    @move_direction = @parent.direction
    moveto(@parent.x, @parent.y)
    @range = @range_skill[0]
    @opacity = 10 if @range == 1
    @move_speed = @range_skill[1]
    @character_name = @range_skill[2]
  end
  #--------------------------------------------------------------------------
  def check_event_trigger_touch(x, y)
    hit_player if x == $game_player.x and y == $game_player.y
    for event in $game_map.events.values
      if event.x == x and event.y == y
        if event.character_name == ""
          froce_movement
        else
          hit_event(event.id)
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def froce_movement
    case @move_direction
    when 2
      @y += 1
    when 4
      @x -= 1
    when 6
      @x += 1
    when 8
      @y -= 1
    end
  end
  #--------------------------------------------------------------------------
  def update
    super
    return if moving?
    case @move_direction
    when 2
      move_down
    when 4
      move_left
    when 6
      move_right
    when 8
      move_up
    end
    update_step
  end
  #--------------------------------------------------------------------------
  def update_step
    kill if @step >= @range
    @step += 1
  end
  #--------------------------------------------------------------------------
  def hit_player
    actor = $game_party.actors[0]
    enemy = @actor
    actor.effect_skill(enemy, @skill)
    $game_player.animation_id = @skill.animation2_id if actor.damage != "Miss" and actor.damage != 0
    $ABS.actor_non_dead?(actor, enemy)
  end
  #--------------------------------------------------------------------------
  def hit_event(id)
    actor = $ABS.enemies[id]
    return if actor == nil
    if @parent.is_a?(Game_Player)
      enemy = $game_party.actors[0]
      actor.effect_skill(enemy, @skill)
      $game_map.events[id].animation_id = @skill.animation2_id if actor.damage != "Miss" and actor.damage != 0
      if $ABS.event_non_dead?(actor, enemy)
        if actor.engaged == false
          actor.behavior = 3
          actor.linking = true
          actor.engaged = true
          $ABS.set_event_movement(actor)
        end
      end
    else
      enemy = $ABS.enemies[@parent.id]
      actor.effect_skill(enemy, @skill)
      $game_map.events[id].animation_id = @skill.animation2_id if actor.damage != "Miss" and actor.damage != 0
      $ABS.event_non_dead?(actor, enemy)
    end
  end
  #--------------------------------------------------------------------------
  def kill
    @dead = true
  end
end
 
#============================================================================
# ■ Game Event
#============================================================================
 
class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  alias abs_game_event_refresh refresh
  #--------------------------------------------------------------------------
  def name
    return @event.name
  end
  #--------------------------------------------------------------------------
  def id
    return @id
  end
  #--------------------------------------------------------------------------
  def refresh
    abs_game_event_refresh
    $ABS.refresh(@event, @list, @character_name)
  end
end
 
#============================================================================
# ■ Spriteset Map
#============================================================================
 
class Spriteset_Map
  #--------------------------------------------------------------------------
  alias abs_spriteset_map_initialize initialize
  alias abs_spriteset_map_dispose dispose
  alias abs_spriteset_map_update update
  #--------------------------------------------------------------------------
  def initialize
    @ranged = []
    for range in $ABS.range
      sprite = Sprite_Character.new(@viewport1, range)
      @ranged.push(sprite)
    end
    abs_spriteset_map_initialize
  end
  #--------------------------------------------------------------------------
  def dispose
    for range in @ranged
      range.dispose
    end
    abs_spriteset_map_dispose
  end
  #--------------------------------------------------------------------------
  def update
    for range in $ABS.range
      if range.draw == true
        sprite = Sprite_Character.new(@viewport1, range)
        @ranged.push(sprite)
        range.draw = false
      end
    end
    for range in @ranged
      if range.character.dead == true
        $ABS.range.delete(range.character)
        @ranged.delete(range)
        range.dispose
      else
        range.update
      end
    end
    abs_spriteset_map_update
  end
end
 
#============================================================================
# ■ Scene Title
#============================================================================
 
class Scene_Title
  #--------------------------------------------------------------------------
  alias abs_scene_title_cng command_new_game
  #--------------------------------------------------------------------------
  def command_new_game
    $ABS = ABS.new
    abs_scene_title_cng
  end
end
 
#============================================================================
# ■ Scene Map
#============================================================================
 
class Scene_Map
  #--------------------------------------------------------------------------
  alias abs_scene_map_update update
  #--------------------------------------------------------------------------
  def main
    @spriteset = Spriteset_Map.new
    @message_window = Window_Message.new
    Graphics.transition
    loop do
      Graphics.update
      Keyboard.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @spriteset.dispose
    @message_window.dispose
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end
  end
  #--------------------------------------------------------------------------
  def update
    $ABS.update
    $ABS.player_attack if Keyboard.trigger?($ABS.ATTACK_KEY)
    for i in 0..9
      $ABS.player_skill(i) if Keyboard.trigger?($ABS.SKILL_KEYS[i])
    end
    abs_scene_map_update
  end
end
 
#============================================================================
# ■ Scene Skill
#============================================================================
 
class Scene_Skill
  #--------------------------------------------------------------------------
  alias abs_scene_skill_main main
  alias abs_scene_skill_update update
  alias abs_scene_skill_update_skill update_skill
  #--------------------------------------------------------------------------
  def main
    @shk_window = Window_Command.new(250, ["Skill Assigned to Hot Key"])
    @shk_window.visible = false
    @shk_window.active = false
    @shk_window.x = 200
    @shk_window.y = 250
    @shk_window.z = 1500
    abs_scene_skill_main  
    @shk_window.dispose
  end
  #--------------------------------------------------------------------------
  def update
    Keyboard.update
    @shk_window.update
    abs_scene_skill_update
    if @shk_window.active
      update_shk
      return
    end
  end
  #--------------------------------------------------------------------------
  def update_skill
    abs_scene_skill_update_skill
    for i in 0..9
      if Keyboard.trigger?($ABS.SKILL_KEYS[i])
        $game_system.se_play($data_system.decision_se)
        @skill_window.active = false
        @shk_window.active = true
        @shk_window.visible = true
        $ABS.skills[i] = @skill_window.skill.id 
      end
    end
  end
 #--------------------------------------------------------------------------
 def update_shk
   if Input.trigger?(Input::C)
     $game_system.se_play($data_system.decision_se)
     @shk_window.active = false
     @shk_window.visible = false
     @skill_window.active = true
     $scene = Scene_Skill.new(@actor_index)
     return
   end
 end
end
 
#============================================================================
# ■ Scene Load
#============================================================================
 
class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  alias abs_scene_load_read_save_data read_save_data
  #--------------------------------------------------------------------------
    def read_save_data(file)
    abs_scene_load_read_save_data(file)
    $ABS = Marshal.load(file)
  end
end
#============================================================================
# ■ Scene Save
#============================================================================
 
class Scene_Save < Scene_File
  #--------------------------------------------------------------------------
  alias abs_scene_save_write_save_data write_save_data
  #--------------------------------------------------------------------------
  def write_save_data(file)
    abs_scene_save_write_save_data(file)
    Marshal.dump($ABS, file)
  end
end



Ressources :

Magic balls :
image
Flèches : manquant


Mis à jour le 14 novembre 2020.






suiken - posté le 20/08/2008 à 14:44:34 (15 messages postés)

❤ 0

excusez moi mais quelqu'un de très fort peut t-il m'aider a transformer ce script pour vx???

j'alterne dessin et making!


WarriorDX - posté le 13/10/2008 à 20:05:49 (2 messages postés)

❤ 0

Mais lol... Qui est assez boulay pour DL son script pourri ? Il fait du copiay collay (très facile) mais il arrive pas à le faire... Donc voilà... Il y a d'autres sites très complay pour DL des scripts !





------Amicalement, WarriorDX------


Amie - posté le 28/05/2009 à 09:28:56 (22 messages postés)

❤ 0

Cliquez sur l'"URL" se ma Sign. SVP

C'est dommage qu'il y est pas de Screnshot ...

&#27700;&#26230;&#12398;&#24515;&#12398;&#28057; (si vous trouvez sa signification MP moi) --- Caractère Tèkma


TracerTong - posté le 04/09/2009 à 18:52:00 (27 messages postés)

❤ 0

Alors, que ce sois claire, j'ai RESOLU LE PROBLEME


Il suffit de rajouter des # devant chaque ligne ou il y a une erreur et apres ca marche ! Mais je ne vois pas grand chose de nouveau..


Ulquiorra - posté le 08/10/2009 à 22:06:09 (1913 messages postés)

❤ 0

Question idiote de ma part : où doit-on mettre ce script, mince !
Soyez précis quand vous proposez un script, on est pas dans votre cerveau, quoi.


Tata Monos - posté le 22/10/2009 à 14:19:10 (28 messages postés)

❤ 0

Compte Non utilisé

Citation:

faites-le en évènement,


Sur Xp/Vx vaut mieux un script quand même. Ca sera plus fluide.

Mais perso si je vaux faire un A/RPG j'oublie RM.
Je passe sois à MMF,Game Maker ou à IG/Maker.


black eagle - posté le 14/11/2009 à 16:54:55 (3 messages postés)

❤ 0

MAGNIFIQUE TOUT SIMPLEMENT MAGNIFIQUE :sonic:sonic :bave:bave


LE SCRIPTE DE a6V MARCHE A LA PERFECTION SANS BOGUES JE PEUT UTILISER les sorts les attaques au corps a corps sans aucun problème
pour ceux qui veulent voir ce que ca donne télécharger

Citation:

Voici la démo j'ai trouvé le script traduit sur google

http://filebeam.com/3aa0a8104a4f93d3aa6f84c7b12bd683



tout est expliqué et pour les flémards je vous montre une partie qui est sur le scripte a-rpg 2

Citation:

# E ● Echanger le héros avec le suivant personnage.
# R ● Echanger le héros avec le précédent personnage.
# T ● Attendre le héros.
# Y ● Attendre les alliés.
# U ● Rassembler les alliés.
# I ● Courir.
# O ● Ramper (se dissimuler aux yeux des ennemis.).
# P ● Masquer les informations de l' écran (hp, membres du groupe etc...) (ou HUD)
# C ou ESPACE ou ENTREE ● Attaque au corps à corps. ( Commande modifié)
# G ● Attaque à distance.
# H ● Touche assignable de compétence 1.
# J ● Touche assignable de compétence 2.
# K ● Touche assignable de compétence 3.
# L ● Touche assignable de compétence 4.
# N ● Formation large.
# M ● Formation serrée.



pour les touches H,I,K,L ce sont les touches pour utiliser vous sort
pour utiliser un sort avec une de ces touche allez dans compétence puis choisissez votre personnage et appuyez sur la touche que vous voulez un message de confirmation s'affichera

ATTENTION :

J'AI REUSSI A LANCER LE SCRIPT AVEC LA DEMO DE a6V QUAND JE L'AI MIS SUR UN NOUVEAU PROJET IL Y A EU UN BOGUE A LA LIGNE 399 DE A-rpg 2 C'EST POUR CA QUE J'AI REPRIS LE PROJET DE a6V


et le mot de fin MERCI "a6V" :sonic:sonic


itachie79 - posté le 22/02/2010 à 19:12:42 (55 messages postés)

❤ 0

La démos a6V est certe bien mais quand un perso rejoind mon equipe
il arrive parfois dans des changements de map l'autre perso soit tp a l'opposé de mon perso utilisé je trouve sa très bête ^^"


xavier98 - posté le 24/03/2010 à 01:57:14 (9 messages postés)

❤ 0

C'est seulement à cause d'un poblème de version
ceci: http://www.rpg-maker.fr/index.php?page=astuces&id=304 devrais vous aider


Link et Midona - posté le 05/04/2010 à 13:15:14 (4 messages postés)

❤ 0

Je préfère mon anciens scripte il est beaucoup mieux même si il y'a pas d'arc


Roi of the Suisse - posté le 05/04/2010 à 13:39:40 (30336 messages postés) - honor -

❤ 0

Chanter l'hyperchleuasme

 XD A chaque fois que quelqu'un poste un script, il est plein de smileys !

Est-ce que les balises code empêchent ça ?

Portion de code : Tout sélectionner

1
:F


EDIT: Oui, alors il faut en profiter !

Es-tu une star ? | Kujira no Hara | Muma|Rope | Polaris 03 | La 7e porte


Draquaza - posté le 22/08/2010 à 22:54:34 (7 messages postés)

❤ 0

Je suis rien.

:F

Ce script a l'air bien,mais j'en ai dejà un...Merci quand même ^^


Saikyoken - posté le 27/11/2010 à 23:54:10 (3 messages postés)

❤ 0

Y'a un debut a tout ^^

Sa a l'air compliquer mais je vais tester :joint


Link11Shiney - posté le 08/06/2011 à 15:20:16 (14 messages postés)

❤ 0

Je suis un maker... quoi de plus banal ?

Ce script est super mais, il y a plein d'autres sites ou ce script et posté :)


ixsuixwzone - posté le 12/06/2011 à 09:18:41 (2453 messages postés)

❤ 0

hey,
moi j'utilise les script XAS_hero_2 et ca merd... bug pas le jeu comme ce deche... script.
j'aprouve zessirb fait en evenement !
voila les script de XAS: http://rpgcreative.net/rpgmaker/scripts-117-xas-combat-a-rpg.html
tcho !

| Âmes Bannies - Demo 0.2 |


-Shaedyx- - posté le 21/09/2011 à 21:27:04 (267 messages postés)

❤ 0

A-RPG est pour moi le truc à prendre quand on est pas doué en script.
Très bon script que je conseille ainsi que XAS

Autrefois nommé Makowne


esziaprez - posté le 27/10/2011 à 02:55:05 (441 messages postés)

❤ 0

Je suis dans le game !

J'utilise ce script dans mon projet et j'aimerai dire qu'il rend très bien.

Moi qui ne touche pas une bille en Ruby ça m'a permis de faire une bonne partie de mon gameplay mais il y a quelques problème.

1- Les créatures mettent des fois un temps super long à engager le combats ce qui fait qu'on est parfois coincé par un ennemi qui ne nous attaque pas et qu'on ne peut pas attaquer non plus

2-Lorsqu'on utilise une animation de coup en évent (lorsque la touche X est pressé...) l'animation est la même quel que soit le personnage leader. Récupérer l'information du héros qui est leader (ID dans une variable par exemple) serai fort utile pour la programmation.

3-

Citation:

La démos a6V est certe bien mais quand un perso rejoind mon equipe
il arrive parfois dans des changements de map l'autre perso soit tp a l'opposé de mon perso utilisé je trouve sa très bête ^^"

Notamment dans les grandes maps et quand on vient du bas, c'est chiant à la limite il faut enlever puis rajouté le membre supplémentaire une fois sur la carte mais ça saoule commême...

4-Chez moi les triggers ne marche pas ni l'arc (tout est pourtant bien personnalisé dans le script)

6-Pour mon projet la partie ramper/courir n'est pas indispensable (du coup les détails comme la vu et la capacité entendre des ennemi non-plus) nue portée suffirait. Ca serai bien de ce servir de cette partit du hud pour afficher un resumé des touches de sort assignée.

Comme je l'ai dit je suis pas un as du scripting alors si des gens peuvent m'aider à faire quelques modifs en m'expliquant le principe pour qu'après je puisse me debrouiller tout seul ca serai sympa.

Voili voilou

Projet en cours: INRAL / En pause :NEOTORI /// Pause : L'ANKH DE KINBRA /// Pause : GRASS SHOPPER  /// GALERIE


Guigui33200 - posté le 08/02/2012 à 15:56:34 (3 messages postés)

❤ 0

jpe pas ouvrir les demo :triste2


Enzuki - posté le 16/05/2012 à 18:29:11 (24 messages postés)

❤ 0

Moi j'aimerais bien savoir comment on fait pour créer des scripts.
Excusez-moi de dire ça c'est complètement débile mais je me pose quand-même la question.
Et en plus j'y comprend rien.

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

Haut de page

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

Plan du site

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