HP & SP do inimigo na batalha
2 participantes
Página 1 de 1
HP & SP do inimigo na batalha
Este script é muito simples e faz com que quando o cursor estiver sobre o inimigo, mostre o Hp e o Sp!
- Código:
#==============================================================================
# Meter Enemy Hp & Sp
# By Resource manager
#--------------------------------------------------------------------------
# Criado por Deibson Melciades Hatake (30.09.06)
# Baseado no script do Tetra-z
#==============================================================================
#
# Quando o cursor estiver sobre o inimigo durante a batalha, aparecerá a o HP e o Sp
# do inimigo, assim como as barras coloridas na janela de Help.
#
#==============================================================================
# Class Window_Base por Hatake
#==============================================================================
class Window_Base < Window
def draw_barra_hp(actor, x, y, width = 150, height = 4)
w = width * actor.hp / actor.maxhp
hp_color_1 = Color.new(0, 255, 0, 192)
hp_color_2 = Color.new(0, 255, 255, 192)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
end
# Barra de MP
def draw_barra_sp(actor, x, y, width = 150, height = 4)
w = width * actor.sp / actor.maxsp
hp_color_1 = Color.new( 255, 255, 0, 192)
hp_color_2 = Color.new( 255, 100, 0, 192)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
end
# Draw_Line
def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
distance = (start_x - end_x).abs + (start_y - end_y).abs
if end_color == start_color
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
self.contents.fill_rect(x, y, width, width, start_color)
end
else
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
r = start_color.red * (distance-i)/distance + end_color.red * i/distance
g = start_color.green * (distance-i)/distance + end_color.green * i/distance
b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
end
end
end
#==============================================================================
# ? Game_Temp
#==============================================================================
class Game_Temp
attr_accessor :action_input_actor
end
#==============================================================================
# ? Window_Help
#==============================================================================
class Window_Help < Window_Base
def see_through_element_all
return 0
end
def see_through_element_self
return 0
end
def enemy_status_searched(enemy)
return true if $data_enemies[enemy.id].element_ranks[see_through_element_self] < 3
return true if $data_enemies[enemy.id].element_ranks[see_through_element_all] < 3
unless (see_through_element_self <= 0 or
$data_enemies[enemy.id].element_ranks[see_through_element_self] > 3)
actor = $game_temp.action_input_actor
if ($data_classes[actor.class_id].element_ranks[see_through_element_self] < 3 or
actor.equip_element_set.include?(see_through_element_self))
return true
end
end
unless (see_through_element_all <= 0 or
$data_enemies[enemy.id].element_ranks[see_through_element_all] > 3)
for actor in $game_party.actors
if (($data_classes[actor.class_id].element_ranks[see_through_element_all] < 3 or
actor.equip_element_set.include?(see_through_element_all)) and
actor.movable?)
return true
end
end
end
return false
end
def draw_actor_name(actor, x, y)
if actor.is_a?(Game_Actor)
return super
end
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 192, 32, actor.name)
end
alias tetraz28_set_enemy set_enemy
def set_enemy(enemy)
if enemy_status_searched(enemy) and !Input.press?(Input::A)
if (enemy != @actor or @enemy.nil? or
[enemy.states, enemy.hp, enemy.maxhp, enemy.sp, enemy.maxsp] != @enemy)
self.contents.clear
draw_actor_name(enemy, 4, 0)
draw_actor_state(enemy, 196, 0)
draw_actor_hp(enemy, 299, 0)
draw_actor_sp(enemy, 460, 0)
draw_barra_hp(enemy, 290, 26)
draw_barra_sp(enemy, 450, 26)
@actor = enemy
@enemy = [enemy.states, enemy.hp, enemy.maxhp, enemy.sp, enemy.maxsp]
@text = nil
end
self.visible = true
else
tetraz28_set_enemy(enemy)
end
end
end
#==============================================================================
# ? Scene_Battle
#==============================================================================
class Scene_Battle
alias tetraz28_update_phase3_enemy_select update_phase3_enemy_select
def update_phase3_enemy_select
$game_temp.action_input_actor = @active_battler
tetraz28_update_phase3_enemy_select
end
end
natan- Estudante
- Mensagens : 26
Re: HP & SP do inimigo na batalha
Muito bom cara esso vais er otimo por meu projeto online ou melhor ensencial !!! + onde eu devo colocar esses scripts?
Manda PM ou MNS:
jouzinhu@hotmail.com
Manda PM ou MNS:
jouzinhu@hotmail.com
JouTruMunDo- Estudante
- Mensagens : 34
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos