Bienvenue visiteur !
|
Statistiques
Liste des membres
Contact
Mentions légales
224 connectés actuellement
30741518 visiteurs depuis l'ouverture
1891 visiteurs aujourd'hui
Partenaires
Tous nos partenaires
Devenir partenaire
|
Reivilo -
posté le 04/02/2016 à 10:39:45 (163 messages postés)
| Why not ? | Domaine concerné: Script Logiciel utilisé: RPG Maker VX Ace Bonjour !
J'ai eu quelques problèmes avec un scirpt sideview d'un certain "Jet" à cause d'une définition "Guard?" j'ai donc changé de script de sideview pour finalement prendre celui de "YEA - VISUAL BATTLERS" mais ce dernier était moins complet que l'ancien, je me suis donc dit que je pourrais à la limite, prendre des éléments de l'ancien script pour les mettre dans le nouveau script
Pour la fonction "Flipped ennemies" (qui retourne les ennemies pour les avoir en face de soi) ça marche comme sur des roulettes ! Mais malheureusement, une des fonctions nommé "Player_shadow" qui donne aux joueurs une ombres ne marche pas :/
Je n'ai pas une grande connaissance en RGSS, mais j'arrive à m'y retrouver ... sauf ici
Quelqu'un pourrait-il me donner une explication ?
Voici les scripts que j'ai utilisé, tout d'abord, celui que j'utilise actuellement, celui de YEA (avec la moidification Flipped_ennemies et Player_shadow)
(j'ai mit l'endroit que j'ai modifié entre
#MODIF FLIPPED ENNEMIES & SHADOW
et
#MODIF
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
| #==============================================================================
#
# ¥ Yanfly Engine Ace - Visual Battlers v1.01
# -- Last Updated: 2012.07.24
# -- Level: Easy
# -- Requires: n/a
#
# ¥ Modified by:
# -- Yami
# -- Kread-Ex
# -- Archeia_Nessiah
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-VisualBattlers"] = true
#==============================================================================
# ¥ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.12.18 - Added preset views and able to change direction in-game.
# 2012.07.24 - Finished Script.
# 2012.01.05 - Started Script.
#
#==============================================================================
# ¥ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script provides a visual for all actors by default charsets. The actions
# and movements are alike Final Fantasy 1, only move forward and backward when
# start and finish actions.
#
#==============================================================================
# ¥ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To change the player direction in-game, use the snippet below in a script
# call:
#
# $game_system.party_direction = n
#
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ¥ Materials but above ¥ Main. Remember to save.
#
#==============================================================================
# ¥ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
module YEA
module VISUAL_BATTLERS
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Party Location Setting -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings are adjusted for Party Location. Each Actor will have
# coordinates calculated by below formula. There are two samples coordinates
# below, change PARTY_DIRECTION to the base index you want to use.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
PARTY_DIRECTION = 3 # This direction is opposite from actual direction.
PARTY_LOCATION_BASE_COORDINATES ={
# Index => [base_x, base_y, mod_x, mod_y],
2 => [ 250, 290, 40, 0], #UP
4 => [ 150, 280, 20, -20], #LEFT
3 => [ 450, 235, -20, 20], #RIGHT
6 => [ 460, 230, 20, 20], #DEFAULT RIGHT
8 => [ 260, 230, 40, 0], #DOWN
} # Do not remove this.
PARTY_LOCATION_FORMULA_X = "base_x + index * mod_x"
PARTY_LOCATION_FORMULA_Y = "base_y + index * mod_y"
#Modification :
#Ennemies retournés
FLIPPED_ENEMIES = [3, 4, 5, 8, 10, 11, 12, 13, 16, 17, 18, 19, 28, 29]
#Autre (ombre du héros lors des combats)
PLAYER_SHADOW = true
# This is where the line-up begins. [x, y]. The higher the x, the further
# right and the higher the y the further down.
FIELD_POS = [450, 235]
# This is how far down, and to the right each player is from the previous
# actor. [x, y]. Same rules as above.
FIELD_SPACING = [-20, 20]
end # VISUAL_BATTLERS
end # YEA
#==============================================================================
# ¥ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
#==============================================================================
# ? ¥ Direction
#==============================================================================
module Direction
#--------------------------------------------------------------------------
# self.correct
#--------------------------------------------------------------------------
def self.correct(direction)
case direction
when 1; return 4
when 3; return 6
when 7; return 4
when 9; return 6
else; return direction
end
end
#--------------------------------------------------------------------------
# self.opposite
#--------------------------------------------------------------------------
def self.opposite(direction)
case direction
when 1; return 6
when 2; return 8
when 3; return 4
when 4; return 6
when 6; return 4
when 7; return 6
when 8; return 2
when 9; return 4
else; return direction
end
end
end # Direction
#MODIF FLIPPED ENNEMIES & SHADOW
class Spriteset_Battle
alias jet2847_create_enemies create_enemies
def create_enemies(*args, &block)
jet2847_create_enemies(*args, &block)
@enemy_sprites.each {|a|
a.mirror = YEA::VISUAL_BATTLERS::FLIPPED_ENEMIES.include?(a.battler.enemy.id)
}
end
alias jet3835_create_actors create_actors
def create_actors(*args, &block)
jet3835_create_actors(*args, &block)
@jet_party = $game_party.members
@actor_sprites.each {|a|
a.dispose
}
@actor_sprites = []
$game_party.members.each {|a|
f = Game_Character.new
f.set_graphic(a.character_name, a.character_index)
f.step_anime = true
f.set_direction(4)
n = Sprite_Character.new(@viewport1, f)
n.jet_x = YEA::VISUAL_BATTLERS::FIELD_POS[0] + a.index * YEA::VISUAL_BATTLERS::FIELD_SPACING[0]
n.jet_y = YEA::VISUAL_BATTLERS::FIELD_POS[1] + a.index * YEA::VISUAL_BATTLERS::FIELD_SPACING[1]
n.battler = a
n.battle_sprite = true
if YEA::VISUAL_BATTLERS::PLAYER_SHADOW
v = Sprite.new(nil)
v.bitmap = Cache.system("Shadow")
n.shadow_sprite = v
end
@actor_sprites.push(n)
}
end
end
class Sprite_Character
attr_accessor :battle_sprite, :jet_x, :jet_y, :shadow_sprite, :battler
alias jet4646_initialize initialize
def initialize(*args, &block)
@battle_sprite = false
jet4646_initialize(*args, &block)
end
alias jet3645_update update
def update(*args, &block)
jet3645_update(*args, &block)
if @battle_sprite
@character.step_anime = !@battler.dead?
@character.update
self.x = @jet_x
self.y = @jet_y
if !@shadow_sprite.nil?
@shadow_sprite.x = self.x - @shadow_sprite.width / 2
@shadow_sprite.y = self.y - 28
@shadow_sprite.visible = self.visible
@shadow_sprite.viewport = self.viewport
@shadow_sprite.z = self.z - 1
end
end
end
alias jet5484_dispose dispose
def dispose(*args, &block)
@shadow_sprite.dispose if !@shadow_sprite.nil?
jet5484_dispose(*args, &block)
end
def move_x(times, amount)
i = 0
until i == times
self.jet_x += amount
i += 1
[Graphics, SceneManager.scene.spriteset].each {|a| a.update }
end
end
def effect?
false
end
end #MODIF END
#==============================================================================
# ? ¥ Game_System
#==============================================================================
class Game_System; attr_accessor :party_direction; end
#==============================================================================
# ? ¥ Game_BattleCharacter
#==============================================================================
class Game_BattleCharacter < Game_Character
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(actor)
super()
setup_actor(actor)
@move_x_rate = 0
@move_y_rate = 0
end
#--------------------------------------------------------------------------
# setup_actor
#--------------------------------------------------------------------------
def setup_actor(actor)
@actor = actor
@step_anime = true
set_graphic(@actor.character_name, @actor.character_index)
setup_coordinates
dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION
direction = Direction.opposite(dr)
set_direction(Direction.correct(direction))
end
#--------------------------------------------------------------------------
# sprite=
#--------------------------------------------------------------------------
def sprite=(sprite)
@sprite = sprite
end
#--------------------------------------------------------------------------
# setup_coordinates
#--------------------------------------------------------------------------
def setup_coordinates
location = ($game_system.party_direction ||
YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
base_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][0]
base_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][1]
mod_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][2]
mod_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][3]
@actor.screen_x = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_X)
@actor.screen_y = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_Y)
@actor.origin_x = @actor.screen_x
@actor.origin_y = @actor.screen_y
@actor.create_move_to(screen_x, screen_y, 1)
end
#--------------------------------------------------------------------------
# index
#--------------------------------------------------------------------------
def index
return @actor.index
end
#--------------------------------------------------------------------------
# screen_x
#--------------------------------------------------------------------------
def screen_x
return @actor.screen_x
end
#--------------------------------------------------------------------------
# screen_y
#--------------------------------------------------------------------------
def screen_y
return @actor.screen_y
end
#--------------------------------------------------------------------------
# screen_z
#--------------------------------------------------------------------------
def screen_z
return @actor.screen_z
end
end # Game_BattleCharacter
#==============================================================================
# ? ¥ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :moved_back
attr_accessor :origin_x
attr_accessor :origin_y
attr_accessor :screen_x
attr_accessor :screen_y
attr_accessor :started_turn
#--------------------------------------------------------------------------
# alias method: execute_damage
#--------------------------------------------------------------------------
alias game_battler_execute_damage_vb execute_damage
def execute_damage(user)
game_battler_execute_damage_vb(user)
if @result.hp_damage > 0
move_backward(24, 6) unless @moved_back
@moved_back = true
end
end
#--------------------------------------------------------------------------
# face_opposing_party
#--------------------------------------------------------------------------
def face_opposing_party
direction = ($game_system.party_direction ||
YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
character.set_direction(Direction.correct(direction)) rescue 0
end
#--------------------------------------------------------------------------
# new method: face_coordinate
#--------------------------------------------------------------------------
def face_coordinate(destination_x, destination_y)
x1 = Integer(@screen_x)
x2 = Integer(destination_x)
y1 = Graphics.height - Integer(@screen_y)
y2 = Graphics.height - Integer(destination_y)
return if x1 == x2 and y1 == y2
#---
angle = Integer(Math.atan2((y2-y1),(x2-x1)) * 1800 / Math::PI)
if (0..225) === angle or (-225..0) === angle
direction = 6
elsif (226..675) === angle
direction = 9
elsif (676..1125) === angle
direction = 8
elsif (1126..1575) === angle
direction = 7
elsif (1576..1800) === angle or (-1800..-1576) === angle
direction = 4
elsif (-1575..-1126) === angle
direction = 1
elsif (-1125..-676) === angle
direction = 2
elsif (-675..-226) === angle
direction = 3
end
#---
character.set_direction(Direction.correct(direction)) rescue 0
end
#--------------------------------------------------------------------------
# create_move_to
#--------------------------------------------------------------------------
def create_move_to(destination_x, destination_y, frames = 12)
@destination_x = destination_x
@destination_y = destination_y
frames = [frames, 1].max
@move_x_rate = [(@screen_x - @destination_x).abs / frames, 2].max
@move_y_rate = [(@screen_y - @destination_y).abs / frames, 2].max
end
#--------------------------------------------------------------------------
# update_move_to
#--------------------------------------------------------------------------
def update_move_to
@move_x_rate = 0 if @screen_x == @destination_x || @move_x_rate.nil?
@move_y_rate = 0 if @screen_y == @destination_y || @move_y_rate.nil?
value = [(@screen_x - @destination_x).abs, @move_x_rate].min
@screen_x += (@destination_x > @screen_x) ? value : -value
value = [(@screen_y - @destination_y).abs, @move_y_rate].min
@screen_y += (@destination_y > @screen_y) ? value : -value
end
#--------------------------------------------------------------------------
# move_forward
#--------------------------------------------------------------------------
def move_forward(distance = 24, frames = 12)
direction = forward_direction
move_direction(direction, distance, frames)
end
#--------------------------------------------------------------------------
# move_backward
#--------------------------------------------------------------------------
def move_backward(distance = 24, frames = 12)
direction = Direction.opposite(forward_direction)
move_direction(direction, distance, frames)
end
#--------------------------------------------------------------------------
# move_direction
#--------------------------------------------------------------------------
def move_direction(direction, distance = 24, frames = 12)
case direction
when 1; move_x = distance / -2; move_y = distance / 2
when 2; move_x = distance * 0; move_y = distance * 1
when 3; move_x = distance / -2; move_y = distance / 2
when 4; move_x = distance * -1; move_y = distance * 0
when 6; move_x = distance * 1; move_y = distance * 0
when 7; move_x = distance / -2; move_y = distance / -2
when 8; move_x = distance * 0; move_y = distance * -1
when 9; move_x = distance / 2; move_y = distance / -2
else; return
end
destination_x = @screen_x + move_x
destination_y = @screen_y + move_y
create_move_to(destination_x, destination_y, frames)
end
#--------------------------------------------------------------------------
# forward_direction
#--------------------------------------------------------------------------
def forward_direction
return ($game_system.party_direction ||
YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
end
#--------------------------------------------------------------------------
# move_origin
#--------------------------------------------------------------------------
def move_origin
create_move_to(@origin_x, @origin_y)
face_coordinate(@origin_x, @origin_y)
@moved_back = false
end
#--------------------------------------------------------------------------
# moving?
#--------------------------------------------------------------------------
def moving?
return false if dead? || !exist?
return @move_x_rate != 0 || @move_y_rate != 0
end
end # Game_Battler
#==============================================================================
# ? ¥ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# overwrite method: use_sprite?
#--------------------------------------------------------------------------
def use_sprite?
return true
end
#--------------------------------------------------------------------------
# new method: screen_x
#--------------------------------------------------------------------------
def screen_x
return @screen_x rescue 0
end
#--------------------------------------------------------------------------
# new method: screen_y
#--------------------------------------------------------------------------
def screen_y
return @screen_y rescue 0
end
#--------------------------------------------------------------------------
# new method: screen_z
#--------------------------------------------------------------------------
def screen_z
return 100
end
#--------------------------------------------------------------------------
# new method: sprite
#--------------------------------------------------------------------------
def sprite
index = $game_party.battle_members.index(self)
return SceneManager.scene.spriteset.actor_sprites[index]
end
#--------------------------------------------------------------------------
# new method: character
#--------------------------------------------------------------------------
def character
return sprite.character_base
end
#--------------------------------------------------------------------------
# face_opposing_party
#--------------------------------------------------------------------------
def face_opposing_party
dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION
direction = Direction.opposite(dr)
character.set_direction(Direction.correct(direction)) rescue 0
end
#--------------------------------------------------------------------------
# forward_direction
#--------------------------------------------------------------------------
def forward_direction
return Direction.opposite(($game_system.party_direction ||
YEA::VISUAL_BATTLERS::PARTY_DIRECTION))
end
end # Game_Actor
#==============================================================================
# ? ¥ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# new method: sprite
#--------------------------------------------------------------------------
def sprite
return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
end
#--------------------------------------------------------------------------
# new method: character
#--------------------------------------------------------------------------
def character
return sprite
end
end # Game_Enemy
#==============================================================================
# ? ¥ Game_Troop
#==============================================================================
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# alias method: setup
#--------------------------------------------------------------------------
alias game_troop_setup_vb setup
def setup(troop_id)
game_troop_setup_vb(troop_id)
set_coordinates
end
#--------------------------------------------------------------------------
# new method: set_coordinates
#--------------------------------------------------------------------------
def set_coordinates
for member in members
member.origin_x = member.screen_x
member.origin_y = member.screen_y
member.create_move_to(member.screen_x, member.screen_y, 1)
end
end
end # Game_Troop
#==============================================================================
# ? ¥ Sprite_Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# public instance_variable
#--------------------------------------------------------------------------
attr_accessor :character_base
attr_accessor :character_sprite
#--------------------------------------------------------------------------
# alias method: dispose
#--------------------------------------------------------------------------
alias sprite_battler_dispose_vb dispose
def dispose
dispose_character_sprite
sprite_battler_dispose_vb
end
#--------------------------------------------------------------------------
# new method: dispose_character_sprite
#--------------------------------------------------------------------------
def dispose_character_sprite
@character_sprite.dispose unless @character_sprite.nil?
end
#--------------------------------------------------------------------------
# alias method: update
#--------------------------------------------------------------------------
alias sprite_battler_update_vb update
def update
sprite_battler_update_vb
return if @battler.nil?
update_move_to
update_character_base
update_character_sprite
end
#--------------------------------------------------------------------------
# new method: update_character_base
#--------------------------------------------------------------------------
def update_character_base
return if @character_base.nil?
@character_base.update
end
#--------------------------------------------------------------------------
# new method: update_character_sprite
#--------------------------------------------------------------------------
def update_character_sprite
return if @character_sprite.nil?
@character_sprite.update
end
#--------------------------------------------------------------------------
# new method: update_move_to
#--------------------------------------------------------------------------
def update_move_to
@battler.update_move_to
end
#--------------------------------------------------------------------------
# new method: moving?
#--------------------------------------------------------------------------
def moving?
return false if @battler.nil?
return @battler.moving?
end
end # Sprite_Battler
#==============================================================================
# ? ¥ Sprite_BattleCharacter
#==============================================================================
class Sprite_BattleCharacter < Sprite_Character
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(viewport, character = nil)
super(viewport, character)
character.sprite = self
end
end # Sprite_BattleCharacter
#==============================================================================
# ? ¥ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# public instance_variable
#--------------------------------------------------------------------------
attr_accessor :actor_sprites
attr_accessor :enemy_sprites
#--------------------------------------------------------------------------
# overwrite method: create_actors
#--------------------------------------------------------------------------
def create_actors
total = $game_party.max_battle_members
@current_party = $game_party.battle_members.clone
@actor_sprites = Array.new(total) { Sprite_Battler.new(@viewport1) }
for actor in $game_party.battle_members
@actor_sprites[actor.index].battler = actor
create_actor_sprite(actor)
end
end
#--------------------------------------------------------------------------
# new method: create_actor_sprite
#--------------------------------------------------------------------------
def create_actor_sprite(actor)
character = Game_BattleCharacter.new(actor)
character_sprite = Sprite_BattleCharacter.new(@viewport1, character)
@actor_sprites[actor.index].character_base = character
@actor_sprites[actor.index].character_sprite = character_sprite
actor.face_opposing_party
end
#--------------------------------------------------------------------------
# alias method: update_actors
#--------------------------------------------------------------------------
alias spriteset_battle_update_actors_vb update_actors
def update_actors
if @current_party != $game_party.battle_members
dispose_actors
create_actors
end
spriteset_battle_update_actors_vb
end
#--------------------------------------------------------------------------
# new method: moving?
#--------------------------------------------------------------------------
def moving?
return battler_sprites.any? {|sprite| sprite.moving? }
end
end # Spriteset_Battle
#==============================================================================
# ? ¥ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :spriteset
#--------------------------------------------------------------------------
# alias method: process_action_end
#--------------------------------------------------------------------------
alias scene_battle_process_action_end_vb process_action_end
def process_action_end
start_battler_move_origin
scene_battle_process_action_end_vb
end
#--------------------------------------------------------------------------
# alias method: execute_action
#--------------------------------------------------------------------------
alias scene_battle_execute_action_vb execute_action
def execute_action
start_battler_move_forward
scene_battle_execute_action_vb
end
#--------------------------------------------------------------------------
# new method: start_battler_move_forward
#--------------------------------------------------------------------------
def start_battler_move_forward
return if @subject.started_turn
@subject.started_turn = true
@subject.move_forward
wait_for_moving
end
#--------------------------------------------------------------------------
# new method: start_battler_move_origin
#--------------------------------------------------------------------------
def start_battler_move_origin
@subject.started_turn = nil
move_battlers_origin
wait_for_moving
@subject.face_opposing_party rescue 0
end
#--------------------------------------------------------------------------
# new method: move_battlers_origin
#--------------------------------------------------------------------------
def move_battlers_origin
for member in all_battle_members
next if member.dead?
next unless member.exist?
member.move_origin
end
end
#--------------------------------------------------------------------------
# new method: wait_for_moving
#--------------------------------------------------------------------------
def wait_for_moving
update_for_wait
update_for_wait while @spriteset.moving?
end
end # Scene_Battle
#==============================================================================
#
# ¥ End of File
#
#============================================================================== |
Et ensuite, celui de Jet
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
| #===============================================================================
# Side-View Battle System
# By Jet10985 (Jet)
#===============================================================================
# This script will allow you to have battle where all the actor's sprites are
# display on the right side of the screen.
# This script has: 10 customization options.
#===============================================================================
# Overwritten Methods:
# Scene_Battle: show_attack_animation
# Spriteset_Battle: update_actors
#-------------------------------------------------------------------------------
# Aliased methods:
# Spriteset_Battle: create_actors, create_enemies
# Sprite_Character: initialize, update, dispose, start_new_effect
# Scene_Battle: use_item, next_command, prior_command
# Game_Character: screen_x, screen_y
#===============================================================================
module Jet
module Sideview
#===========================================================================
# ENEMY OPTIONS
#===========================================================================
# These are the attack animations for enemies when they use a regular attack.
# It follows this format: enemy_id => animation_id
ENEMY_ATK_ANIMS = {
1 => 1,
}
# This is the default enemy attack animation, used when they do not have a
# specific attack animation above.
ENEMY_ATK_ANIMS.default = 1
# This is a list of enemies whose portraits should be flipped in battle.
FLIPPED_ENEMIES = [2, 3, 4, 5, 8, 10, 11, 12, 13, 16, 17, 18, 19, 28, 29]
#===========================================================================
# ACTOR OPTIONS
#===========================================================================
# Should the player sprite have a shadow beneath them?
PLAYER_SHADOW = true
# These are sprite changes depending on state infliction.
# It follows this format: state_id => "sprite_appention"
# This means if the state is inflicted, the sprite will look for a graphic
# that is the same name as the character's sprite, plus the appended option.
# EX: Ralph's sprite's name is $ralph. Ralph gets knocked-out. This means
# state 1 was inflicted, and my below config for 1 was: 1 => "_dead"
# Now, his shown sprite will be $ralph_dead. If the sprite does not exist,
# no change will be made.
# The sprite index will be the same as the actor's.
STATE_SPRITES = {
}
#===========================================================================
# GENERAL_OPTIONS
#===========================================================================
# This is the animation displayed when a skill is about to be used.
SKILL_ANIMATION = 113
# This is the animation displayed when an item is about to be used.
ITEM_ANIMATION = 114
# These are the animations played when a state is inflicted.
# It follows this format: state_id => animation_id
STATE_ANIMATIONS = {
}
#===========================================================================
# FIELD OPTIONS
#===========================================================================
# This is where the line-up begins. [x, y]. The higher the x, the further
# right and the higher the y the further down.
FIELD_POS = [450, 235]
# This is how far down, and to the right each player is from the previous
# actor. [x, y]. Same rules as above.
FIELD_SPACING = [-20, 20]
end
end
#===============================================================================
# DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
#===============================================================================
($imported ||= {})[:jet] ||= {}
$imported[:jet][:Sideview] = true
class Game_Character
attr_accessor :step_anime
%w[screen_x screen_y].each {|a|
aStr = %Q{
alias jet6372_#{a} #{a}
def #{a}(*args, &block)
$BTEST ? 0 : jet6372_#{a}(*args, &block)
end
}
module_eval(aStr)
}
end
class Game_Actor
def animation_id=(t)
self.battle_sprite.start_animation($data_animations[t]) rescue nil
end
end
class Game_Battler
def battle_sprite
return nil unless SceneManager.scene_is?(Scene_Battle)
SceneManager.scene.spriteset.battler_sprites.each {|a|
return a if a.battler == self
}
return nil
end
end
class Spriteset_Battle
alias jet2847_create_enemies create_enemies
def create_enemies(*args, &block)
jet2847_create_enemies(*args, &block)
@enemy_sprites.each {|a|
a.mirror = Jet::Sideview::FLIPPED_ENEMIES.include?(a.battler.enemy.id)
}
end
alias jet3835_create_actors create_actors
def create_actors(*args, &block)
jet3835_create_actors(*args, &block)
@jet_party = $game_party.members
@actor_sprites.each {|a|
a.dispose
}
@actor_sprites = []
$game_party.members.each {|a|
f = Game_Character.new
f.set_graphic(a.character_name, a.character_index)
f.step_anime = true
f.set_direction(4)
n = Sprite_Character.new(@viewport1, f)
n.jet_x = Jet::Sideview::FIELD_POS[0] + a.index * Jet::Sideview::FIELD_SPACING[0]
n.jet_y = Jet::Sideview::FIELD_POS[1] + a.index * Jet::Sideview::FIELD_SPACING[1]
n.battler = a
n.battle_sprite = true
if Jet::Sideview::PLAYER_SHADOW
v = Sprite.new(nil)
v.bitmap = Cache.system("Shadow")
n.shadow_sprite = v
end
@actor_sprites.push(n)
}
end
def update_actors
if @jet_party != $game_party.members
@actor_sprites.each {|a|
a.dispose
}
@actor_sprites = []
create_actors
end
@actor_sprites.each {|a| a.update }
end
end
class Sprite_Character
attr_accessor :battle_sprite, :jet_x, :jet_y, :shadow_sprite, :battler
alias jet4646_initialize initialize
def initialize(*args, &block)
@battle_sprite = false
jet4646_initialize(*args, &block)
end
alias jet3645_update update
def update(*args, &block)
jet3645_update(*args, &block)
if @battle_sprite
@character.step_anime = !@battler.dead?
@character.update
self.x = @jet_x
self.y = @jet_y
if !@battler.nil?
f = @battler.states.dup
f.sort! {|a, b|
a.priority <=> b.priority
}.reverse!
for i in 0...f.size
a = Jet::Sideview::STATE_SPRITES[f[i].id]
next if a.nil?
b = (Cache.character(@character.character_name + a) rescue false)
next unless b
index = @character.character_index
@character.set_graphic(@character.character_name + a, index)
break
end
end
if !@shadow_sprite.nil?
@shadow_sprite.x = self.x - @shadow_sprite.width / 2
@shadow_sprite.y = self.y - 28
@shadow_sprite.visible = self.visible
@shadow_sprite.viewport = self.viewport
@shadow_sprite.z = self.z - 1
end
end
end
alias jet5484_dispose dispose
def dispose(*args, &block)
@shadow_sprite.dispose if !@shadow_sprite.nil?
jet5484_dispose(*args, &block)
end
def move_x(times, amount)
i = 0
until i == times
self.jet_x += amount
i += 1
[Graphics, SceneManager.scene.spriteset].each {|a| a.update }
end
end
def effect?
false
end
end
class Game_Enemy
def atk_animation_id1
return Jet::Sideview::ENEMY_ATK_ANIMS[@enemy_id]
end
def atk_animation_id2
return 0
end
end
class Scene_Battle
attr_reader :spriteset
alias jet2711_use_item use_item
def use_item(*args, &block)
if @subject.is_a?(Game_Actor)
if !@subject.current_action.guard?
@subject.battle_sprite.move_x(11, -6)
end
end
if !@subject.current_action.guard? && !@subject.current_action.attack?
if @subject.current_action.item.is_a?(RPG::Item)
n = $data_animations[Jet::Sideview::ITEM_ANIMATION]
else
n = $data_animations[Jet::Sideview::SKILL_ANIMATION]
end
@subject.battle_sprite.start_animation(n)
wait_for_animation
end
jet2711_use_item(*args, &block)
if @subject.is_a?(Game_Actor)
if !@subject.current_action.guard?
@subject.battle_sprite.move_x(11, 6)
end
end
end
def show_attack_animation(targets)
aid1 = @subject.atk_animation_id1
aid2 = @subject.atk_animation_id2
show_normal_animation(targets, aid1, false)
show_normal_animation(targets, aid2, true)
end
%w[next prior].each {|a|
aStr = %Q{
alias jet3734_#{a}_command #{a}_command
def #{a}_command(*args, &block)
f = BattleManager.actor
f.battle_sprite.move_x(6, 6) if f.is_a?(Game_Actor)
jet3734_#{a}_command(*args, &block)
f = BattleManager.actor
f.battle_sprite.move_x(6, -6) if f.is_a?(Game_Actor)
end
}
module_eval(aStr)
}
end
class Game_Action
def guard?
item == $data_skills[subject.guard_skill_id]
end
end
if $imported[:jet][:BattlePopUps]
class Sprite_Character
attr_accessor :popups
alias jet4758_initialize initialize
def initialize(*args, &block)
@popups = []
@updating_sprites = []
@popup_wait = 0
jet4758_initialize(*args, &block)
end
alias jet7467_update update
def update(*args, &block)
jet7467_update(*args, &block)
if @popup_wait == 0
if !@popups.empty?
@updating_sprites.push(@popups.pop)
@popup_wait = 30
end
else
@popup_wait -= 1
end
@updating_sprites.each {|a|
a.visible = true if !a.visible
a.update
@updating_sprites.delete(a) if a.disposed?
}
end
alias jet5483_dispose dispose
def dispose(*args, &block)
(@updating_sprites + @popups).each {|a| a.dispose }
jet5483_dispose(*args, &block)
end
alias jet3745_setup_new_effect setup_new_effect
def setup_new_effect(*args, &block)
jet3745_setup_new_effect(*args, &block)
do_sprite_popups
end
def make_popup(text, color)
@popups.unshift(Sprite_JetPopup.new(text.to_s, color, self))
end
def do_sprite_popups
return if @battler.nil?
if @battler_struct.nil?
@battler_struct = Struct.new(:hp, :mp, :tp).new(0, 0, 0)
@battler_struct.hp = @battler.hp
@battler_struct.mp = @battler.mp
@battler_struct.tp = @battler.tp
end
check_success_popup
check_hp_popup
check_mp_popup
check_tp_popup
end
def check_success_popup
if @battler.result.success
if @battler.result.critical
make_popup(Jet::BattlePopUps::CRITICAL_TEXT, Jet::BattlePopUps::CRITICAL_COLOR)
elsif @battler.result.missed
make_popup(Jet::BattlePopUps::MISSED_TEXT, Jet::BattlePopUps::MISS_COLOR)
elsif @battler.result.evaded
make_popup(Jet::BattlePopUps::EVADED_TEXT, Jet::BattlePopUps::EVADE_COLOR)
end
@battler.result.clear_hit_flags
end
end
def check_hp_popup
if @battler_struct.hp != @battler.hp
f = @battler_struct.hp - @battler.hp
if f > 0
make_popup(Jet::BattlePopUps::HURT_TEXT + f.to_s, Jet::BattlePopUps::HURT_COLOR)
elsif f < 0
make_popup(Jet::BattlePopUps::HEAL_TEXT + f.abs.to_s, Jet::BattlePopUps::HEAL_COLOR)
end
@battler_struct.hp = @battler.hp
end
end
def check_mp_popup
if @battler_struct.mp != @battler.mp
f = @battler_struct.mp - @battler.mp
if f > 0
make_popup(Jet::BattlePopUps::HURT_TEXT_MP + f.to_s, Jet::BattlePopUps::HURT_COLOR_MP)
elsif f < 0
make_popup(Jet::BattlePopUps::HEAL_TEXT_MP + f.abs.to_s, Jet::BattlePopUps::HEAL_COLOR_MP)
end
@battler_struct.mp = @battler.mp
end
end
def check_tp_popup
if @battler_struct.tp != @battler.tp
f = (@battler_struct.tp - @battler.tp).round
if f > 0
make_popup(Jet::BattlePopUps::HURT_TEXT_TP + f.to_s, Jet::BattlePopUps::HURT_COLOR_TP)
elsif f < 0
make_popup(Jet::BattlePopUps::HEAL_TEXT_TP + f.abs.to_s, Jet::BattlePopUps::HEAL_COLOR_TP)
end
@battler_struct.tp = @battler.tp
end
end
end
end |
En espérant recevoir une réponse rapide (ou non) de la part d'un connaisseur ! ^^
Si ce n'est pas le cas, ne vous en faites pas, je n'abuserais pas du "uppage" de topic comme la dernière fois ! (... je le ferais ... une fois ... juste ... une seule fois !)
A toute !
|
Travail assis, Travail réussi ! |
SalamenderD -
posté le 04/02/2016 à 10:43:37 (114 messages postés)
| Kebab | déjà est ce que tu as mis l'image "Shadow" dans le dossier system de ton projet ?
sinon, je n'ai qu'une connaissance rudimentaire des scripts mais à mon humble avis, il faut juste d'autres éléments du script à ajouter (des prérequis pour la fonction shadow en gros)
|
Mon Site ; Mon Hymne ; Witness Of The Storm ! ; Les pommes marçies-moulues ! |
Reivilo -
posté le 04/02/2016 à 10:50:08 (163 messages postés)
| Why not ? | Oui oui ! Je l'ai exporter dans le dossier "system" et sinon, oui je pense qu'il faudrait que j'exporte d'autre élément de script, le problème, c'est que j'ai peur de ne pas exporter les bons et de me perdre dans le méandre des lignes de codes ! :/
|
Travail assis, Travail réussi ! |
SalamenderD -
posté le 04/02/2016 à 10:52:32 (114 messages postés)
| Kebab | oui c'est sûr, dans ce cas essaie de te renseigner un peu sur comment fonctionne les scripts, après tout c'est qu'une suite de commande il suffit juste de savoir quelle commande enclenche quoi ^^
sur ce bonne chance et bonne journée ! ^^
|
Mon Site ; Mon Hymne ; Witness Of The Storm ! ; Les pommes marçies-moulues ! |
Reivilo -
posté le 04/02/2016 à 10:55:07 (163 messages postés)
| Why not ? | Je vais tenter l'apprentissage du RGSS ... hé hé x)
Merci à toi sinon pour ta réponse rapide ^^
|
Travail assis, Travail réussi ! |
SalamenderD -
posté le 04/02/2016 à 11:09:22 (114 messages postés)
| Kebab | de rien y'a pas de soucis
|
Mon Site ; Mon Hymne ; Witness Of The Storm ! ; Les pommes marçies-moulues ! | Index du forum > Entraide > [RPG Maker VX Ace] Modification script Sideview
|
|
|