المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : [RPGXP] سكربت لاضهار شريط HP\SP\EX على شاشة اللعبه.



Noor Xp
30-03-2008, 02:10 PM
السلام عليكم
هذا اول موضوع لي في هذا المنتدى وحبيت اقدملكم سكربت لأضهار شريط الطاقه والحياة وشريط تعداد نقاط التطور على برنامج RPG Maker Xp نبدأ:

1-ضع هذا الكربت فوق Window_Base:

#------------------------------------------------------------------------------
# Begin Game_Actor Edit
#------------------------------------------------------------------------------
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Return the exp needed to reach the next level
#--------------------------------------------------------------------------
def needed_exp(current_lvl)
return @exp_list[current_lvl + 1]
end
#--------------------------------------------------------------------------
# * Return the currently gained exp
#--------------------------------------------------------------------------
def gained_exp(current_lvl,current_exp)
return (current_exp - @exp_list[current_lvl])
end
#--------------------------------------------------------------------------
# * Return the current level
#--------------------------------------------------------------------------
def lvl
return @level
end
end
#------------------------------------------------------------------------------
# End Game_Actor Edit
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Begin Window_Base Edit
#------------------------------------------------------------------------------
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw HP Bar
#--------------------------------------------------------------------------
def draw_hp_bar(actor,x,y,w = 202)
#get hp and max hp
hp = actor.hp
max_hp = actor.maxhp
#define colors to be used
border_color = Color.new(0,0,0,255)
line1_color = Color.new(0,145,0,255)
line2_color = Color.new(0,176,0,255)
line3_color = Color.new(0,215,0,255)
line4_color = Color.new(0,253,0,255)
line5_color = Color.new(0,215,0,255)
line6_color = Color.new(0,176,0,255)
line7_color = Color.new(0,145,0,255)
line8_color = Color.new(0,120,0,255)
empty_color = Color.new(75,75,75,255)
#get widths and x's
line_width = (((hp * 1.0) / max_hp) * (w - 2))
empty_width = ((w - 2) - line_width)
empty_x = ((x + 1) + line_width)
#make border Rects
border1 = Rect.new(x, y, w, 1)
border2 = Rect.new(x, y + 9, w, 1)
border3 = Rect.new(x, y + 1, 1, 8)
border4 = Rect.new(x + (w - 1), y + 1, 1, 8)
#make line Rects
line1 = Rect.new(x + 1, y + 1, line_width, 1)
line2 = Rect.new(x + 1, y + 2, line_width, 1)
line3 = Rect.new(x + 1, y + 3, line_width, 1)
line4 = Rect.new(x + 1, y + 4, line_width, 1)
line5 = Rect.new(x + 1, y + 5, line_width, 1)
line6 = Rect.new(x + 1, y + 6, line_width, 1)
line7 = Rect.new(x + 1, y + 7, line_width, 1)
line8 = Rect.new(x + 1, y + 8, line_width, 1)
#make empty Rect
empty = Rect.new(empty_x, y + 1, empty_width, 8)
#fill border Rects
self.contents.fill_rect(border1,border_color)
self.contents.fill_rect(border2,border_color)
self.contents.fill_rect(border3,border_color)
self.contents.fill_rect(border4,border_color)
#fill line Rects
self.contents.fill_rect(line1,line1_color)
self.contents.fill_rect(line2,line2_color)
self.contents.fill_rect(line3,line3_color)
self.contents.fill_rect(line4,line4_color)
self.contents.fill_rect(line5,line5_color)
self.contents.fill_rect(line6,line6_color)
self.contents.fill_rect(line7,line7_color)
self.contents.fill_rect(line8,line8_color)
#fill empty Rect
self.contents.fill_rect(empty,empty_color)
end
#--------------------------------------------------------------------------
# * Draw SP Bar
#--------------------------------------------------------------------------
def draw_sp_bar(actor,x,y,w = 202)
#get sp and max sp
sp = actor.sp
max_sp = actor.maxsp
#get percentage width
percentage_width = ((w - 2) / 100)
#define colors to be used
border_color = Color.new(0,0,0,255)
line1_color = Color.new(112,0,223,255)
line2_color = Color.new(130,4,255,255)
line3_color = Color.new(155,55,255,255)
line4_color = Color.new(170,85,255,255)
line5_color = Color.new(155,55,255,255)
line6_color = Color.new(130,4,255,255)
line7_color = Color.new(112,0,223,255)
line8_color = Color.new(88,0,176,255)
empty_color = Color.new(75,75,75,255)
#get widths and x's
line_width = (((sp * 1.0) / max_sp) * (w - 2))
empty_width = ((w - 2) - line_width)
empty_x = ((x + 1) + line_width)
#make border Rects
border1 = Rect.new(x, y, w, 1)
border2 = Rect.new(x, y + 9, w, 1)
border3 = Rect.new(x, y + 1, 1, 8)
border4 = Rect.new(x + (w - 1), y + 1, 1, 8)
#make line Rects
line1 = Rect.new(x + 1, y + 1, line_width, 1)
line2 = Rect.new(x + 1, y + 2, line_width, 1)
line3 = Rect.new(x + 1, y + 3, line_width, 1)
line4 = Rect.new(x + 1, y + 4, line_width, 1)
line5 = Rect.new(x + 1, y + 5, line_width, 1)
line6 = Rect.new(x + 1, y + 6, line_width, 1)
line7 = Rect.new(x + 1, y + 7, line_width, 1)
line8 = Rect.new(x + 1, y + 8, line_width, 1)
#make empty Rect
empty = Rect.new(empty_x, y + 1, empty_width, 8)
#fill border Rects
self.contents.fill_rect(border1,border_color)
self.contents.fill_rect(border2,border_color)
self.contents.fill_rect(border3,border_color)
self.contents.fill_rect(border4,border_color)
#fill line Rects
self.contents.fill_rect(line1,line1_color)
self.contents.fill_rect(line2,line2_color)
self.contents.fill_rect(line3,line3_color)
self.contents.fill_rect(line4,line4_color)
self.contents.fill_rect(line5,line5_color)
self.contents.fill_rect(line6,line6_color)
self.contents.fill_rect(line7,line7_color)
self.contents.fill_rect(line8,line8_color)
#fill empty Rect
self.contents.fill_rect(empty,empty_color)
end
#--------------------------------------------------------------------------
# * Draw EXP Bar
#--------------------------------------------------------------------------
def draw_exp_bar(actor,x,y,w = 202)
#get exp and needed exp
exp = actor.exp
gained_exp = actor.gained_exp(actor.lvl,exp)
needed_exp = actor.needed_exp(actor.lvl)
#define colors to be used
border_color = Color.new(0,0,0,255)
line1_color = Color.new(140,140,0,255)
line2_color = Color.new(157,157,0,255)
line3_color = Color.new(170,170,0,255)
line4_color = Color.new(196,196,0,255)
line5_color = Color.new(170,170,0,255)
line6_color = Color.new(157,157,0,255)
line7_color = Color.new(140,140,0,255)
line8_color = Color.new(128,128,0,255)
empty_color = Color.new(75,75,75,255)
#get widths and x's
line_width = (((gained_exp * 1.0) / needed_exp) * (w - 2))
empty_width = ((w - 2) - line_width)
empty_x = ((x + 1) + line_width)
#make border Rects
border1 = Rect.new(x, y, w, 1)
border2 = Rect.new(x, y + 9, w, 1)
border3 = Rect.new(x, y + 1, 1, 8)
border4 = Rect.new(x + (w - 1), y + 1, 1, 8)
#make line Rects
line1 = Rect.new(x + 1, y + 1, line_width, 1)
line2 = Rect.new(x + 1, y + 2, line_width, 1)
line3 = Rect.new(x + 1, y + 3, line_width, 1)
line4 = Rect.new(x + 1, y + 4, line_width, 1)
line5 = Rect.new(x + 1, y + 5, line_width, 1)
line6 = Rect.new(x + 1, y + 6, line_width, 1)
line7 = Rect.new(x + 1, y + 7, line_width, 1)
line8 = Rect.new(x + 1, y + 8, line_width, 1)
#make empty Rect
empty = Rect.new(empty_x, y + 1, empty_width, 8)
#fill border Rects
self.contents.fill_rect(border1,border_color)
self.contents.fill_rect(border2,border_color)
self.contents.fill_rect(border3,border_color)
self.contents.fill_rect(border4,border_color)
#fill line Rects
self.contents.fill_rect(line1,line1_color)
self.contents.fill_rect(line2,line2_color)
self.contents.fill_rect(line3,line3_color)
self.contents.fill_rect(line4,line4_color)
self.contents.fill_rect(line5,line5_color)
self.contents.fill_rect(line6,line6_color)
self.contents.fill_rect(line7,line7_color)
self.contents.fill_rect(line8,line8_color)
#fill empty Rect
self.contents.fill_rect(empty,empty_color)
end
end
#------------------------------------------------------------------------------
# End Window_Base Edit
#------------------------------------------------------------------------------

ملاحظه:يمكنك تغير الون بتغير بعض الارقام في السكربت الاصلي اللموجوده في:


#define colors to be used
border_color = Color.new(0,0,0,255)
line1_color = Color.new(140,140,0,255)
line2_color = Color.new(157,157,0,255)
line3_color = Color.new(170,170,0,255)
line4_color = Color.new(196,196,0,255)
line5_color = Color.new(170,170,0,255)
line6_color = Color.new(157,157,0,255)
line7_color = Color.new(140,140,0,255)
line8_color = Color.new(128,128,0,255)
empty_color = Color.new(75,75,75,255)

أخر مرحله من السكربت هو لاضهاره على الشاشه ضع هذا السكربت اعلى Main:


class Window_Bars < Window_Base
attr_accessor :actor_id
def initialize
super(0,0,234,190)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = 'Times New Roman'
self.contents.font.size = 22
self.opacity = 100
self.back_opacity = 100
self.visible = false
self.active = false
@actor_id = 0
refresh_stats
end
def refresh_stats
self.contents.clear
actor = $game_party.actors[@actor_id]
draw_actor_name(actor,0,0)
draw_actor_hp(actor,0,32,202)
draw_hp_bar(actor,0,64)
draw_actor_sp(actor,0,74,202)
draw_sp_bar(actor,0,106)
draw_actor_exp(actor,0,116)
draw_exp_bar(actor,0,148)
end
def id(id,type)
if type == 0
@actor_id = id
elsif type == 1
@actor_id += id
elsif type == 2
@actor_id -= id
end
end
def current_id(id)
if @actor_id == id
return true
end
return false
end
def update
refresh_stats
end
end
class Scene_Map
def main
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
@bar_window = Window_Bars.new
@wait_count = 15
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@message_window.dispose
@bar_window.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
def update
loop do
$game_map.update
$game_system.map_interpreter.update
$game_player.update
$game_system.update
$game_screen.update
unless $game_temp.player_transferring
break
end
transfer_player
if $game_temp.transition_processing
break
end
end
if @bar_window.active
if Input.repeat?(Input::L)
if @bar_window.current_id(0)
@bar_window.id(3,0)
else
@bar_window.id(1,2)
end
elsif Input.repeat?(Input::R)
if @bar_window.current_id(3)
@bar_window.id(0,0)
else
@bar_window.id(1,1)
end
end
end
if Input.press?(Input::A) and @wait_count >= 15
if @bar_window.active
@bar_window.active = false
@bar_window.visible = false
@wait_count = 0
else
@bar_window.active = true
@bar_window.visible = true
@wait_count = 0
end
end
@wait_count += 1
@spriteset.update
@message_window.update
@bar_window.update
if $game_temp.gameover
$scene = Scene_Gameover.new
return
end
if $game_temp.to_title
$scene = Scene_Title.new
return
end
if $game_temp.transition_processing
$game_temp.transition_processing = false
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
if $game_temp.message_window_showing
return
end
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
$game_temp.battle_calling = true
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
n = rand($game_map.encounter_list.size)
$game_temp.battle_troop_id = $game_map.encounter_list[n]
end
end
if Input.trigger?(Input::B)
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
if $DEBUG and Input.press?(Input::F9)
$game_temp.debug_calling = true
end
unless $game_player.moving?
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
end

لأضهار الاأشرطه اضغط "Shift"

أي مشكله في السكربت خبروني عنها.

سلام.

Noor Xp
02-04-2008, 02:10 PM
اسف لأن السكربت معقد تم تعديل السكربت.

Noor Xp
02-04-2008, 02:14 PM
هذا هو السكربت الجديد اضفه فوق Main:


HP/SP/EXP Gauge Script v1.00
# Distribution original support URL
# http://members.jcom.home.ne.jp/cogwheel/
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw HP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw HP process
alias :draw_actor_hp_hpsp :draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
# Determine the rate of fill based on the actor's HP and HP Max
if actor.maxhp != 0
rate = actor.hp.to_f / actor.maxhp
else
rate = 0
end
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
# Determine the gauge's width & fill based on the actor's HP
if actor.maxhp != 0
hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
else
hp = 0
end
# Drawing of gauge
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, hp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# Call the original Draw HP process
draw_actor_hp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw SP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw SP process
alias :draw_actor_sp_hpsp :draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
# Determine the rate of fill based on the actor's SP and SP Max
if actor.maxsp != 0
rate = actor.sp.to_f / actor.maxsp
else
rate = 1
end
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(0, 64, 0, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
# Determine the gauge's width & fill based on the actor's SP
if actor.maxsp != 0
sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
else
sp = (width + plus_width) * rate_width / 100
end
# Drawing of gauge
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, sp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# Call the original Draw HP process
draw_actor_sp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw EXP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw HP process
alias :draw_actor_exp_hpsp :draw_actor_exp
def draw_actor_exp(actor, x, y, width = 204)
# Determine the rate of fill based on the actor's EXP and Next EXP
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
# Determine the gauge's width & fill based on the actor's Next EXP
if actor.next_exp != 0
exp = (width + plus_width) * actor.now_exp * rate_width /
100 / actor.next_exp
else
exp = (width + plus_width) * rate_width / 100
end
# Drawing of gauge
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, exp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# Call the original Draw EXP process
draw_actor_exp_hpsp(actor, x, y)
end
#--------------------------------------------------------------------------
# * Drawing of gauge
#--------------------------------------------------------------------------
def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
case align1
when 1
x += (rect_width - width) / 2
when 2
x += rect_width - width
end
case align2
when 1
y -= height / 2
when 2
y -= height
end
# Framework Drawing
self.contents.fill_rect(x, y, width, height, color1)
self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
if align3 == 0
if grade1 == 2
grade1 = 3
end
if grade2 == 2
grade2 = 3
end
end
if (align3 == 1 and grade1 == 0) or grade1 > 0
color = color3
color3 = color4
color4 = color
end
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color5
color5 = color6
color6 = color
end
# Drawing of empty gauge
self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
color3, color4, grade1)
if align3 == 1
x += width - gauge
end
# Drawing of actual gauge
self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
color5, color6, grade2)
end
end
#------------------------------------------------------------------------------
# New routine added to the Bitmap class.
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Rectangle Gradation Indicator
# color1: Start color
# color2: Ending color
# align: 0: On side gradation
# 1: Vertically gradation
# 2: The gradation (intense concerning slantedly heavily note)
#--------------------------------------------------------------------------
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end

ارجوا ان يعجبكم

سلام.

Noor Xp
02-04-2008, 02:22 PM
هناك مشاكل في السكربت حضيفه بعد شوي.

Noor Xp
02-04-2008, 02:31 PM
هذا هو السكربت الجديد اضفه فوق Main:


HP/SP/EXP Gauge Script v1.00
# Distribution original support URL
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw HP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw HP process
alias :draw_actor_hp_hpsp :draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
# Determine the rate of fill based on the actor's HP and HP Max
if actor.maxhp != 0
rate = actor.hp.to_f / actor.maxhp
else
rate = 0
end
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
# Determine the gauge's width & fill based on the actor's HP
if actor.maxhp != 0
hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
else
hp = 0
end
# Drawing of gauge
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, hp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# Call the original Draw HP process
draw_actor_hp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw SP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw SP process
alias :draw_actor_sp_hpsp :draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
# Determine the rate of fill based on the actor's SP and SP Max
if actor.maxsp != 0
rate = actor.sp.to_f / actor.maxsp
else
rate = 1
end
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(0, 64, 0, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
# Determine the gauge's width & fill based on the actor's SP
if actor.maxsp != 0
sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
else
sp = (width + plus_width) * rate_width / 100
end
# Drawing of gauge
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, sp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# Call the original Draw HP process
draw_actor_sp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw EXP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw HP process
alias :draw_actor_exp_hpsp :draw_actor_exp
def draw_actor_exp(actor, x, y, width = 204)
# Determine the rate of fill based on the actor's EXP and Next EXP
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
# Determine the gauge's width & fill based on the actor's Next EXP
if actor.next_exp != 0
exp = (width + plus_width) * actor.now_exp * rate_width /
100 / actor.next_exp
else
exp = (width + plus_width) * rate_width / 100
end
# Drawing of gauge
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, exp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# Call the original Draw EXP process
draw_actor_exp_hpsp(actor, x, y)
end
#--------------------------------------------------------------------------
# * Drawing of gauge
#--------------------------------------------------------------------------
def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
case align1
when 1
x += (rect_width - width) / 2
when 2
x += rect_width - width
end
case align2
when 1
y -= height / 2
when 2
y -= height
end
# Framework Drawing
self.contents.fill_rect(x, y, width, height, color1)
self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
if align3 == 0
if grade1 == 2
grade1 = 3
end
if grade2 == 2
grade2 = 3
end
end
if (align3 == 1 and grade1 == 0) or grade1 > 0
color = color3
color3 = color4
color4 = color
end
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color5
color5 = color6
color6 = color
end
# Drawing of empty gauge
self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
color3, color4, grade1)
if align3 == 1
x += width - gauge
end
# Drawing of actual gauge
self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
color5, color6, grade2)
end
end
#------------------------------------------------------------------------------
# New routine added to the Bitmap class.
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Rectangle Gradation Indicator
# color1: Start color
# color2: Ending color
# align: 0: On side gradation
# 1: Vertically gradation
# 2: The gradation (intense concerning slantedly heavily note)
#--------------------------------------------------------------------------
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end

ارجوا ان يعجبكم

سلام.

PrinceOfSorrow
02-04-2008, 10:01 PM
شكرا لتحديث ^^
وبارك الله فيك
هذا مفيد لعمل نظام اكشن بكل تأكيد ^^

Noor Xp
02-04-2008, 11:44 PM
اهلا بيك برنس
انا اسف لان الموضوع شوي مخربط انا جديد بالبرمجه وفي هذا المنتدى فلخبطت شوي
والشريط تحدث اصبح يضهر في المعركه.ححاول اطوره يظهر في الشاشه اتوماتيكياً.
سلام