Final Fantasy RPG Maker

Combat avec Barres de vie + caméra

Vient de la factory
Auteur : FTB

Salut a tous. Voici deux script permetant de faire des combat genre caméra et de voir la vie des ennemis.

Démo: http://www.archive-host.com/membres/up/ ... barvie.rar



Ajouté le script ci-dessous au dessu de Main nommé le BarVie.

Script:

#==============================================================================
# ¦ Window_Help
#------------------------------------------------------------------------------
# Script fait par FTB
#==============================================================================
 
class Window_Help < Window_Base
def set_enemy(actor)
self&#46;contents&#46;clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
carol3_draw_hp_bar(actor, 284, 0)
carol3_draw_sp_bar(actor, 460, 0)
@text = nil
self&#46;visible = true
end
def carol3_draw_hp_bar(actor, x, y, width = 128)
self&#46;contents&#46;font&#46;color = system_color
self&#46;contents&#46;fill_rect(x-1, y+17, width+2,6, Color&#46;new(0, 0, 0, 255))
w = width * actor&#46;hp / actor&#46;maxhp
self&#46;contents&#46;fill_rect(x, y+18, w,1, Color&#46;new(255, 96, 96, 255))
self&#46;contents&#46;fill_rect(x, y+19, w,1, Color&#46;new(255, 0, 0, 255))
self&#46;contents&#46;fill_rect(x, y+20, w,1, Color&#46;new(128, 0, 0, 255))
self&#46;contents&#46;fill_rect(x, y+21, w,1, Color&#46;new(0, 0, 0, 255))
self&#46;contents&#46;draw_text(x,y,128,32,$data_system&#46;words&#46;hp,1)
self&#46;contents&#46;font&#46;color = normal_color
end
def carol3_draw_sp_bar(actor, x, y, width = 128)
self&#46;contents&#46;font&#46;color = system_color
self&#46;contents&#46;fill_rect(x-1, y+17, width+2,6, Color&#46;new(0, 0, 0, 255))
w = width * actor&#46;sp / actor&#46;maxsp
self&#46;contents&#46;fill_rect(x, y+18, w,1, Color&#46;new(128, 255, 255, 255))
self&#46;contents&#46;fill_rect(x, y+19, w,1, Color&#46;new(0, 255, 255, 255))
self&#46;contents&#46;fill_rect(x, y+20, w,1, Color&#46;new(0, 192, 192, 255))
self&#46;contents&#46;fill_rect(x, y+21, w,1, Color&#46;new(0, 128, 128, 255))
self&#46;contents&#46;draw_text(x,y,128,32,$data_system&#46;words&#46;sp,1)
self&#46;contents&#46;font&#46;color = normal_color
end
end


Deuxième script: Script de caméra, créer un script qui ce nomme Caméra a mettre au dessus de Main.
# ?¥?£?¥ XRXS_BP 8&#46; ƒoƒgƒ‹ƒoƒbƒN?EFull-View?{‰?“®ƒJƒ?ƒ‰ ver&#46;&#46;05d ?¥?£?¥
# Fait par FTB
#==============================================================================
# ?¡ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ?œ ’?‰??EŒ?ŠJƒCƒ“ƒXƒ^ƒ“ƒX•??”
#--------------------------------------------------------------------------
attr_accessor &#58;x_pos # ƒoƒgƒ‹ƒtƒB?&#91;ƒ‹ƒh?@‰¡?@ˆ?’u(+‚׉E?@)
attr_accessor &#58;y_pos # ƒoƒgƒ‹ƒtƒB?&#91;ƒ‹ƒh ?‚‚³ ˆ?’u(+‚×???@)
attr_accessor &#58;z_pos # ƒoƒgƒ‹ƒtƒB?&#91;ƒ‹ƒh‰œ?s‚«ˆ?’u(+‚׎?‘O)
attr_accessor &#58;zoom # Œ»??‚?ƒY?&#91;ƒ€”{—¦
end
#==============================================================================
# ?¡ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ?œ ’?‰??EŒ?ŠJƒCƒ“ƒXƒ^ƒ“ƒX•??”
#--------------------------------------------------------------------------
attr_reader &#58;actor_in_battlefield # ƒAƒNƒ^?&#91;‚?ƒtƒB?&#91;ƒ‹ƒh‚?
#--------------------------------------------------------------------------
# ?œ ƒZƒbƒgƒAƒbƒv
#--------------------------------------------------------------------------
alias xrxs_bp8_setup setup
def setup(actor_id)
xrxs_bp8_setup(actor_id)
# ‹@”\"ƒAƒNƒ^?&#91;‚?ƒtƒB?&#91;ƒ‹ƒh‚?"
# true‚?—D??‚·‚?
@actor_in_battlefield = false if @actor_in_battlefield != true
end
end
#==============================================================================
# ?¡ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ?œ ’?‰??EŒ?ŠJƒCƒ“ƒXƒ^ƒ“ƒX•??”
#--------------------------------------------------------------------------
attr_reader &#58;actor_in_battlefield # ƒAƒNƒ^?&#91;‚?ƒtƒB?&#91;ƒ‹ƒh‚?
#--------------------------------------------------------------------------
# ?œ ƒIƒuƒWƒFƒNƒg?‰Š?‰»
#--------------------------------------------------------------------------
alias xrxs_bp8_initialize initialize
def initialize(troop_id, member_index)
@actor_in_battlefield = false
@x_pos = $data_troops&#91;troop_id&#93;&#46;members&#91;member_index&#93;&#46;x - 320
@y_pos = -($data_troops&#91;troop_id&#93;&#46;members&#91;member_index&#93;&#46;y - 304)
@field_x_offset = -192
@field_y_offset = -144
@z_pos = 0
@zoom = 1&#46;00
xrxs_bp8_initialize(troop_id, member_index)
end
#--------------------------------------------------------------------------
# ?œ ƒoƒgƒ‹‰?–? X ??•W‚?Ž?“¾
#--------------------------------------------------------------------------
def screen_x
$xcam_x = 0 if $xcam_x == nil
return 320 - @field_x_offset + (@x_pos&#46;to_i - $xcam_x) * @zoom
end
#--------------------------------------------------------------------------
# ?œ ƒoƒgƒ‹‰?–? Y ??•W‚?Ž?“¾
#--------------------------------------------------------------------------
def screen_y
$xcam_y = 0 if $xcam_y == nil
return 240 - @field_y_offset + (-@y_pos&#46;to_i + 64 + $xcam_y) * @zoom
end
end
#==============================================================================
# ?¡ Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG&#58;&#58;Sprite
#--------------------------------------------------------------------------
# ?œ ƒtƒŒ?&#91;ƒ€?X?V
#--------------------------------------------------------------------------
alias xrxs_bp8_update update
def update
# ?‰Š?‰»
@z_offset = 0
# –?‚·
xrxs_bp8_update
# ƒoƒgƒ‰?&#91;‚× nil ‚????‡–?‚?
return if @battler == nil
# “G‚?‚?‚?ƒJƒ?ƒ‰‚׉e‹¿?B
# Œ©•?‚?ƒoƒgƒ‹ƒtƒB?&#91;ƒ‹ƒh‚?‚¢‚????‡‚±‚±‚? if ‚?ŠO‚·?B
if (@battler&#46;is_a?(Game_Actor) and @battler&#46;actor_in_battlefield) or @battler&#46;is_a?(Game_Enemy)
# ƒY?&#91;ƒ€—¦
zoom = 1&#46;00 * 185 / (($xcam_z != nil ? $xcam_z &#58; 185) - @z_offset)
self&#46;zoom_x = zoom
self&#46;zoom_y = zoom
@battler&#46;zoom = zoom
# ƒXƒvƒ‰ƒCƒg‚???•W‚???’?
self&#46;x = @battler&#46;screen_x
self&#46;y = @battler&#46;screen_y
self&#46;z = @battler&#46;screen_z
end
end
end
#==============================================================================
# ?¡ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ?œ ƒIƒuƒWƒFƒNƒg?‰Š?‰»
#--------------------------------------------------------------------------
alias xrxs_bp8_initialize initialize
def initialize
# ?‰Š?‰»
@now_bg_x = -1
@now_bg_y = -1
@now_bg_z = -1
# ’???Žž‚?Ž??s
xrxs_bp8_initialize
# ƒrƒ…?&#91;ƒ|?&#91;ƒg‚????¬
@viewport1 = Viewport&#46;new(-192, -144, 1024, 768)
# ƒoƒgƒ‹ƒoƒbƒNƒXƒvƒ‰ƒCƒg‚????¬
@battleback_sprite = Sprite&#46;new(@viewport1)
@battleback_name = ""
# ƒGƒlƒ~?&#91;ƒXƒvƒ‰ƒCƒg‚????¬
@enemy_sprites = &#91;&#93;
for enemy in $game_troop&#46;enemies&#46;reverse
@enemy_sprites&#46;push(Sprite_Battler&#46;new(@viewport1, enemy))
end
# “VŒ?‚????¬
@weather = RPG&#58;&#58;Weather&#46;new(@viewport1)
# ƒtƒŒ?&#91;ƒ€?X?V
update
end
#--------------------------------------------------------------------------
# ?œ ƒtƒŒ?&#91;ƒ€?X?V
#--------------------------------------------------------------------------
alias xrxs_bp8_update update
def update
# ƒoƒgƒ‹ƒoƒbƒN‚?ƒtƒ@ƒCƒ‹–¼‚׌»??‚?‚?‚?‚?ˆ?‚????‡
if @battleback_name != $game_temp&#46;battleback_name
@battleback_name = $game_temp&#46;battleback_name
if @battleback_sprite&#46;bitmap != nil
@battleback_sprite&#46;bitmap&#46;dispose
end
bg_bitmap = RPG&#58;&#58;Cache&#46;battleback(@battleback_name)
bg_bitmap_stretch = Bitmap&#46;new(1024, 768)
bg_bitmap_stretch&#46;stretch_blt(Rect&#46;new(0, 0, 1024, 768), bg_bitmap, bg_bitmap&#46;rect)
@battleback_sprite&#46;bitmap = bg_bitmap_stretch
end
# ƒJƒ?ƒ‰ˆ?’u‚ד®‚¢‚½???‡
if @now_bg_x != $xcam_x or @now_bg_y != $xcam_y or @now_bg_z != $xcam_z
# ƒY?&#91;ƒ€—¦
zoom = 1&#46;00 * 185 / $xcam_z
@battleback_sprite&#46;zoom_x = zoom
@battleback_sprite&#46;zoom_y = zoom
# ƒJƒ?ƒ‰z‚?‚?‚?ˆ?’u‚??C?³
maximum = 192 * (296 - $xcam_z) / 111
$xcam_x = &#91;&#91;$xcam_x, -maximum&#93;&#46;max, maximum&#93;&#46;min
# ”wŒiˆ?’u?X?V
@battleback_sprite&#46;x = -$xcam_x * zoom - 512 * (zoom - 1)
@battleback_sprite&#46;y = $xcam_y * zoom - 384 * (zoom - 1)
# ’l?X?V
@now_bg_x = $xcam_x
@now_bg_y = $xcam_y
@now_bg_z = $xcam_z
end
# –?‚·
xrxs_bp8_update
end
end
#==============================================================================
# ?¡ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ?œ ƒ?ƒCƒ“?ˆ—?
#--------------------------------------------------------------------------
alias xrxs_bp8_main main
def main
# ƒJƒ?ƒ‰?‰Š?ˆ?’uŒˆ’?
$xcam_x = 0
$xcam_y = 0
$xcam_z = 295
# ƒJƒ?ƒ‰‚????‰‚?–?“I’l
@xcam_x_destination = 0
@xcam_y_destination = 0
@xcam_z_destination = 185
# ?¡?A’?–?ƒoƒgƒ‰?&#91;‚?–³‚µ?B
@xcam_watch_battler = nil
# ?‰Š?‰»
@wait_count_xcam = 0
# –?‚·
xrxs_bp8_main
end
#--------------------------------------------------------------------------
# ?œ ƒtƒŒ?&#91;ƒ€?X?V
#--------------------------------------------------------------------------
alias xrxs_bp8_update update
def update
# ƒJƒ?ƒ‰ˆ?’u‚??X?V?B
if @wait_count_xcam > 0
# ƒEƒFƒCƒgƒJƒEƒ“ƒg‚?Œ¸‚?‚·
@wait_count_xcam -= 1
else
# ƒJƒ?ƒ‰&#58; Z ??•W
if $xcam_z != @xcam_z_destination
if $xcam_z < @xcam_z_destination
distance = &#91;(@xcam_z_destination - $xcam_z)/8, 1&#93;&#46;max
else
distance = &#91;(@xcam_z_destination - $xcam_z)/8, -1&#93;&#46;min
end
$xcam_z = &#91;&#91;$xcam_z + distance, 74&#93;&#46;max, 296&#93;&#46;min
end
# ƒJƒ?ƒ‰&#58; X ??•W
if @xcam_watch_battler != nil
if $xcam_x != @xcam_watch_battler&#46;x_pos
if ($xcam_x - @xcam_watch_battler&#46;x_pos)&#46;abs < 8
distance = @xcam_watch_battler&#46;x_pos - $xcam_x
elsif $xcam_x < @xcam_watch_battler&#46;x_pos
distance = &#91;(@xcam_watch_battler&#46;x_pos - $xcam_x)/8, 8&#93;&#46;max
else
distance = &#91;(@xcam_watch_battler&#46;x_pos - $xcam_x)/8, -8&#93;&#46;min
end
maximum = 192 * (296 - $xcam_z) / 111
$xcam_x = &#91;&#91;$xcam_x + distance, -maximum&#93;&#46;max, maximum&#93;&#46;min
end
elsif $xcam_x != @xcam_x_destination
if ($xcam_x - @xcam_x_destination)&#46;abs < 8
distance = @xcam_x_destination - $xcam_x
elsif $xcam_x < @xcam_x_destination
distance = &#91;(@xcam_x_destination - $xcam_x)/8, 8&#93;&#46;max
else
distance = &#91;(@xcam_x_destination - $xcam_x)/8, -8&#93;&#46;min
end
maximum = 192 * (296 - $xcam_z) / 111
$xcam_x = &#91;&#91;$xcam_x + distance, -maximum&#93;&#46;max, maximum&#93;&#46;min
end
# ƒJƒ?ƒ‰&#58; Y ??•W
if @xcam_watch_battler != nil
y = @xcam_watch_battler&#46;y_pos/2
if $xcam_y != y
if ($xcam_y - y)&#46;abs < 8
distance = y - $xcam_y
elsif $xcam_y < y
distance = &#91;(y - $xcam_y)/8, 8&#93;&#46;max
else
distance = &#91;(y - $xcam_y)/8, -8&#93;&#46;min
end
maximum = 144 * (296 - $xcam_z) / 111
$xcam_y = &#91;&#91;$xcam_y + distance, -maximum&#93;&#46;max, maximum&#93;&#46;min
end
elsif $xcam_y != @xcam_y_destination
if $xcam_y < @xcam_y_destination
distance = &#91;(@xcam_y_destination - $xcam_y)/8, 1&#93;&#46;max
else
distance = &#91;(@xcam_y_destination - $xcam_y)/8, -1&#93;&#46;min
end
maximum = 164 * (296 - $xcam_z) / 111
$xcam_y = &#91;&#91;$xcam_y + distance, -maximum&#93;&#46;max, maximum&#93;&#46;min
end
end
# ’???Ž??s
xrxs_bp8_update
end
#--------------------------------------------------------------------------
# ?œ ƒp?&#91;ƒeƒBƒRƒ}ƒ“ƒhƒtƒF?&#91;ƒYŠJŽn
#--------------------------------------------------------------------------
alias xrxs_bp8_start_phase2 start_phase2
def start_phase2
# ƒJƒ?ƒ‰?FƒZƒ“ƒ^ƒŠƒ“ƒO
@xcam_watch_battler = nil
@xcam_x_destination = 0
@xcam_z_destination = 185
# –?‚·
xrxs_bp8_start_phase2
end
#--------------------------------------------------------------------------
# ?œ ƒtƒŒ?&#91;ƒ€?X?V (ƒAƒNƒ^?&#91;ƒRƒ}ƒ“ƒhƒtƒF?&#91;ƒY)
#--------------------------------------------------------------------------
alias xrxs_bp8_update_phase3 update_phase3
def update_phase3
# ƒJƒ?ƒ‰‚?ƒLƒƒƒ‰ˆ?’u‚?
if @active_battler != nil and @active_battler&#46;actor_in_battlefield
@xcam_x_destination = @active_battler&#46;x_pos
@xcam_z_destination = 175
end
xrxs_bp8_update_phase3
end
#--------------------------------------------------------------------------
# ?œ ƒtƒŒ?&#91;ƒ€?X?V (ƒAƒNƒ^?&#91;ƒRƒ}ƒ“ƒhƒtƒF?&#91;ƒY &#58; ƒGƒlƒ~?&#91;‘I‘?)
#--------------------------------------------------------------------------
alias xrxs_bp8_update_phase3_enemy_select update_phase3_enemy_select
def update_phase3_enemy_select
# ƒJƒ?ƒ‰?F“Gƒ^?&#91;ƒQƒbƒg‚?ƒY?&#91;ƒ€ƒAƒbƒv
@xcam_x_destination = $game_troop&#46;enemies&#91;@enemy_arrow&#46;index&#93;&#46;x_pos * $game_troop&#46;enemies&#91;@enemy_arrow&#46;index&#93;&#46;zoom
@xcam_z_destination = 175
# –?‚·
xrxs_bp8_update_phase3_enemy_select
end
#--------------------------------------------------------------------------
# ?œ ƒGƒlƒ~?&#91;‘I‘??I—¹
#--------------------------------------------------------------------------
alias xrxs_bp8_end_enemy_select end_enemy_select
def end_enemy_select
# ƒJƒ?ƒ‰?F’†?S‚?
@xcam_x_destination = 0
@xcam_z_destination = 185
# –?‚·
xrxs_bp8_end_enemy_select
end
#--------------------------------------------------------------------------
# ?œ ƒtƒŒ?&#91;ƒ€?X?V (ƒ?ƒCƒ“ƒtƒF?&#91;ƒY ƒXƒeƒbƒv 2 &#58; ƒAƒNƒVƒ‡ƒ“ŠJŽn)
#--------------------------------------------------------------------------
alias xrxs_bp8_update_phase4_step2 update_phase4_step2
def update_phase4_step2
# –?‚·
xrxs_bp8_update_phase4_step2
# ƒXƒeƒbƒv 3 ‚?ˆ??s‚·‚????‡
if @phase4_step == 3
if @active_battler&#46;is_a?(Game_Enemy) or @active_battler&#46;actor_in_battlefield
# ƒJƒ?ƒ‰?F?s“®ƒoƒgƒ‰?&#91;‚?‚?ƒY?&#91;ƒ€ƒAƒbƒv‚?—\–?
@xcam_x_destination = @active_battler&#46;x_pos * @active_battler&#46;zoom if @active_battler&#46;x_pos != nil
@xcam_z_destination = 175
end
# ??’? 20 ƒtƒŒ?&#91;ƒ€‘?‚?
@wait_count = 20
end
end
#--------------------------------------------------------------------------
# ?œ ƒtƒŒ?&#91;ƒ€?X?V (ƒ?ƒCƒ“ƒtƒF?&#91;ƒY ƒXƒeƒbƒv 3 &#58; ?s“®‘?ƒAƒjƒ??&#91;ƒVƒ‡ƒ“)
#--------------------------------------------------------------------------
alias xrxs_bp8_update_phase4_step3 update_phase4_step3
def update_phase4_step3
# –?‚·
xrxs_bp8_update_phase4_step3
if @target_battlers&#46;size > 0 and
(@target_battlers&#91;0&#93;&#46;is_a?(Game_Enemy) or @target_battlers&#91;0&#93;&#46;actor_in_battlefield)
# ƒJƒ?ƒ‰?Fƒ^?&#91;ƒQƒbƒg‚?‚?ƒY?&#91;ƒ€ƒAƒbƒv‚?—\–?
@xcam_x_destination = @target_battlers&#91;0&#93;&#46;x_pos * @target_battlers&#91;0&#93;&#46;zoom if @target_battlers&#91;0&#93; != nil
@xcam_z_destination = 185
# ‚?‚µ‘???ƒAƒjƒ?‚×?uˆ?’u?F‰?–??v‚?‚?‚?‚????‡
if @animation2_id > 0 and $data_animations&#91;@animation2_id&#93;&#46;position == 3
# ƒJƒ?ƒ‰‚?ƒZƒ“ƒ^ƒŠƒ“ƒO
@xcam_x_destination = 0
# ƒY?&#91;ƒ€ƒAƒEƒg‚?‚?‚?‚?‚¿‚?‚?¥w¥
@xcam_z_destination = 222
end
end
# ??’? 20 ƒtƒŒ?&#91;ƒ€‘?‚?
@wait_count = 20
end
#--------------------------------------------------------------------------
# ?œ ƒAƒtƒ^?&#91;ƒoƒgƒ‹ƒtƒF?&#91;ƒYŠJŽn
#--------------------------------------------------------------------------
alias xrxs_bp8_start_phase5 start_phase5
def start_phase5
@xcam_z_destination = 185
xrxs_bp8_start_phase5
end
end
#==============================================================================
# ?ž RPG&#58;&#58;??’?‹`?u??“¬’†‚?"‰?–?"ƒAƒjƒ?‚?ˆ?’u?C?³?v
#==============================================================================
module RPG
class Sprite < &#58;&#58;Sprite
def animation_set_sprites(sprites, cell_data, position)
for i in 0&#46;&#46;15
sprite = sprites&#91;i&#93;
pattern = cell_data&#91;i, 0&#93;
if sprite == nil or pattern == nil or pattern == -1
sprite&#46;visible = false if sprite != nil
next
end
sprite&#46;visible = true
sprite&#46;src_rect&#46;set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
if position == 3
if self&#46;viewport != nil
if $scene&#46;is_a?(Scene_Battle)
sprite&#46;x = self&#46;viewport&#46;rect&#46;width / 2
sprite&#46;y = 304
else
sprite&#46;x = self&#46;viewport&#46;rect&#46;width / 2
sprite&#46;y = self&#46;viewport&#46;rect&#46;height - 160
end
else
sprite&#46;x = 320
sprite&#46;y = 240
end
else
sprite&#46;x = self&#46;x - self&#46;ox + self&#46;src_rect&#46;width / 2
sprite&#46;y = self&#46;y - self&#46;oy + self&#46;src_rect&#46;height / 2
sprite&#46;y -= self&#46;src_rect&#46;height / 4 if position == 0
sprite&#46;y += self&#46;src_rect&#46;height / 4 if position == 2
end
sprite&#46;x += cell_data&#91;i, 1&#93;
sprite&#46;y += cell_data&#91;i, 2&#93;
sprite&#46;z = 2000
sprite&#46;ox = 96
sprite&#46;oy = 96
sprite&#46;zoom_x = cell_data&#91;i, 3&#93; / 100&#46;0
sprite&#46;zoom_y = cell_data&#91;i, 3&#93; / 100&#46;0
sprite&#46;angle = cell_data&#91;i, 4&#93;
sprite&#46;mirror = (cell_data&#91;i, 5&#93; == 1)
sprite&#46;opacity = cell_data&#91;i, 6&#93; * self&#46;opacity / 255&#46;0
sprite&#46;blend_type = cell_data&#91;i, 7&#93;
end
end
end
end


S'est un honneur de pouvoir aider les débutant

J'espère que vous aimé mon script même si j'ai pris 3 heure pour tout faire.


Ajouté par Amathlog
le 18/06/2007 à 20:56:55
Vu 6505 fois





Page générée en 0.0001 secondes
©2011 Site créé par Martial, le Webmaster
Me contacter - Livre d'or - Forum - Plan du site
Mentions légales - Remerciements
Final-RPG