Isto é uma pré-visualização de um tema em Hitskin.com
Instalar o tema • Voltar para a ficha do tema
Elemental Radar Graph
Aldeia RPG :: RPG Maker :: Rpg Maker XP :: Scripts
Página 1 de 1
Elemental Radar Graph
Introdução
Um script que cria uma nova window_status com um radar elemental que calcula a vulnerabilidade a cada elemento de um personagen.
Características
Mostra a fraqueza elemental dos personagens em um grafico.
Screenshots
Como usar
Cole o script acima do main.
Voce pode configurar o numero de elementos que o radar vai calcular e que elementos iram aparecer nestas linhas:
DemoELEMENT_NUMBER = 8 # Numero de elementos NO RADAR.
ELEMENTS = [1, 2, 3, 4, 5, 6, 7, 8] # ID dos elementos que apareceram no radar
Não nescessita.
Script
- Código:
#===============================================================================
# Gráfico de radar elemental
#===============================================================================
class Bitmap
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
if width == 1
self.set_pixel(x, y, start_color)
else
self.fill_rect(x, y, width, width, start_color)
end
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
if width == 1
self.set_pixel(x, y, Color.new(r, g, b, a))
else
self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
end
end
end
end
#==============================================================================
#
#==============================================================================
class MENUSETTINGS
#--------------------------------------------------------------------------
# Constantes de elementos
#--------------------------------------------------------------------------
ELEMENT_NUMBER = 8 # Numeros de elementos en la rueda.
ELEMENTS = [1, 2, 3, 4, 5, 6, 7, 8] # Elementos que apareceran en la rueda, en orden.
end
#===============================================================================
# ■ Window_Base
#===============================================================================
class Window_Base
FONT_SIZE = 16
GRAPH_SCALINE_COLOR = Color.new(255, 255, 255, 128)
GRAPH_SCALINE_COLOR_SHADOW = Color.new( 0, 0, 0, 192)
GRAPH_LINE_COLOR = Color.new(255, 255, 64, 255)
GRAPH_LINE_COLOR_MINUS = Color.new( 64, 255, 255, 255)
GRAPH_LINE_COLOR_PLUS = Color.new(255, 64, 64, 255)
#--------------------------------------------------------------------------
# Proceso de rueda
#--------------------------------------------------------------------------
def draw_actor_element_radar_graph(actor, x, y, radius = 43)
cx = x + radius + FONT_SIZE + 48
cy = y + radius + FONT_SIZE + 32
for loop_i in 0..MENUSETTINGS::ELEMENT_NUMBER
if loop_i != 0
@pre_x = @now_x
@pre_y = @now_y
@pre_ex = @now_ex
@pre_ey = @now_ey
@color1 = @color2
end
if loop_i == MENUSETTINGS::ELEMENT_NUMBER
eo = MENUSETTINGS::ELEMENTS[0]
else
eo = MENUSETTINGS::ELEMENTS[loop_i]
end
er = actor.element_rate(eo)
estr = $data_system.elements[eo]
@color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
er = er.abs
th = Math::PI * (0.5 - 2.0 * loop_i / MENUSETTINGS::ELEMENT_NUMBER)
@now_x = cx + (radius * Math.cos(th)).floor
@now_y = cy - (radius * Math.sin(th)).floor
@now_wx = cx - 6 + ((radius + FONT_SIZE * 3 / 2) * Math.cos(th)).floor - FONT_SIZE
@now_wy = cy - ((radius + FONT_SIZE * 1 / 2) * Math.sin(th)).floor - FONT_SIZE/2
@now_vx = cx + ((radius + FONT_SIZE * 8 / 2) * Math.cos(th)).floor - FONT_SIZE
@now_vy = cy - ((radius + FONT_SIZE * 3 / 2) * Math.sin(th)).floor - FONT_SIZE/2
@now_ex = cx + (er*radius/100 * Math.cos(th)).floor
@now_ey = cy - (er*radius/100 * Math.sin(th)).floor
if loop_i == 0
@pre_x = @now_x
@pre_y = @now_y
@pre_ex = @now_ex
@pre_ey = @now_ey
@color1 = @color2
else
end
next if loop_i == 0
self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
self.contents.font.color = system_color
self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*3.1, FONT_SIZE, estr, 1)
self.contents.font.color = Color.new(255,255,255,128)
self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, er.to_s + "%", 2)
self.contents.font.color = normal_color
end
end
end
#==============================================================================
# ** Window_Status
#==============================================================================
class Window_Status < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 40, 112)
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 4 + 144, 0)
draw_actor_level(@actor, 96, 32)
draw_actor_state(@actor, 96, 64)
draw_actor_hp(@actor, 96, 100, 172)
draw_actor_sp(@actor, 96, 132, 172)
draw_actor_exp(@actor, 96, 164)
#---------------------------------------------------
draw_actor_element_radar_graph(@actor, 300, 20)
#---------------------------------------------------
draw_actor_parameter(@actor, 96, 208, 0)
draw_actor_parameter(@actor, 96, 240, 1)
draw_actor_parameter(@actor, 96, 272, 2)
draw_actor_parameter(@actor, 96, 304, 3)
draw_actor_parameter(@actor, 96, 336, 4)
draw_actor_parameter(@actor, 96, 368, 5)
draw_actor_parameter(@actor, 96, 400, 6)
self.contents.font.color = system_color
self.contents.draw_text(320, 208, 96, 32, "Equipamento")
draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 250)
draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 298)
draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 346)
draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 394)
draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 442)
end
end
samuel6406- Banido
- Mensagens : 49
Créditos : 11
Tópicos semelhantes
» Vengeance Elemental [Recrutamento]
» pergaminho elemental ajuda plz
» [RECRUTAMENTO] ELEMENTAL CARDS (TCGMMO)
» pergaminho elemental ajuda plz
» [RECRUTAMENTO] ELEMENTAL CARDS (TCGMMO)
Aldeia RPG :: RPG Maker :: Rpg Maker XP :: Scripts
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos