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

Sorties: Dread Mac Farlane - episode 4 / Sorties: Star Trek: Glorious Wolf - (...) / Sorties: Dread Mac Farlane - episode 3 / News: Plein d'images cools créées par (...) / Sorties: Star Trek: Glorious Wolf - (...) / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

388 connectés actuellement

29192147 visiteurs
depuis l'ouverture

7198 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

Offgame

Level Up!

Lunae - le bazar d'Emz0

Tous nos partenaires

Devenir
partenaire



forums

Index du forum > Entraide > [RESOLU] [Rpg maker vx ACE] Jauge multiple


no0ony - posté le 19/12/2016 à 20:42:37 (401 messages postés)

❤ 0

Domaine concerné: Script
Logiciel utilisé: Rpg maker vx ACE
Bonjour, j'ai une question, est-ce possible d'afficher en même temps 2 jauges avec se scripts.
Évidemment je placerais lors coordonnées pour qu'elle ne se superposes pas.
Exemple (montage) :
La jauge jaune/orangé est celle du script, la bleu est ajouté, ça serais une autre jauge correspondant à une autre variable.
image
Le script :

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
#------------------------------------------------------------------------------#
#  Galv's Variable Instance Bars
#------------------------------------------------------------------------------#
#  For: RPGMAKER VX ACE
#  Version 1.1
#------------------------------------------------------------------------------#
#  2012-12-04 - version 1.1 - font issue fixed
#  2012-12-04 - version 1.0 - release
#------------------------------------------------------------------------------#
#  First things first. This script is purely cosmetic. It doesn't control or
#  look after whatever it is you are increasing/decreasing and using the bar
#  to show. Eg. If you're bar reaches full, YOU will need to set up using events
#  what happens after it gets there. (See demo with an example of this)
#  An exception is the variable bar (see below).
#
#  The script can call a bar that will animate decreasing or increasing by
#  certain amounts based on your input and then disappear again afterward.
#  You can call a custom bar or a variable bar.
#
#  The custom bar increases/decreases
#  depending on the settings you give it. (It will not automatically adjust any
#  parameters, experience, etc. for you. You do that manually).
#
#  The variable bar will adjust the chosen variable automatically by the amount
#  you set in the script call.
#
#  These bars only work on the map.
#------------------------------------------------------------------------------#
#  INSTRUCTIONS:
#------------------------------------------------------------------------------#
#
#  Put script under Materials and above Main
#
#  Make your own graphics for the bars or use the dodgy ones I made from the
#  demo. They got in /Graphics/System/ folder.
#
#  There are lots of settings to set up the bar to appear where you want it.
#
#------------------------------------------------------------------------------#
#  SCRIPT CALLS
#------------------------------------------------------------------------------#
#
#  bar_c(current,target,max,min,text)  # Draw a custom bar.
#                                      # current = starting amount
#                                      # target = amount it will raise/lower to
#                                      # max = full bar amount
#                                      # min = empty bar amount
#                                      # text = text with bar
#
#  bar_v(var_id,bonus,max,min,text)  # Draw a bar based on variable change.
#                                    # This automatically changes the variable
#                                    # by the bonus and cannot exceed the max.
#                                    # var_id = ID of the variable
#                                    # bonus = Amount it will increase/decrease
#                                    # max = full bar amount
#                                    # min = empty bar amount
#                                    # text = text with bar
#
#  bar_colors(barcol1,barcol2,text)  # Change the 2 gradient colors of the bar
#                                    # and the text color.
#
#  bar_graphic("FileName")           # file in /Graphics/System to change to
#
#------------------------------------------------------------------------------#
 
($imported ||= {})["Galvs_Variable_Bar"] = true
module Galv_VarBar
 
#------------------------------------------------------------------------------#
#  SCRIPT SETTINGS
#------------------------------------------------------------------------------#
 
  ACTIVE_TIME = 100   # How long the bar takes to fill/change.
 
  POSITION_Y = 202   # Y position
  POSITION_X = 0      # X position. 0 is centered, so to move everything left,
                      # use a negative number. Positive number for right.
  Z_OFFSET = 0        # Z level offset.
  
                      
  TEXT_SIZE = 19          # Size of the text
  TEXT_COLOR = 0          # Color of the text
  TEXT_FONT = "Bookman Old Style"     # Font of the text
  TEXT_ALIGN = 1          # 0 = left. 1 = center. 2 = right
  TEXT_Y_OFFSET = 37      # Tweak Y position of the text
  TEXT_X_OFFSET = 0       # Tweak X position of the text
  
  
  BAR_WIDTH = 300            # Width of the bar
  BAR_HEIGHT = 10            # Height of the bar
  BAR_IMAGE = "BarCover"     # Image in /Graphics/System/
  BAR_IMAGE_Y = 210          # Bar image Y position (screen relative)
  BAR_IMAGE_X = 0            # Bar image X position offset. 0 is centered.
  BAR_COLOR = [1,9]          # Default gradient colors for the bar
  
 
  INIT_U_SE = ["Up1", 100, 100]      # SE played once when bar appears
  RAISE_SE = ["Cursor2", 100, 100]   # Repeating SE when bar is increasing.
       # ["SE Name", Volume, pitch]
  INIT_D_SE = ["Down1", 100, 100]    # SE played once when bar appears
  LOWER_SE = ["Cursor2", 100, 70]    # Repeating SE when bar is decreasing.
                                     # ["SE Name", Volume, pitch]
 
  SE_SPEED = 2                       # speed that the repeating SE's repeat
  
#------------------------------------------------------------------------------#
#  END SCRIPT SETTINGS
#------------------------------------------------------------------------------#
 
end
 
 
class Game_Temp
  attr_accessor :varbar
  attr_accessor :vargraphic
  
  alias galv_varbar_temp_initialize initialize
  def initialize
    galv_varbar_temp_initialize
    # @varbar = [current,target,max,x,y,open,text,color1,color2,text_color,variable,min]
    @varbar = [0,0,100,false,"",
      Galv_VarBar::BAR_COLOR[0],
      Galv_VarBar::BAR_COLOR[1],
      Galv_VarBar::TEXT_COLOR,
      0,0]
    @vargraphic = Galv_VarBar::BAR_IMAGE
  end
end # Game_Temp
 
 
class Game_Interpreter
  def bar_c(current,target,max,min,text)
    $game_temp.varbar[0] = current
    $game_temp.varbar[1] = target
    $game_temp.varbar[2] = max
    $game_temp.varbar[3] = true
    $game_temp.varbar[4] = text
    $game_temp.varbar[8] = 0
    $game_temp.varbar[9] = min
  end
  
  def bar_v(var_id,bonus,max,min,text)
    $game_temp.varbar[0] = $game_variables[var_id]
    $game_temp.varbar[1] = $game_variables[var_id] + bonus
    $game_temp.varbar[2] = max
    $game_temp.varbar[3] = true
    $game_temp.varbar[4] = text
    $game_temp.varbar[8] = var_id
    $game_temp.varbar[9] = min
  end
  
  def bar_color(color1,color2,textcol)
    $game_temp.varbar[5] = color1
    $game_temp.varbar[6] = color2
    $game_temp.varbar[7] = textcol
  end
  
  def bar_graphic(file)
    $game_temp.vargraphic = file
  end
end # Game_Interpreter
 
 
class Scene_Map < Scene_Base
  
  alias galv_varbar_map_create_all_windows create_all_windows
  def create_all_windows
    galv_varbar_map_create_all_windows
    create_varbar_window
  end
  alias galv_varbar_map_update update
  def update
    galv_varbar_map_update
    @varbar_window.open if $game_temp.varbar[3]
  end
  def create_varbar_window
    @varbar_window = Window_VarBar.new
  end
  
end # Scene_Map < Scene_Base
 
 
class Window_VarBar < Window_Base
  def initialize
    super(window_x, window_y, window_width, window_height)
    self.opacity = 0
    self.contents_opacity = 0
    self.z = z + Galv_VarBar::Z_OFFSET
    @show_count = 0
    @fill_rate = 0
    refresh
  end
  def window_width
    return Galv_VarBar::BAR_WIDTH
  end
  def window_height
    return 130 #Galv_VarBar::BAR_HEIGHT
  end
  def window_x
    (Graphics.width - window_width) / 2 + Galv_VarBar::POSITION_X
  end
  def window_y
    Galv_VarBar::POSITION_Y
  end
  
  def update
    text_rect
    super
    if @show_count > 0
      refresh
      update_fadein
      @show_count -= 1
    else
      update_fadeout
    end
  end
 
  def update_fadein
    self.contents_opacity += 16
    @cover.opacity = self.contents_opacity if !@cover.nil?
  end
 
  def update_fadeout
    self.contents_opacity -= 16
    @cover.opacity = self.contents_opacity if !@cover.nil?
  end
 
  def open
    direction
    $game_temp.varbar[3] = false
    draw_cover if @cover.nil?
    refresh
    @show_count = Galv_VarBar::ACTIVE_TIME
    @fill_rate = fill_rate
    self.contents_opacity = 0 unless contents_opacity > 0
    self
    
    if $game_temp.varbar[8] > 0
      if @direction == 1
        $game_variables[$game_temp.varbar[8]] = [$game_temp.varbar[1],$game_temp.varbar[2]].min
      else
        $game_variables[$game_temp.varbar[8]] = [$game_temp.varbar[1],$game_temp.varbar[9]].max
      end
    end
  end
 
  def direction
    if $game_temp.varbar[0] < $game_temp.varbar[1]
      @direction = 1
      RPG::SE.new(Galv_VarBar::INIT_U_SE[0], Galv_VarBar::INIT_U_SE[1], Galv_VarBar::INIT_U_SE[2]).play
    else
      @direction = 0
      RPG::SE.new(Galv_VarBar::INIT_D_SE[0], Galv_VarBar::INIT_D_SE[1], Galv_VarBar::INIT_D_SE[2]).play
    end
  end
 
  def dispose
    @show_count = 0
    contents.dispose unless disposed?
    @cover.bitmap.dispose unless disposed? || @cover.nil?
    @cover.dispose unless disposed? || @cover.nil?
    super
  end
  
  def refresh
    contents.clear
    if @cgraphic != $game_temp.vargraphic
      if !@cover.nil?
        @cover.bitmap = Cache.system($game_temp.vargraphic)
        @cgraphic = $game_temp.vargraphic
      end
    end
    draw_varbar(0, 0, window_width)
    draw_heading(@text_rect.x, @text_rect.y, $game_temp.varbar[4]) if !@text_rect.nil?
    if $game_temp.varbar[0] < $game_temp.varbar[1] && @direction == 1
      if @show_count % Galv_VarBar::SE_SPEED == 0 && $game_temp.varbar[0] < $game_temp.varbar[2]
    return 0 if $game_temp.varbar[0] == $game_temp.varbar[9]
        RPG::SE.new(Galv_VarBar::RAISE_SE[0], Galv_VarBar::RAISE_SE[1], Galv_VarBar::RAISE_SE[2]).play
      end
      $game_temp.varbar[0] += @fill_rate
    elsif $game_temp.varbar[0] > $game_temp.varbar[1] && @direction == 0
      if @show_count % Galv_VarBar::SE_SPEED == 0 && $game_temp.varbar[0] > $game_temp.varbar[9]
        RPG::SE.new(Galv_VarBar::LOWER_SE[0], Galv_VarBar::LOWER_SE[1], Galv_VarBar::LOWER_SE[2]).play
      end
      $game_temp.varbar[0] += @fill_rate
    end
  end
  
  def draw_heading(x, y, text)
    contents.font.name = Galv_VarBar::TEXT_FONT
    contents.font.size = Galv_VarBar::TEXT_SIZE
    change_color(text_color($game_temp.varbar[7]))
    contents.font.bold = Font.default_bold
    contents.font.italic = Font.default_italic
    text = convert_escape_characters(text)
    pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
    process_character(text.slice!(0, 1), text, pos) until text.empty?
  end
  
  def text_rect
    @text_rect = Rect.new
    @text_rect.width = text_size($game_temp.varbar[4]).width
    @text_rect.height = Galv_VarBar::TEXT_SIZE
    if Galv_VarBar::TEXT_ALIGN == 0
      @text_rect.x = 0 + Galv_VarBar::TEXT_X_OFFSET
    elsif Galv_VarBar::TEXT_ALIGN == 2
      @text_rect.x = Galv_VarBar::BAR_WIDTH - @text_rect.width + Galv_VarBar::TEXT_X_OFFSET
    else
      @text_rect.x = (Galv_VarBar::BAR_WIDTH - @text_rect.width) / 2 + Galv_VarBar::TEXT_X_OFFSET
    end
    @text_rect.y = 0 + Galv_VarBar::TEXT_Y_OFFSET
    @text_rect
  end
  
  def fill_rate
    ($game_temp.varbar[1] - $game_temp.varbar[0]) / (Galv_VarBar::ACTIVE_TIME * 0.5)
  end
 
  def rate
    $game_temp.varbar[0].to_f / $game_temp.varbar[2].to_f
  end
  
  def draw_varbar(x, y, width = 124)
    draw_gauge(x, y, width, rate, text_color($game_temp.varbar[5]), text_color($game_temp.varbar[6]))
    change_color(system_color)
  end
  def standard_padding
    return 0
  end
  
  def draw_gauge(x, y, width, rate, color1, color2)
    fill_w = (width * rate).to_i
    gauge_y = (contents.height - Galv_VarBar::BAR_HEIGHT) / 2
    contents.fill_rect(x, gauge_y, window_width, Galv_VarBar::BAR_HEIGHT, gauge_back_color)
    contents.gradient_fill_rect(x, gauge_y, fill_w, Galv_VarBar::BAR_HEIGHT, color1, color2)
  end
 
  def draw_cover
    @cover = Sprite.new
    @cover.bitmap = Cache.system($game_temp.vargraphic)
    @cgraphic = $game_temp.vargraphic
    @cover.x = (Graphics.width - @cover.bitmap.width) / 2 + Galv_VarBar::BAR_IMAGE_X
    @cover.y = Galv_VarBar::BAR_IMAGE_Y
    @cover.z = z - 1
    @cover.opacity = 0
  end
 
end # Window_VarBar < Window_Base




Verehn - posté le 23/12/2016 à 01:54:14 (9054 messages postés) - honor

❤ 0

Vhehrhehn

Sans m'y connaître j'ai l'impression qu'il n'y a qu'un seul lot de coordonnées X Y à définir donc une seul barre visible.

Eldrao ~ PakuPaku ~ Winged Light ~ Ruin ~ Ma galerie ~ LTDAD ~ Don de graphismes plateforme 2D


no0ony - posté le 23/12/2016 à 20:33:34 (401 messages postés)

❤ 0

Oui mais ma question découle justement si il y avais moyens de modifier ce script pour en ajouter d'autres (des jauges)


DeadPool98 - posté le 23/12/2016 à 20:44:51 (47 messages postés)

❤ 0

Je suis un carton...

Je pense qu'en recopiant ton script et en changeant l'ensemble des variables
qu'il comporte de façon explicite il y aurait effectivement moyen d'avoir une deuxième barre.

J'avais un script où je voulais ajouter quelque chose de semblable à ce que tu cherche: j'ai fais ce que je t'ai dit, et ne m'y connaissant pas en ruby j'ai mis quasiment une bonne heure.

Attention quand même de changer le positionnement sur l'axe des y de ta nouvelle barre!

Je vais voir si je peux faire quelque chose :grossourire

J'aime les shorts, ça garde les genoux bien au frais!


no0ony - posté le 23/12/2016 à 21:20:01 (401 messages postés)

❤ 0

J'y avais pensé mais mon niveau en ruby n'est pas très fort.
Je te remercie d'avance :)

Index du forum > Entraide > [RESOLU] [Rpg maker vx ACE] Jauge multiple

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