Bienvenue visiteur !
|
Statistiques
Liste des membres
Contact
Mentions légales
614 connectés actuellement
30729214 visiteurs depuis l'ouverture
2831 visiteurs aujourd'hui
Partenaires
Tous nos partenaires
Devenir partenaire
|
❤ 0 Ecrit par Jet, ce script vous permet d'afficher des pops up de dégat, de statut et autre pendant les combats.
Source : Lien
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
| #=============================================================
# Battle Pop-Ups
# By Jet10985 (Jet)
#=================================================================
# This script will create and show pop-ups for multiple battle events such as
# hp/mp/tp loss and being inflicted with states.
# This script has: 25 customization options.
#=================================================================
# Overwritten Methods:
# None
#-------------------------------------------------------------------------------
# Aliased methods:
# Game_Actor: level_up, gain_exp
# Game_Battler: add_state
# Sprite_Battler: initialize, update, dispose, start_new_effect
#=================================================================
module Jet
module BattlePopUps
# This is the name of the font you want to use for pop-ups.
POPUP_FONT = "Verdana"
# The text and color shown when a character is knocked out (dies).
KNOCKOUT_TEXT = "Knockout"
KNOCKOUT_COLOR = Color.new(255, 167, 0)
# The text and color shown when a character takes damage.
# The actual damage is appended to the end.
HURT_TEXT = "Damage +"
HURT_COLOR = Color.new(255, 0, 0)
HURT_TEXT_MP = "Mana -"
HURT_COLOR_MP = Color.new(225, 30, 255)
HURT_TEXT_TP = "TP -"
HURT_COLOR_TP = Color.new(225, 30, 35)
# The text and color shown when a character heals health.
# The actual health is appended to the end.
HEAL_TEXT = "Heal +"
HEAL_COLOR = Color.new(0, 255, 0)
HEAL_TEXT_MP = "Mana +"
HEAL_COLOR_MP = Color.new(35, 200, 255)
HEAL_TEXT_TP = "TP +"
HEAL_COLOR_TP = Color.new(35, 35, 255)
# The text and color shown when a character gains exp.
# The actual exp is appended to the end.
EXP_PLUS_TEXT = "EXP +"
EXP_PLUS_COLOR = Color.new(167, 167, 0)
# The text and color shown when an attack is critical.
CRITICAL_TEXT = "Critical"
CRITICAL_COLOR = Color.new(255, 106, 43)
# The text and color shown when an attack misses.
MISSED_TEXT = "Miss"
MISS_COLOR = Color.new(45, 78, 99)
# The text and color shown when an attack is evaded.
EVADED_TEXT = "Evaded"
EVADE_COLOR = Color.new(156, 187, 255)
# The text, color, and animation shown when a character levels up.
# For no animation, use 0.
LEVEL_TEXT = "Level Up"
LEVEL_COLOR = Color.new(167, 255, 52)
# These are the colors used for displaying when a state is added.
# It follows this format: state_id => Color.new(r, g, b)
STATE_ADDED_COLORS = {
2 => Color.new(128, 0, 255),
3 => Color.new(128, 0, 255),
4 => Color.new(128, 0, 255)
}
# This is the default state added color.
STATE_ADDED_COLORS.default = Color.new(128, 0, 255)
end
end
#=================================================================
# DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
#=================================================================
($imported ||= {})[:jet] ||= {}
$imported[:jet][:BattlePopUps] = true
class Game_Actor
alias jet4921_level_up level_up
def level_up(*args, &block)
jet4921_level_up(*args, &block)
unless self.exp >= next_level_exp and next_level_exp > 0
make_popup(Jet::BattlePopUps::LEVEL_TEXT, Jet::BattlePopUps::LEVEL_COLOR)
end
end
alias jet1029_gain_exp gain_exp
def gain_exp(exp)
make_popup(Jet::BattlePopUps::EXP_PLUS_TEXT + exp.to_s, Jet::BattlePopUps::EXP_PLUS_COLOR)
jet1029_gain_exp(exp)
end
end
class Game_Battler
alias jet8573_add_state add_state
def add_state(sid)
before = state?(sid)
jet8573_add_state(sid)
return if before == state?(sid)
if sid == death_state_id
make_popup(Jet::BattlePopUps::KNOCKOUT_TEXT, Jet::BattlePopUps::KNOCKOUT_COLOR)
else
make_popup("+#{$data_states[sid].name}", Jet::BattlePopUps::STATE_ADDED_COLORS[sid])
end
end
def make_popup(text, color)
return unless SceneManager.scene_is?(Scene_Battle)
f = self.battle_sprite; return if f.nil?
f.popups.unshift(Sprite_JetPopup.new(text.to_s, color, f)) if !f.nil?
end
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 Scene_Battle
attr_reader :spriteset
end
class Sprite_JetPopup < Sprite_Base
def initialize(text, color, obj)
super(nil)
@text = text
@color = color
@character = obj
self.visible = false
@y_prog = 0
form_self
end
def form_self
samp = Bitmap.new(1, 1)
self.bitmap = Bitmap.new(samp.text_size(@text).width, 24)
self.bitmap.font.color = @color
self.bitmap.font.name = Jet::BattlePopUps::POPUP_FONT
self.bitmap.draw_text(0, 0, self.bitmap.width, 24, @text)
self.x = @character.x - (self.bitmap.width / 2)
self.x += (@character.src_rect.width / 2) if @character.battler.actor?
self.y = @character.battler.enemy? ? @character.y : (@character.y + @character.src_rect.height)
self.y += @character.src_rect.height if @character.battler.actor?
samp.dispose
end
def update
super
self.x = @character.x - (self.bitmap.width / 2)
if $imported[:jet][:AnimatedBattlers]
self.x += (@character.src_rect.width / 2) if @character.battler.actor?
end
self.y = @character.y - 16 - @y_prog
if $imported[:jet][:AnimatedBattlers]
self.y += @character.src_rect.height if @character.battler.actor?
end
@y_prog += 1
self.opacity -= 2.125
if self.opacity <= 0
self.dispose
end
end
end
class Sprite_Battler
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 |
Version sans affichage des TP et MP + tradution en français par Teka II
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
| #=============================================================
# Battle Pop-Ups
# By Jet10985 (Jet)
#=================================================================
# This script will create and show pop-ups for multiple battle events such as
# hp/mp/tp loss and being inflicted with states.
# This script has: 25 customization options.
#=================================================================
# Overwritten Methods:
# None
#-------------------------------------------------------------------------------
# Aliased methods:
# Game_Actor: level_up, gain_exp
# Game_Battler: add_state
# Sprite_Battler: initialize, update, dispose, start_new_effect
#=================================================================
module Jet
module BattlePopUps
# This is the name of the font you want to use for pop-ups.
POPUP_FONT = "Verdana"
# The text and color shown when a character is knocked out (dies).
KNOCKOUT_TEXT = "Mort"
KNOCKOUT_COLOR = Color.new(255, 167, 0)
# The text and color shown when a character takes damage.
# The actual damage is appended to the end.
HURT_TEXT = "Dégâts "
HURT_COLOR = Color.new(255, 0, 0)
# The text and color shown when a character heals health.
# The actual health is appended to the end.
HEAL_TEXT = "Soigné "
HEAL_COLOR = Color.new(0, 255, 0)
# The text and color shown when a character gains exp.
# The actual exp is appended to the end.
EXP_PLUS_TEXT = "EXP "
EXP_PLUS_COLOR = Color.new(167, 167, 0)
# The text and color shown when an attack is critical.
CRITICAL_TEXT = "Critique"
CRITICAL_COLOR = Color.new(255, 106, 43)
# The text and color shown when an attack misses.
MISSED_TEXT = "Raté"
MISS_COLOR = Color.new(45, 78, 99)
# The text and color shown when an attack is evaded.
EVADED_TEXT = "Esquive"
EVADE_COLOR = Color.new(156, 187, 255)
# The text, color, and animation shown when a character levels up.
# For no animation, use 0.
LEVEL_TEXT = "Level Up"
LEVEL_COLOR = Color.new(167, 255, 52)
# These are the colors used for displaying when a state is added.
# It follows this format: state_id => Color.new(r, g, b)
STATE_ADDED_COLORS = {
2 => Color.new(128, 0, 255),
3 => Color.new(128, 0, 255),
4 => Color.new(128, 0, 255)
}
# This is the default state added color.
STATE_ADDED_COLORS.default = Color.new(128, 0, 255)
end
end
#=================================================================
# DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
#=================================================================
($imported ||= {})[:jet] ||= {}
$imported[:jet][:BattlePopUps] = true
class Game_Actor
alias jet4921_level_up level_up
def level_up(*args, &block)
jet4921_level_up(*args, &block)
unless self.exp >= next_level_exp and next_level_exp > 0
make_popup(Jet::BattlePopUps::LEVEL_TEXT, Jet::BattlePopUps::LEVEL_COLOR)
end
end
alias jet1029_gain_exp gain_exp
def gain_exp(exp)
make_popup(Jet::BattlePopUps::EXP_PLUS_TEXT + exp.to_s, Jet::BattlePopUps::EXP_PLUS_COLOR)
jet1029_gain_exp(exp)
end
end
class Game_Battler
alias jet8573_add_state add_state
def add_state(sid)
before = state?(sid)
jet8573_add_state(sid)
return if before == state?(sid)
if sid == death_state_id
make_popup(Jet::BattlePopUps::KNOCKOUT_TEXT, Jet::BattlePopUps::KNOCKOUT_COLOR)
else
make_popup("+#{$data_states[sid].name}", Jet::BattlePopUps::STATE_ADDED_COLORS[sid])
end
end
def make_popup(text, color)
return unless SceneManager.scene_is?(Scene_Battle)
f = self.battle_sprite; return if f.nil?
f.popups.unshift(Sprite_JetPopup.new(text.to_s, color, f)) if !f.nil?
end
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 Scene_Battle
attr_reader :spriteset
end
class Sprite_JetPopup < Sprite_Base
def initialize(text, color, obj)
super(nil)
@text = text
@color = color
@character = obj
self.visible = false
@y_prog = 0
form_self
end
def form_self
samp = Bitmap.new(1, 1)
self.bitmap = Bitmap.new(samp.text_size(@text).width, 24)
self.bitmap.font.color = @color
self.bitmap.font.name = Jet::BattlePopUps::POPUP_FONT
self.bitmap.draw_text(0, 0, self.bitmap.width, 24, @text)
self.x = @character.x - (self.bitmap.width / 2)
self.x += (@character.src_rect.width / 2) if @character.battler.actor?
self.y = @character.battler.enemy? ? @character.y : (@character.y + @character.src_rect.height)
self.y += @character.src_rect.height if @character.battler.actor?
samp.dispose
end
def update
super
self.x = @character.x - (self.bitmap.width / 2)
if $imported[:jet][:AnimatedBattlers]
self.x += (@character.src_rect.width / 2) if @character.battler.actor?
end
self.y = @character.y - 16 - @y_prog
if $imported[:jet][:AnimatedBattlers]
self.y += @character.src_rect.height if @character.battler.actor?
end
@y_prog += 1
self.opacity -= 2.125
if self.opacity <= 0
self.dispose
end
end
end
class Sprite_Battler
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).new(0)
@battler_struct.hp = @battler.hp
end
check_success_popup
check_hp_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
end |
Mis à jour le 20 octobre 2020.
|
aazzlaaroth -
posté le 19/02/2012 à 13:55:50 (46 messages postés)
| Support for S.I.D.A, pour un avenir meilleur(Propagandiste professionnel) | Ah Tata j'ai un souci
Ligne 139 visiblement, je me prends un "syntax error occured"
J'ai ouvert un nouveau projet pour tester le script et ce message m'empêche de réussir. Pourtant ton script à l'air pas mal, j'aimerais bien l'utiliser, quelqu'un pourrait-il m'aider?
|
Une clope, des chips au paprika, RMVXace, et normalement, c'est bon tu peux maker. Sauvez la planète, faites votre bonne action vis à vis de l'humanité ====> Soutenez le S.I.D.A !! |
crackerwood -
posté le 04/04/2012 à 11:18:13 (176 messages postés)
| | Remplace la ligne 139 par
.
C'est un bug de la balise code
|
CMS event--PHS--Blackjack--PHS event VX |
aazzlaaroth -
posté le 11/04/2012 à 17:17:30 (46 messages postés)
| Support for S.I.D.A, pour un avenir meilleur(Propagandiste professionnel) | Oki merki ^^
|
Une clope, des chips au paprika, RMVXace, et normalement, c'est bon tu peux maker. Sauvez la planète, faites votre bonne action vis à vis de l'humanité ====> Soutenez le S.I.D.A !! |
Chaös17 -
posté le 12/04/2012 à 15:04:21 (868 messages postés)
| | Il n'est pas comptable avec le script suivant : http://yanflychannel.wordpress.com/rmvxa/battle-scripts/ace-battle-engine/
|
Blog of Chaos17 |
Aircrack -
posté le 16/07/2012 à 18:06:07 (4 messages postés)
| | Moi j'ai une erreur =S
J'ai pris un screenshot...
http://img15.hostingpics.net/pics/669340Sanstitre.png
|
Ryukko -
posté le 11/01/2013 à 00:15:13 (30 messages postés)
| | Salut!
Super ces tutos!
Est-ce normal que lorsque les domages sont supérieurs à 100, le pop up soit erroné et se stop a 100?
Peut-on y remedier, je suis quelque peu novice en la matière ^^
|
roj13 -
posté le 15/01/2013 à 08:27:28 (19 messages postés)
| sauvez le bambou, mangez un panda | Si tu as tester sur des slime c'est normal ells n'ont pas plus de 100 PV. Ce n'est pas u bug.
|
mieux vaut rater un baiser que baiser un rater |
Tata Monos -
posté le 15/01/2013 à 14:11:26 (28 messages postés)
| Compte Non utilisé | Oué, je viens de tester, En montant les PV du slim à plus de 100, ça affiche bien les dommages supérieur à 100.
|
jejeas -
posté le 21/04/2013 à 07:38:32 (25 messages postés)
| La neige au Canada c'est froid. | Je... suis très nul avec les script. Je doit le mettre où celui là? o:
|
Move that gears up ! |
the-tzernak -
posté le 07/07/2013 à 23:12:32 (2 messages postés)
| | Merci pour ce script^^
|
itashi76 -
posté le 15/07/2013 à 17:42:30 (54 messages postés)
| Tranquille | très bon script perso je les modifié un peu pour qu'il n'affiche pas les gains de TP vus que je ne les utilise pas.
|
Le savoir est une arme |
Teka II -
posté le 04/04/2015 à 21:20:49 (1 messages postés)
| | J'ai fais des modifications au script (pour ce que ça intéresse):
-Traduction française des pop-up
-On ne voit plus le pop-up de PT
-On ne voit plus le pop-up de PM
Et c'est tout
(Ce script doit remplacer le script de base)
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
| #=============================================================
# Battle Pop-Ups
# By Jet10985 (Jet)
#=================================================================
# This script will create and show pop-ups for multiple battle events such as
# hp/mp/tp loss and being inflicted with states.
# This script has: 25 customization options.
#=================================================================
# Overwritten Methods:
# None
#-------------------------------------------------------------------------------
# Aliased methods:
# Game_Actor: level_up, gain_exp
# Game_Battler: add_state
# Sprite_Battler: initialize, update, dispose, start_new_effect
#=================================================================
module Jet
module BattlePopUps
# This is the name of the font you want to use for pop-ups.
POPUP_FONT = "Verdana"
# The text and color shown when a character is knocked out (dies).
KNOCKOUT_TEXT = "Mort"
KNOCKOUT_COLOR = Color.new(255, 167, 0)
# The text and color shown when a character takes damage.
# The actual damage is appended to the end.
HURT_TEXT = "Dégâts "
HURT_COLOR = Color.new(255, 0, 0)
# The text and color shown when a character heals health.
# The actual health is appended to the end.
HEAL_TEXT = "Soigné "
HEAL_COLOR = Color.new(0, 255, 0)
# The text and color shown when a character gains exp.
# The actual exp is appended to the end.
EXP_PLUS_TEXT = "EXP "
EXP_PLUS_COLOR = Color.new(167, 167, 0)
# The text and color shown when an attack is critical.
CRITICAL_TEXT = "Critique"
CRITICAL_COLOR = Color.new(255, 106, 43)
# The text and color shown when an attack misses.
MISSED_TEXT = "Raté"
MISS_COLOR = Color.new(45, 78, 99)
# The text and color shown when an attack is evaded.
EVADED_TEXT = "Esquive"
EVADE_COLOR = Color.new(156, 187, 255)
# The text, color, and animation shown when a character levels up.
# For no animation, use 0.
LEVEL_TEXT = "Level Up"
LEVEL_COLOR = Color.new(167, 255, 52)
# These are the colors used for displaying when a state is added.
# It follows this format: state_id => Color.new(r, g, b)
STATE_ADDED_COLORS = {
2 => Color.new(128, 0, 255),
3 => Color.new(128, 0, 255),
4 => Color.new(128, 0, 255)
}
# This is the default state added color.
STATE_ADDED_COLORS.default = Color.new(128, 0, 255)
end
end
#=================================================================
# DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
#=================================================================
($imported ||= {})[:jet] ||= {}
$imported[:jet][:BattlePopUps] = true
class Game_Actor
alias jet4921_level_up level_up
def level_up(*args, &block)
jet4921_level_up(*args, &block)
unless self.exp >= next_level_exp and next_level_exp > 0
make_popup(Jet::BattlePopUps::LEVEL_TEXT, Jet::BattlePopUps::LEVEL_COLOR)
end
end
alias jet1029_gain_exp gain_exp
def gain_exp(exp)
make_popup(Jet::BattlePopUps::EXP_PLUS_TEXT + exp.to_s, Jet::BattlePopUps::EXP_PLUS_COLOR)
jet1029_gain_exp(exp)
end
end
class Game_Battler
alias jet8573_add_state add_state
def add_state(sid)
before = state?(sid)
jet8573_add_state(sid)
return if before == state?(sid)
if sid == death_state_id
make_popup(Jet::BattlePopUps::KNOCKOUT_TEXT, Jet::BattlePopUps::KNOCKOUT_COLOR)
else
make_popup("+#{$data_states[sid].name}", Jet::BattlePopUps::STATE_ADDED_COLORS[sid])
end
end
def make_popup(text, color)
return unless SceneManager.scene_is?(Scene_Battle)
f = self.battle_sprite; return if f.nil?
f.popups.unshift(Sprite_JetPopup.new(text.to_s, color, f)) if !f.nil?
end
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 Scene_Battle
attr_reader :spriteset
end
class Sprite_JetPopup < Sprite_Base
def initialize(text, color, obj)
super(nil)
@text = text
@color = color
@character = obj
self.visible = false
@y_prog = 0
form_self
end
def form_self
samp = Bitmap.new(1, 1)
self.bitmap = Bitmap.new(samp.text_size(@text).width, 24)
self.bitmap.font.color = @color
self.bitmap.font.name = Jet::BattlePopUps::POPUP_FONT
self.bitmap.draw_text(0, 0, self.bitmap.width, 24, @text)
self.x = @character.x - (self.bitmap.width / 2)
self.x += (@character.src_rect.width / 2) if @character.battler.actor?
self.y = @character.battler.enemy? ? @character.y : (@character.y + @character.src_rect.height)
self.y += @character.src_rect.height if @character.battler.actor?
samp.dispose
end
def update
super
self.x = @character.x - (self.bitmap.width / 2)
if $imported[:jet][:AnimatedBattlers]
self.x += (@character.src_rect.width / 2) if @character.battler.actor?
end
self.y = @character.y - 16 - @y_prog
if $imported[:jet][:AnimatedBattlers]
self.y += @character.src_rect.height if @character.battler.actor?
end
@y_prog += 1
self.opacity -= 2.125
if self.opacity <= 0
self.dispose
end
end
end
class Sprite_Battler
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).new(0)
@battler_struct.hp = @battler.hp
end
check_success_popup
check_hp_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
end |
|
Lespartiate -
posté le 11/12/2015 à 22:58:55 (15 messages postés)
| | Génial!! merci sa marche nickel!
| |
|
|