Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Closed TopicStart new topic
> Status Menu Add-on : Elemental Defence Graph Interface, Made by XRXS
SleepingSirenx
post Jan 3 2012, 04:47 AM
Post #1


The SMT Maniac
Group Icon

Group: Revolutionary
Posts: 125
Type: Developer
RM Skill: Undisclosed




Status Menu Add-on : Elemental Defence Graph Interface


Original Author : XRXS, Translation by Me, SleepingSirenx

Introduction
This enables showing a "Graph"-like status for showing Elemental Resistances and other functions which this script can be used for.

Features
•Unlimited number of "Points"
•Easily Customizable For Different Purposes

Script
CODE
#=============================================================================#
# Improved Status Menu - Graph Factors Add-On
# by XRXS
# http://rpgcreative.net/rpgmaker/scripts-33-menu-detat-ameliore.html
# Translated by : SleepingSirenx
# RRRevolution
# All credits goes to XRXS.
#=============================================================================#
# How to use  :
# • Define in the Element Names in the System Tab (F9) the factors you want to
#   use.
# • Define the number of factors you want to use
# • Define the order of the factors where you want it to appear.
#
# To Change the position of the graph, go to line 42
# draw_actor_element_radar_graph(@actor, X, Y)
# and change the values of X and Y.
#=============================================================================#
#=============================================================================#
# Graphic_Def_Elem
#=============================================================================#
class Window_Base
#=====================================#
# Begin Customization                 #
#=====================================#
FONT_SIZE = 18                                         # Font Style
WORD_ELEMENT_GUARD = "Elemental Defence"               # Graph Name
NUMBER_OF_ELEMENTS = 5                                 # Number of Corner Points
ELEMENT_ORDER = [1,2,3,4,5]                            # Order of Element Orders
GRAPH_SCALINE_COLOR = Color.new(255, 255, 255, 128)    # Scanline Color
GRAPH_SCALINE_COLOR_SHADOW = Color.new( 0, 0, 0, 192)  # Scaline Shadow
GRAPH_LINE_COLOR = Color.new(255, 255, 64, 255)        # Graphline Color
GRAPH_LINE_COLOR_MINUS = Color.new( 64, 255, 255, 255) # Graphline Color (-)
GRAPH_LINE_COLOR_PLUS = Color.new(255, 64, 64, 255)    # Graphline Color (+)
#=====================================#
# End of Customization                #
#=====================================#
end
#=============================================================================#
# Window_Status
#=============================================================================#
class Window_Status < Window_Base
alias xrxs_mp4_refresh refresh
def refresh
xrxs_mp4_refresh
draw_actor_element_radar_graph(@actor, 320, 200)
end
#-----------------------------------------------------------------------------#
def draw_actor_element_radar_graph(actor, x, y, radius = 56)
cx = x + radius + FONT_SIZE + 48
cy = y + radius + FONT_SIZE + 32
self.contents.font.color = system_color
self.contents.draw_text(x, y, 104, 32, WORD_ELEMENT_GUARD)
for loop_i in 0..NUMBER_OF_ELEMENTS
if loop_i == 0

else
@pre_x = @now_x
@pre_y = @now_y
@pre_ex = @now_ex
@pre_ey = @now_ey
@color1 = @color2
end
if loop_i == NUMBER_OF_ELEMENTS
eo = ELEMENT_ORDER[0]
else
eo = ELEMENT_ORDER[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 / NUMBER_OF_ELEMENTS)
@now_x = cx + (radius * Math.cos(th)).floor
@now_y = cy - (radius * Math.sin(th)).floor
@now_wx = cx + ((radius+FONT_SIZE*2/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*6/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.size = FONT_SIZE
self.contents.font.color = system_color
self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*2, 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)
end
end
end
#=============================================================================#
# Class Bitmap
#=============================================================================#
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


Customization
The script itself explains how to use this.

Compatibility
The script is aliased with the defined Window_Status update methods, but will collide with some fully customized Status screens that defined Window_Base methods and Window_Status methods in a strange way.

Screenshot


DEMO
No Demo Required.

Installation
Place Above Main and Bellow Custom Scripts/Scene_Debug

FAQ
None.

Terms and Conditions
I take no credit for this script. Just wanted to share some scripts.
Just credit XRXS. smile.gif

Credits
XRXS for his wonderful script and base of this.


__________________________

My First Game .... Yeah .... ~♥
I'm In Need Of A Team To Help Me WIth The Development Of My Game PM Me. :)
- DEMO's On Progress!

I Support This Projects!



Please Teach Me How To Script. :(
I'm Learning How To Script. But Still Teach Me How To Script :)
Damn THERMODYNAMICS! Makes My Head Spin!
Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 22nd May 2013 - 12:13 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker