Day.png);">
Apprendre


Vous êtes
nouveau sur
Oniromancie?

Visite guidée
du site


Découvrir
RPG Maker

RM 95
RM 2000/2003
RM XP
RM VX/VX Ace
RM MV/MZ

Apprendre
RPG Maker

Tutoriels
Guides
Making-of

Dans le
Forum

Section Entraide

Tutos: Checklist de la composition (...) / Sorties: Dread Mac Farlane - episode 8 / Sorties: Dread Mac Farlane - episode 7 / Jeux: Ce qui vit Dessous / News: Quoi de neuf sur Oniromancie (...) / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

380 connectés actuellement

29388415 visiteurs
depuis l'ouverture

5 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

Alex d'Or

Leo-Games

Planète Glutko

Lunae - le bazar d'Emz0

Tous nos partenaires

Devenir
partenaire



forums

Index du forum > Entraide > [RMXP] Actualiser des jauges de vies ennemies en combat vue de côté


Bourricot - posté le 22/06/2015 à 19:05:28 (11 messages postés)

❤ 0

Maker débutant occasionnel

Domaine concerné: Evenement
Logiciel utilisé: RMXP
Bonjour,

Comme l'indique le titre, je suis bloqué dans l'affichage de jauges de vie au dessus des ennemis en combat de côté (tour par tour de base).

La seule technique que j'ai trouvée et qui semble fonctionner est de réafficher l'image de chaque jauge, et une par page d'événement combat, en me servant de la condition " lorsque PV ennemi 1. < xx% "

Voici une image pour plus de clarté : http://image.noelshack.com/fichiers/2015/26/1434991806-affichage-vie.png

Comme on peut imaginer en regardant l'image, J'assigne une page d'événement combat pour chaque 2% de vie a afficher. C'est long, lourd, et certainement extrêmement maladroit, mais je n'arrive pas à utiliser correctement les variables en combat.

Les conditions à l'intérieur des pages d’événement combat ne semblent pas fonctionner comme des conditions normales, et ça me pose un problème de taille. Si quelqu'un a donc déjà rencontré ce problème et a quelques astuces pour me débloquer, je les accueillerai volontiers.

Je suis également preneur sur tout ce qui peut s'approcher d'un tutoriel ou même quelques explications sur le fonctionnement des évènements et des variables spécialement en combat (pour les variables hors combat, tout va bien, ce forum offre déjà des tutos de qualité).

Merci d'avance :sourire3

http://www.rpg-maker.fr/index.php?page=gallerie&auteur=26021 Ma gallerie.


Pheno - posté le 28/06/2015 à 15:56:28 (41 messages postés)

❤ 0

Moi c'est surtout sur les combats de côté, comme les anciens FF.
Parce que quand j'entre le script qu'on trouve dans les tutos d'ici, les monstres sont découpés et j'ai plusieurs persos qui s'affichent sur un seul x(
Bref, je ne comprends rien.
mais j'espère que tu auras ta solution parce que je m'en servirai certainement aussi.


Bourricot - posté le 29/06/2015 à 22:14:34 (11 messages postés)

❤ 0

Maker débutant occasionnel

Si tu ne comprends pas un script, il vaut mieux te débrouiller avec les évènements ^^.
Je galère à scripter donc je préfère tout faire à partir d'évènements et d'images, autant pour les systèmes de quêtes que les maps ou les menus supplémentaires !

Et petit up pour mon sujet je suis réellement bloqué :(

http://www.rpg-maker.fr/index.php?page=gallerie&auteur=26021 Ma gallerie.


arttroy - posté le 21/07/2015 à 12:37:59 (2394 messages postés)

❤ 0

Just working

Je peux te proposer une solution mais ce sera pas de l'event...

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
#==============================================================================
# 
# ▼ Yanfly Engine Ace - Battle Engine Add-On: Enemy HP Bars v1.10
# -- Last Updated: 2012.02.10
# -- Level: Easy, Normal
# -- Requires: YEA - Ace Battle Engine v1.00+.
# 
#==============================================================================
 
$imported = {} if $imported.nil?
$imported["YEA-EnemyHPBars"] = true
 
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.02.10 - Bug Fixed: AoE selection doesn't reveal hidden enemies.
# 2012.02.01 - Bug Fixed: Back and front of gauge randomly don't appear.
# 2012.01.11 - Efficiency update.
# 2012.01.04 - Compatibility Update: Area of Effect
# 2011.12.28 - Efficiency update.
#            - Bug Fixed: HP bars didn't disappear after a heal.
# 2011.12.26 - Bug Fixed: HP bars were not depleting.
# 2011.12.23 - Efficiency update.
# 2011.12.10 - Bug Fixed: HP bars no longer appear when dead and an AoE skill
#              has been selected.
# 2011.12.08 - New feature. Hide HP Bars until defeated once.
# 2011.12.06 - Started Script and Finished.
# 
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script shows HP gauges on enemies as they're selected for targeting or
# whenever they're damaged. The HP gauges will actually slide downward or
# upward as the enemies take damage.
# 
# Included in v1.01 is the option to require the player having slain an enemy
# once before enemies of that type will show their HP gauge.
# 
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 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.
# 
# -----------------------------------------------------------------------------
# Enemy Notetags - These notetags go in the enemy notebox in the database.
# -----------------------------------------------------------------------------
# <back gauge: x>
# Changes the colour of the enemy HP back gauge to x where x is the text colour
# used from the "Window" skin image under Graphics\System.
# 
# <hp gauge 1: x>
# <hp gauge 2: x>
# Changes the colour of the enemy HP HP gauge to x where x is the text colour
# used from the "Window" skin image under Graphics\System.
# 
# <hide gauge>
# <show gauge>
# Hides/shows HP gauge for enemies in battle. These gauges appear whenever the
# enemy is targeted for battle or whenever the enemy takes HP damage. Note that
# using the <show gauge> tag will bypass the requirement for needing to defeat
# an enemy once if that setting is enabled.
# 
#==============================================================================
# ▼ 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.
# 
# This script requires Yanfly Engine Ace - Ace Battle Engine v1.00+ and the
# script must be placed under Ace Battle Engine in the script listing.
# 
#==============================================================================
 
module YEA
  module BATTLE
    
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Enemy HP Gauges -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # Adjust the settings for the enemy HP gauges. You can choose to show the
    # enemy HP gauges by default, the size of the gauge, the colour of the
    # gauge, and the back colour of the gauge.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    SHOW_ENEMY_HP_GAUGE    = true   # Display Enemy HP Gauge?
    ANIMATE_HP_GAUGE       = true   # Animate the HP gauge?
    DEFEAT_ENEMIES_FIRST   = true   # Must defeat enemy first to show HP?
    ENEMY_GAUGE_WIDTH      = 65     # How wide the enemy gauges are.
    ENEMY_GAUGE_HEIGHT     = 8      # How tall the enemy gauges are.
    ENEMY_HP_GAUGE_COLOUR1 = 20     # Colour 1 for HP.
    ENEMY_HP_GAUGE_COLOUR2 = 21     # Colour 2 for HP.
    ENEMY_BACKGAUGE_COLOUR = 19     # Gauge Back colour.
    
  end # BATTLE
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.
#==============================================================================
 
if $imported["YEA-BattleEngine"]
 
module YEA
  module REGEXP
  module ENEMY
    
    HIDE_GAUGE = /<(?:HIDE_GAUGE|hide gauge)>/i
    SHOW_GAUGE = /<(?:SHOW_GAUGE|show gauge)>/i
    
    BACK_GAUGE = /<(?:BACK_GAUGE|back gauge):[ ]*(\d+)>/i
    HP_GAUGE_1 = /<(?:HP_GAUGE_1|hp gauge 1):[ ]*(\d+)>/i
    HP_GAUGE_2 = /<(?:HP_GAUGE_2|hp gauge 2):[ ]*(\d+)>/i
    
  end # ENEMY
  end # REGEXP
end # YEA
 
#==============================================================================
# ■ DataManager
#==============================================================================
 
module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_ehpb load_database; end
  def self.load_database
    load_database_ehpb
    load_notetags_ehpb
  end
  
  #--------------------------------------------------------------------------
  # new method: load_notetags_ehpb
  #--------------------------------------------------------------------------
  def self.load_notetags_ehpb
    groups = [$data_enemies]
    for group in groups
      for obj in group
        next if obj.nil?
        obj.load_notetags_ehpb
      end
    end
  end
  
end # DataManager
 
#==============================================================================
# ■ RPG::Enemy
#==============================================================================
 
class RPG::Enemy < RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :show_gauge
  attr_accessor :require_death_show_gauge
  attr_accessor :back_gauge_colour
  attr_accessor :hp_gauge_colour1
  attr_accessor :hp_gauge_colour2
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_ehpb
  #--------------------------------------------------------------------------
  def load_notetags_ehpb
    @show_gauge = YEA::BATTLE::SHOW_ENEMY_HP_GAUGE
    @require_death_show_gauge = YEA::BATTLE::DEFEAT_ENEMIES_FIRST
    @back_gauge_colour = YEA::BATTLE::ENEMY_BACKGAUGE_COLOUR
    @hp_gauge_colour1 = YEA::BATTLE::ENEMY_HP_GAUGE_COLOUR1
    @hp_gauge_colour2 = YEA::BATTLE::ENEMY_HP_GAUGE_COLOUR2
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEA::REGEXP::ENEMY::HIDE_GAUGE
        @show_gauge = false
      when YEA::REGEXP::ENEMY::SHOW_GAUGE
        @show_gauge = true
        @require_death_show_gauge = false
      when YEA::REGEXP::ENEMY::BACK_GAUGE
        @back_gauge_colour = [$1.to_i, 31].min
      when YEA::REGEXP::ENEMY::HP_GAUGE_1
        @hp_gauge_colour1 = [$1.to_i, 31].min
      when YEA::REGEXP::ENEMY::HP_GAUGE_2
        @hp_gauge_colour2 = [$1.to_i, 31].min
      end
    } # self.note.split
    #---
  end
  
end # RPG::Enemy
 
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
 
class Sprite_Battler < Sprite_Base
  
  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias sprite_battler_initialize_ehpb initialize
  def initialize(viewport, battler = nil)
    sprite_battler_initialize_ehpb(viewport, battler)
    create_enemy_gauges
  end
  
  #--------------------------------------------------------------------------
  # alias method: dispose
  #--------------------------------------------------------------------------
  alias sprite_battler_dispose_ehpb dispose
  def dispose
    sprite_battler_dispose_ehpb
    dispose_enemy_gauges
  end
  
  #--------------------------------------------------------------------------
  # alias method: update
  #--------------------------------------------------------------------------
  alias sprite_battler_update_ehpb update
  def update
    sprite_battler_update_ehpb
    update_enemy_gauges
  end
  
  #--------------------------------------------------------------------------
  # new method: create_enemy_gauges
  #--------------------------------------------------------------------------
  def create_enemy_gauges
    return if @battler.nil?
    return if @battler.actor?
    return unless @battler.enemy.show_gauge
    @back_gauge_viewport = Enemy_HP_Gauge_Viewport.new(@battler, self, :back)
    @hp_gauge_viewport = Enemy_HP_Gauge_Viewport.new(@battler, self, :hp)
  end
  
  #--------------------------------------------------------------------------
  # new method: dispose_enemy_gauges
  #--------------------------------------------------------------------------
  def dispose_enemy_gauges
    @back_gauge_viewport.dispose unless @back_gauge_viewport.nil?
    @hp_gauge_viewport.dispose unless @hp_gauge_viewport.nil?
  end
  
  #--------------------------------------------------------------------------
  # new method: update_enemy_gauges
  #--------------------------------------------------------------------------
  def update_enemy_gauges
    @back_gauge_viewport.update unless @back_gauge_viewport.nil?
    @hp_gauge_viewport.update unless @hp_gauge_viewport.nil?
  end
  
  #--------------------------------------------------------------------------
  # new method: update_enemy_gauge_value
  #--------------------------------------------------------------------------
  def update_enemy_gauge_value
    @back_gauge_viewport.new_hp_updates unless @back_gauge_viewport.nil?
    @hp_gauge_viewport.new_hp_updates unless @hp_gauge_viewport.nil?
  end
  
end # Sprite_Battler
 
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
 
class Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :hidden
  
  #--------------------------------------------------------------------------
  # alias method: refresh
  #--------------------------------------------------------------------------
  alias game_battlerbase_refresh_ehpb refresh
  def refresh
    game_battlerbase_refresh_ehpb
    return unless SceneManager.scene_is?(Scene_Battle)
    return if actor?
    sprite.update_enemy_gauge_value
  end
  
end # Game_BattlerBase
 
#==============================================================================
# ■ Game_Battler
#==============================================================================
 
class Game_Battler < Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # alias method: die
  #--------------------------------------------------------------------------
  alias game_battler_die_ehpb die
  def die
    game_battler_die_ehpb
    return if actor?
    $game_party.add_defeated_enemy(@enemy_id)
  end
  
  #--------------------------------------------------------------------------
  # alias method: hp=
  #--------------------------------------------------------------------------
  alias game_battlerbase_hpequals_ehpb hp=
  def hp=(value)
    game_battlerbase_hpequals_ehpb(value)
    return unless SceneManager.scene_is?(Scene_Battle)
    return if actor?
    return if value == 0
    sprite.update_enemy_gauge_value
  end
  
end # Game_Battler
 
#==============================================================================
# ■ Game_Party
#==============================================================================
 
class Game_Party < Game_Unit
  
  #--------------------------------------------------------------------------
  # alias method: init_all_items
  #--------------------------------------------------------------------------
  alias game_party_init_all_items_ehpb init_all_items
  def init_all_items
    game_party_init_all_items_ehpb
    @defeated_enemies = []
  end
  
  #--------------------------------------------------------------------------
  # new method: defeated_enemies
  #--------------------------------------------------------------------------
  def defeated_enemies
    @defeated_enemies = [] if @defeated_enemies.nil?
    return @defeated_enemies
  end
  
  #--------------------------------------------------------------------------
  # new method: add_defeated_enemy
  #--------------------------------------------------------------------------
  def add_defeated_enemy(id)
    @defeated_enemies = [] if @defeated_enemies.nil?
    @defeated_enemies.push(id) unless @defeated_enemies.include?(id)
  end
  
end # Game_Party
 
#==============================================================================
# ■ Enemy_HP_Gauge_Viewport
#==============================================================================
 
class Enemy_HP_Gauge_Viewport < Viewport
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(battler, sprite, type)
    @battler = battler
    @base_sprite = sprite
    @type = type
    dw = YEA::BATTLE::ENEMY_GAUGE_WIDTH
    dw += 2 if @type == :back
    @start_width = dw
    dh = YEA::BATTLE::ENEMY_GAUGE_HEIGHT
    dh += 2 if @type == :back
    rect = Rect.new(0, 0, dw, dh)
    @current_hp = @battler.hp
    @current_mhp = @battler.mhp
    @target_gauge_width = target_gauge_width
    @gauge_rate = 1.0
    setup_original_hide_gauge
    super(rect)
    self.z = 125
    create_gauge_sprites
    self.visible = false
    update_position
  end
  
  #--------------------------------------------------------------------------
  # dispose
  #--------------------------------------------------------------------------
  def dispose
    @sprite.bitmap.dispose unless @sprite.bitmap.nil?
    @sprite.dispose
    super
  end
  
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    self.visible = gauge_visible?
    @sprite.ox += 4 if YEA::BATTLE::ANIMATE_HP_GAUGE
    update_position
    update_gauge
    @visible_counter -= 1
  end
  
  #--------------------------------------------------------------------------
  # setup_original_hide_gauge
  #--------------------------------------------------------------------------
  def setup_original_hide_gauge
    @original_hide = @battler.enemy.require_death_show_gauge
    return unless @original_hide
    if YEA::BATTLE::DEFEAT_ENEMIES_FIRST
      enemy_id = @battler.enemy_id
      @original_hide = !$game_party.defeated_enemies.include?(enemy_id)
    end
  end
  
  #--------------------------------------------------------------------------
  # create_gauge_sprites
  #--------------------------------------------------------------------------
  def create_gauge_sprites
    @sprite = Plane.new(self)
    dw = self.rect.width * 2
    @sprite.bitmap = Bitmap.new(dw, self.rect.height)
    case @type
    when :back
      colour1 = Colour.text_colour(@battler.enemy.back_gauge_colour)
      colour2 = Colour.text_colour(@battler.enemy.back_gauge_colour)
    when :hp
      colour1 = Colour.text_colour(@battler.enemy.hp_gauge_colour1)
      colour2 = Colour.text_colour(@battler.enemy.hp_gauge_colour2)
    end
    dx = 0
    dy = 0
    dw = self.rect.width
    dh = self.rect.height
    @gauge_width = target_gauge_width
    @sprite.bitmap.gradient_fill_rect(dx, dy, dw, dh, colour1, colour2)
    @sprite.bitmap.gradient_fill_rect(dw, dy, dw, dh, colour2, colour1)
    @visible_counter = 0
  end
  
  #--------------------------------------------------------------------------
  # update_visible
  #--------------------------------------------------------------------------
  def gauge_visible?
    update_original_hide
    return false if @original_hide
    return false if case_original_hide?
    return true if @visible_counter > 0
    return true if @gauge_width != @target_gauge_width
    if SceneManager.scene_is?(Scene_Battle)
      return false if SceneManager.scene.enemy_window.nil?
      unless @battler.dead?
        if SceneManager.scene.enemy_window.active
          return true if SceneManager.scene.enemy_window.enemy == @battler
          return true if SceneManager.scene.enemy_window.select_all?
          return true if highlight_aoe?
        end
      end
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # highlight_aoe?
  #--------------------------------------------------------------------------
  def highlight_aoe?
    return false unless $imported["YEA-AreaofEffect"]
    return false if @battler.enemy? && @battler.hidden
    return SceneManager.scene.enemy_window.hightlight_aoe?(@battler)
  end
  
  #--------------------------------------------------------------------------
  # new_hp_updates
  #--------------------------------------------------------------------------
  def new_hp_updates
    return if @current_hp == @battler.hp && @current_mhp == @battler.mhp
    @current_hp = @battler.hp
    @current_mhp = @battler.mhp
    return if @gauge_rate == target_gauge_rate
    @gauge_rate = target_gauge_rate
    @target_gauge_width = target_gauge_width
    @visible_counter = 60
  end
  
  #--------------------------------------------------------------------------
  # case_original_hide?
  #--------------------------------------------------------------------------
  def case_original_hide?
    return false if !@battler.enemy.require_death_show_gauge
    if YEA::BATTLE::DEFEAT_ENEMIES_FIRST
      enemy_id = @battler.enemy_id
      return true unless $game_party.defeated_enemies.include?(enemy_id)
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # update_original_hide
  #--------------------------------------------------------------------------
  def update_original_hide
    return unless @original_hide
    return if @battler.dead?
    enemy_id = @battler.enemy_id
    @original_hide = false if $game_party.defeated_enemies.include?(enemy_id)
  end
  
  #--------------------------------------------------------------------------
  # update_position
  #--------------------------------------------------------------------------
  def update_position
    dx = @battler.screen_x - @start_width / 2
    dy = @battler.screen_y
    self.rect.x = dx
    self.rect.y = dy
    dh = self.rect.height + 1
    dh += 2 unless @type == :back
    dy = [@battler.screen_y, Graphics.height - dh - 120].min
    dy += 1 unless @type == :back
    self.rect.y = dy
  end
  
  #--------------------------------------------------------------------------
  # update_gauge
  #--------------------------------------------------------------------------
  def update_gauge
    return if @gauge_width == @target_gauge_width
    rate = 4
    @target_gauge_width = target_gauge_width
    if @gauge_width > @target_gauge_width
      @gauge_width = [@gauge_width - rate, @target_gauge_width].max
    elsif @gauge_width < @target_gauge_width
      @gauge_width = [@gauge_width + rate, @target_gauge_width].min
    end
    @visible_counter = @gauge_width == 0 ? 10 : 60
    return if @type == :back
    self.rect.width = @gauge_width
  end
  
  #--------------------------------------------------------------------------
  # target_gauge_rate
  #--------------------------------------------------------------------------
  def target_gauge_rate
    return @current_hp.to_f / @current_mhp.to_f
  end
  
  #--------------------------------------------------------------------------
  # target_gauge_width
  #--------------------------------------------------------------------------
  def target_gauge_width
    return [@current_hp * @start_width / @current_mhp, @start_width].min
  end
  
end # Enemy_HP_Gauge_Viewport
 
end # $imported["YEA-BattleEngine"]
 
#==============================================================================
# 
# ▼ End of File
# 
#==============================================================================



et y'a un bug fix à mettre en dessous de celui là

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
#==============================================================================
# 
# ▼ Yanfly Engine Ace - Battle Engine Add-On: Enemy HP Bars v1.10
#   (Hidden Enemy HP Bar Fix)
#
# -- Last Updated: 2012.02.10
# -- Level: Easy, Normal
# -- Requires: YEA - Ace Battle Engine v1.00+.
# 
# Edited by : TheoAllen 
# Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
#
#==============================================================================
=begin
 
  Pembukaan :
  Enemy HP Bar yanfly adalah addon dari Battle Enginenya yang nampilin bar HP
  pada musuh. Namun sayangnya, HP Bar ini secara default juga bakal ngereveal
  hidden enemy. Karena ini untuk kepentingan game gw juga, maka ini adalah
  script untuk perbaikannya
  
  Cara penggunaan :
  Pasang script ini tepat dibawah YEA - Enemy HP Bar
  
  Terms of Use :
  Ikutin aja ini http://yanflychannel.wordpress.com/terms-of-use/
  Jangan lupa, kredit Yanfly.  
 
=end
#==============================================================================
# Do not edit below this line
#==============================================================================
class Enemy_HP_Gauge_Viewport < Viewport
  def gauge_visible?
    update_original_hide
    return false if @original_hide
    return false if case_original_hide?
    return true if @visible_counter > 0
    return true if @gauge_width != @target_gauge_width
    if SceneManager.scene_is?(Scene_Battle)
      return false if SceneManager.scene.enemy_window.nil?
      return false if @battler.enemy? && @battler.hidden # Just add this line ~
      unless @battler.dead?
        if SceneManager.scene.enemy_window.active
          return true if SceneManager.scene.enemy_window.enemy == @battler
          return true if SceneManager.scene.enemy_window.select_all?
          return true if highlight_aoe?
        end
      end
    end
    return false
  end
end
 
class RPG::Enemy
  
  def require_death_show_gauge
    return false if $BTEST
    return @require_death_show_gauge
  end
 
end



Là en théorie ça devrait fonctionner sans avoir à te galérer à update l'image à chaque fois qu'un ennemi est touché (sinon ben la seule technique qui fonctionne en event c'est la tienne...).

Après si tu veux faire beaucoup de modifs sur le système de jeu de base, faudra te mettre aux scripts tu n'auras pas le choix.

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


Déesse de la Lavande - posté le 21/07/2015 à 16:18:40 (17 messages postés)

❤ 0

Mes adorateurs étaient jadis nombreux

Je crois pas que les scripts YEA soient pour Rpg Maker XP par contre :(


arttroy - posté le 22/07/2015 à 10:48:11 (2394 messages postés)

❤ 0

Just working

Raaah M.... Bien vu Déesse j'avais pas fais gaffe... Je vais regarder si je trouve pas un truc pour XP.

Edit : j'ai trouvé ça déjà, à tester. Si tu as des modifications à faire mp moi je devrais m'en sortir avec ce que je sais faire.

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
 
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Slant Bar(by SephirothSpawn)
#--------------------------------------------------------------------------
def draw_slant_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
# Draw Border
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
# Draw Background
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
# Draws Bar
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
end
 
 
class Window_EnemyHP < Window_Base
 
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
 
def refresh
self.contents.clear
for i in 0...$game_troop.enemies.size
@enemy = $game_troop.enemies
@percent = (@enemy.hp * 100) / @enemy.maxhp
unless @enemy.hp == 0
draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 10, @enemy.hp, @enemy.maxhp, width = 75, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
self.contents.font.color = Color.new(0,0,0)
self.contents.draw_text(@enemy.screen_x - 37, @enemy.screen_y - 24, 100, 32, "#{@percent}" + "%")
self.contents.draw_text(@enemy.screen_x - 43, @enemy.screen_y - 44, 100, 32, "#{@enemy.name}")
self.contents.font.color = normal_color
self.contents.draw_text(@enemy.screen_x - 45, @enemy.screen_y - 42, 100, 32, "#{@enemy.name}")
self.contents.draw_text(@enemy.screen_x - 39, @enemy.screen_y - 22, 100, 32, "#{@percent}" + "%")
end
end
end
end
 
class Scene_Battle
 
alias raz_update update
alias raz_update_phase5 update_phase5
alias raz_update_phase4_step1 update_phase4_step1
alias raz_update_phase4_step5 update_phase4_step5
alias raz_enemy_hp_main main
 
def main
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
@enemy_window = Window_EnemyHP.new
@enemy_window.z = 95
raz_enemy_hp_main
@enemy_window.dispose
end
 
 
def update
@enemy_window.update
raz_update
end
 
def update_phase5
# If wait count is larger than 0
if @phase5_wait_count > 0
# Decrease wait count
@phase5_wait_count -= 1
# If wait count reaches 0
if @phase5_wait_count == 0
@enemy_window.visible = false
# Show result window
@result_window.visible = true
# Clear main phase flag
$game_temp.battle_main_phase = false
# Refresh status window
@status_window.refresh
@enemy_window.refresh
end
return
end
raz_update_phase5
end
 
def update_phase4_step1
raz_update_phase4_step1
@enemy_window.refresh
end
 
def update_phase4_step5
# Hide help window
@help_window.visible = false
# Refresh status window
@status_window.refresh
@enemy_window.refresh
raz_update_phase4_step5
end
end
 
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 320, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
@level_up_flags =
refresh
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# * Set Level Up Flag
# actor_index : actor index
#--------------------------------------------------------------------------
def level_up(actor_index)
@level_up_flags = true
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors
actor_x = i * 160 + 4
draw_slant_bar(actor_x, 55, actor.hp, actor.maxhp, 120)
draw_slant_bar(actor_x, 88, actor.sp, actor.maxsp, 120, 6, bar_color = Color.new(150, 0, 150, 255), end_color = Color.new(0, 0, 255, 255))
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, 120)
draw_actor_sp(actor, actor_x, 64, 120)
if @level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, actor_x, 96)
end
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# Slightly lower opacity level during main phase
if $game_temp.battle_main_phase
self.contents_opacity -= 4 if self.contents_opacity > 191
else
self.contents_opacity += 4 if self.contents_opacity < 255
end
end
end
 



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

Index du forum > Entraide > [RMXP] Actualiser des jauges de vies ennemies en combat vue de côté

repondre up

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

Haut de page

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

Plan du site

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