• Anmelden

1

Donnerstag, 3. November 2011, 19:21

Schriftart von SP- und LP-Anzeige im Kampf?

Hallo,

ich glaub ich dreh langsam durch.

Ich benutze ein Skript, das im Kampf die SP und HP von Gegnern anzeigt, SP und HP von Helden werdern auch angezeigt.
Die Schriftarten der Anzeige der Helden und die der Anzeige der Gegner kann ich beide ändern, aber selbst wenn ich bei beiden das gleiche einstelle, sieht die SP- und HP-Anzeige bei den Gegnern anders aus als die bei den Helden.

Hat jemand eine Idee warum?

Spoiler: Skript zur SP- und HP-Anzeige für Gegner

Ruby Quellcode

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
#==============================================================================
#HP und SP anzeigen
#==============================================================================
module PLAN_HPSP_DRAW
 FONT_NAME     	= ["Tahoma"] # Original: Arial
 FONT_SIZE     	=  18                        	
 FONT_BOLD     	= false                          	
 FONT_ITALIC   	= false                          	
 
 DRAW_NAME     	= false                	
 DRAW_HP       	= true                	
 DRAW_SP       	= true                          	
 
 DRAW_WIDTH    	=  80                           	
 DRAW_HEIGHT   	= 3 * 32                        	
 DRAW_SPACE    	=   0                           	
 DRAW_Y        	=  24                           	
end
 
 
#==============================================================================
#Sprite_Battler
#==============================================================================
 
class Sprite_Battler < RPG::Sprite
 #--------------------------------------------------------------------------
 alias plan_enemy_hpsp_draw_initialize initialize
 def initialize(viewport, battler = nil)
   plan_enemy_hpsp_draw_initialize(viewport, battler)
   if @battler.is_a?(Game_Enemy)
 	width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
 	height = PLAN_HPSP_DRAW::DRAW_HEIGHT + 32
 	x = @battler.screen_x - width / 2
 	y = @battler.screen_y - height + 32 + PLAN_HPSP_DRAW::DRAW_Y
 	@enemy_hpsp_window = Window_Base.new(x, y, width, height)
 	@enemy_hpsp_window.contents = Bitmap.new(width - 32, height - 32)
 	@enemy_hpsp_window.contents.font.name = PLAN_HPSP_DRAW::FONT_NAME
 	@enemy_hpsp_window.contents.font.size = PLAN_HPSP_DRAW::FONT_SIZE
 	@enemy_hpsp_window.contents.font.bold = PLAN_HPSP_DRAW::FONT_BOLD
 	@enemy_hpsp_window.contents.font.italic = PLAN_HPSP_DRAW::FONT_ITALIC
 	y = 0
 	@old_enemy_hpsp = []
 	one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
 	if PLAN_HPSP_DRAW::DRAW_NAME
   	@enemy_hpsp_window.draw_actor_name(@battler, 0, y, width - 32)
   	y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
   	@old_enemy_hpsp.push(@battler.name)
 	end
 	if PLAN_HPSP_DRAW::DRAW_HP
   	@enemy_hpsp_window.draw_actor_hp(@battler, 0, y, width - 32)
   	y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
   	@old_enemy_hpsp.push(@battler.hp)
 	end
 	if PLAN_HPSP_DRAW::DRAW_SP
   	@enemy_hpsp_window.draw_actor_sp(@battler, 0, y, width - 32)
   	@old_enemy_hpsp.push(@battler.sp)
 	end
 	@enemy_hpsp_window.opacity = 0
 	@enemy_hpsp_window.contents_opacity = 0
 	@enemy_hpsp_window.z = -2
   end
 end
 #--------------------------------------------------------------------------
 alias plan_enemy_hpsp_draw_dispose dispose
 def dispose
   if @battler.is_a?(Game_Enemy)
 	@enemy_hpsp_window.dispose
   end
   plan_enemy_hpsp_draw_dispose
 end
 #--------------------------------------------------------------------------
 alias plan_enemy_hpsp_draw_update update
 def update
   plan_enemy_hpsp_draw_update
   if @battler.is_a?(Game_Enemy)
 	@enemy_hpsp_window.visible = @battler_visible
 	width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
 	@enemy_hpsp_window.x = self.x - width / 2
 	@now_enemy_hpsp = []
 	if PLAN_HPSP_DRAW::DRAW_NAME
   	@now_enemy_hpsp.push(@battler.name)
 	end
 	if PLAN_HPSP_DRAW::DRAW_HP
   	@now_enemy_hpsp.push(@battler.hp)
 	end
 	if PLAN_HPSP_DRAW::DRAW_SP
   	@now_enemy_hpsp.push(@battler.sp)
 	end
 	if @old_enemy_hpsp != @now_enemy_hpsp and $game_temp.enemy_hpsp_refresh
   	@old_enemy_hpsp = @now_enemy_hpsp
   	@enemy_hpsp_window.contents.clear
   	y = 0
   	width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
   	one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
   	if PLAN_HPSP_DRAW::DRAW_NAME
     	@enemy_hpsp_window.draw_actor_name(@battler, 0, y, width - 32)
     	y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
   	end
   	if PLAN_HPSP_DRAW::DRAW_HP
     	@enemy_hpsp_window.draw_actor_hp(@battler, 0, y, width - 32)
     	y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
   	end
   	if PLAN_HPSP_DRAW::DRAW_SP
     	@enemy_hpsp_window.draw_actor_sp(@battler, 0, y, width - 32)
   	end
   	Graphics.frame_reset
 	end
   end
 end
 #--------------------------------------------------------------------------
 #visible
 #--------------------------------------------------------------------------
 if !method_defined?("plan_enemy_hpsp_draw_visible=")
   alias plan_enemy_hpsp_draw_visible= visible=
 end
 def visible=(bool)
   if @battler.is_a?(Game_Enemy)
 	@enemy_hpsp_window.visible = bool
   end
   self.plan_enemy_hpsp_draw_visible=(bool)
 end
 #--------------------------------------------------------------------------
 if !method_defined?("plan_enemy_hpsp_draw_opacity=")
   alias plan_enemy_hpsp_draw_opacity= opacity=
 end
 def opacity=(n)
   self.plan_enemy_hpsp_draw_opacity=(n)
   if @battler.is_a?(Game_Enemy)
 	@enemy_hpsp_window.contents_opacity = n
   end
 end
 #--------------------------------------------------------------------------
 def damage(value, gefaehrlich, kritisch)
   super(value, gefaehrlich, kritisch)
   bitmap = @_damage_sprite.bitmap
   @_damage_sprite.dispose
   @_damage_sprite = ::Sprite.new(Viewport.new(0, 0, 640, 480))
   @_damage_sprite.bitmap = bitmap
   @_damage_sprite.ox = 80
   @_damage_sprite.oy = 20
   @_damage_sprite.x = self.x
   @_damage_sprite.y = self.y - self.oy / 2
   @_damage_sprite.viewport.z = self.viewport.z + 1000 # Original: +1, +1000, damit Schadenszahl über allem angezeigt wird
   @_damage_sprite.z = 3000 # Unbekannte Wirkung
   @_damage_duration = 40
 end
 #--------------------------------------------------------------------------
 def dispose_damage
   if @_damage_sprite != nil
 	@_damage_sprite.viewport.dispose
   end
   super
 end
end
 
#==============================================================================
#Game_Temp
#==============================================================================
 
class Game_Temp
 #--------------------------------------------------------------------------
 attr_accessor :enemy_hpsp_refresh
 #--------------------------------------------------------------------------
 alias plan_enemy_hpsp_draw_initialize initialize
 def initialize
   plan_enemy_hpsp_draw_initialize
   @enemy_hpsp_refresh = false
 end
end
 
#==============================================================================
#Scene_Battle
#==============================================================================
 
class Scene_Battle
 #--------------------------------------------------------------------------
 alias plan_enemy_hpsp_draw_start_phase1 start_phase1
 def start_phase1
   $game_temp.enemy_hpsp_refresh = true
   plan_enemy_hpsp_draw_start_phase1
 end
 #--------------------------------------------------------------------------
 alias plan_enemy_hpsp_draw_start_phase2 start_phase2
 def start_phase2
   $game_temp.enemy_hpsp_refresh = true #false
   plan_enemy_hpsp_draw_start_phase2
 end
 #--------------------------------------------------------------------------
 alias plan_enemy_hpsp_draw_update_phase4_step5 update_phase4_step5
 def update_phase4_step5
   plan_enemy_hpsp_draw_update_phase4_step5
   $game_temp.enemy_hpsp_refresh = true
 end
 #--------------------------------------------------------------------------
 alias plan_enemy_hpsp_draw_update_phase4_step6 update_phase4_step6
 def update_phase4_step6
   plan_enemy_hpsp_draw_update_phase4_step6
   $game_temp.enemy_hpsp_refresh = false
 end
end
 
#==============================================================================
#Window_Base
#==============================================================================
 
class Window_Base < Window
 #--------------------------------------------------------------------------
 def draw_actor_name(actor, x, y, width = 220, align = 0)
   if $scene.is_a?(Scene_Battle)
 	flag = actor.name.sub!(/\*f/, '').nil? ? false : true
 	self.contents.font.color = Color.new(0, 0, 0, 192)
   self.contents.draw_text(x+1, y, width, 32, actor.name, align)
   self.contents.draw_text(x, y+1, width, 32, actor.name, align)
 end
   self.contents.font.color = normal_color
   self.contents.draw_text(x, y, width, 32, actor.name, align)
 end
 
 alias draw_actor_hp_original draw_actor_hp
 def draw_actor_hp(actor, x, y, width = 144)
#Calculate if there is draw space for MaxHP
	if width - 32 >= 108
  	hp_x = x + width - 108
  	flag = true
	elsif width - 32 >= 48
  	hp_x = x + width - 48
  	flag = false
	end
#Draw Shadow Effects for Battles
	if $scene.is_a?(Scene_Battle)
  	self.contents.font.color = Color.new(0, 0, 0, 192)
  	self.contents.draw_text(x, y+1, 32, 32, $data_system.words.hp)
  	self.contents.draw_text(x+1, y, 32, 32, $data_system.words.hp)
  	self.contents.draw_text(hp_x, y+1, 48, 32, actor.hp.to_s, 2)
  	self.contents.draw_text(hp_x+1, y, 48, 32, actor.hp.to_s, 2)
  	if flag
    	self.contents.draw_text(hp_x + 49, y, 12, 32, "/", 1)
    	self.contents.draw_text(hp_x + 48, y+1, 12, 32, "/", 1)
    	self.contents.draw_text(hp_x + 60, y+1, 48, 32, actor.maxhp.to_s)
    	self.contents.draw_text(hp_x + 61, y, 48, 32, actor.maxhp.to_s)
  	end
	end
#Draw "HP" text string
	self.contents.font.color = system_color
	self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
#Draw HP
	self.contents.font.color = actor.hp == 0 ? knockout_color :
  	actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
	self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
#Draw MaxHP
	if flag
  	self.contents.font.color = normal_color
  	self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
  	self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
	end
  end
 
  alias draw_actor_sp_original draw_actor_sp
  def draw_actor_sp(actor, x, y, width = 144)
#Calculate if there is draw space for MaxHP
	if width - 32 >= 108
  	sp_x = x + width - 108
  	flag = true
	elsif width - 32 >= 48
  	sp_x = x + width - 48
  	flag = false
	end
#Draw Shadow Effects for Battles
	if $scene.is_a?(Scene_Battle)
  	self.contents.font.color = Color.new(0, 0, 0, 192)
  	self.contents.draw_text(x, y+1, 32, 32, $data_system.words.sp)
  	self.contents.draw_text(x+1, y, 32, 32, $data_system.words.sp)
  	self.contents.draw_text(sp_x, y+1, 48, 32, actor.sp.to_s, 2)
  	self.contents.draw_text(sp_x+1, y, 48, 32, actor.sp.to_s, 2)
  	# MaxSP ebenfalls anzeigen
#  	self.contents.draw_text(sp_x + 32, y+1, 12, 32, "/", 2)
#  	self.contents.draw_text(sp_x + 33, y, 12, 32, "/", 2)
#  	self.contents.draw_text(sp_x + 48, y+1, 48, 32, actor.maxsp.to_s, 2)
#  	self.contents.draw_text(sp_x + 49, y, 48, 32, actor.maxsp.to_s, 2)
	end
#Draw "SP" text string
	self.contents.font.color = system_color
	self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
	if $game_switches[137] == true # Wenn im Kampf
#Draw SP
  	self.contents.font.color = actor.sp == 0 ? knockout_color :
  	actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  	self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
#Draw MaxSP
  	if flag
    	self.contents.font.color = normal_color
    	self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
    	self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
  	end
	else # Wenn nicht im Kampf
  	self.contents.font.color = normal_color
  	self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
	end
  end
  #--------------------------------------------------------------------------
end
zum Lesen den Text mit der Maus markieren

Irrlicht

Leuchtendes Irgendwas

Motto: Keep shining!

  • Nachricht senden

2

Sonntag, 6. November 2011, 15:57

Mmmm, ich seh in dem Script gerade nur eine Stelle an der man Schriftarten angeben soll, das wäre die Stelle zwischen Zeile 5 und 8, die sich allerdings nur auf die gegnerische Anzeige auswirkt. Oder welche Stellen meintest du genau?

Ansich hab ich aber auch keine Stelle im Script entdeckt, die die Schriftart für das BattleStatus-Fenster ändern würde, entsprechend sollte eigentlich für das Zeichnen der Actor-Werte immernoch die voreingestellte Schriftart und -größe (Font.default_name bzw. Font.default_size) verwendet werden.

Ansonsten fiele mir nur das übliche Verdächtige ein, dass ein anderes Script ebenfalls Einfluss auf die Anzeige nehmen könnte.

3

Montag, 7. November 2011, 11:11

Wenn ich in Zeile 5 die Schriftart ändere, wirkt sich das auf die Anzeige aus, ja.
Nur leider sieht die Anzeige der Gegner trotz gleicher Schrift-art und -größe und gleichen sonstigen Eigenschaften (fett, kursiv) immer viel dünner aus als bei den Helden.
Ich hab einige Schriftarten probiert - Beide Anzeigen verwenden die eingestellte Schriftart, und trotzdem sehen sie nicht gleich aus... Seltsam.

Ich hab es momentan so gelöst, wie es das Skript von Anfang an "vorgeschlagen" hatte:
Eine andere Schriftart für Gegner, die größer und fett.
Jetzt sieht die Anzeige ungefähr gleich "dick" aus wie bei den Helden, die andere Schriftart fällt nur minimal auf.

Verwendete Tags

Font, Kampf, Schriftart

Social Bookmarks