Project1
标题:
关于脚本的问题
[打印本页]
作者:
geziyang007
时间:
2009-5-23 04:51
标题:
关于脚本的问题
最近下载了一个素材名为《火影忍者全动画素材(鲁鲁版)》
想借用一下里面关于战斗的脚本 可是发现了一个错误当我想把角色在战斗中中途加入的时候就会提示脚本出错 忘高手教我怎么改下那个脚本 谢谢了 {/dk}
作者:
geziyang007
时间:
2009-5-23 05:22
自定义血条的脚本:
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors
#......................................................................
actor_x = i * 133 + 100
hp_width = $game_party.actors
.hp * @hp_bitmap.width/$game_party.actors
.maxhp
hp_rect = Rect.new(0, 0, hp_width, 3)
mp_width = $game_party.actors
.sp * @mp_bitmap.width/$game_party.actors
.maxsp
mp_rect = Rect.new(0, 0, mp_width, 3)
@sta_output[i + 1].bitmap.blt(66, 44, @hp_bitmap, hp_rect)
@sta_output[i + 1].bitmap.blt(68, 69, @mp_bitmap, mp_rect)
@sta_output[i + 1].bitmap.font.color.set(255, 0, 0)
@sta_output[i + 1].bitmap.draw_text(80, 31, 77, 11,$game_party.actors
.hp.to_s + "/" + $game_party.actors
.maxhp.to_s)
@sta_output[i + 1].bitmap.font.color.set(0, 0, 255)
@sta_output[i + 1].bitmap.draw_text(80, 51, 77, 11,$game_party.actors
.sp.to_s + "/" + $game_party.actors
.maxsp.to_s)
#......................................................................
if @level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, actor_x, 96)
end
end
end
即时战斗的脚本:
alias xrxs_bp1_initialize initialize
def initialize
@update_cp_only = false
@wall = Window_All.new
xrxs_bp1_initialize
end
def dispose
super
@wall.dispose
@hp_bitmap.dispose
@mp_bitmap.dispose
@cp_bitmap.dispose
@cp_back_bar.dispose
for actor in $game_party.actors
@actor_cp_sprite[actor.index].bitmap.dispose
@actor_cp_sprite[actor.index].dispose
@actor_cp_sprite_back[actor.index].bitmap.dispose
@actor_cp_sprite_back[actor.index].dispose
end
for actor_index in 1..$game_party.actors.size
@sta_back[actor_index].bitmap.dispose
@sta_back[actor_index].dispose
@sta_output[actor_index].bitmap.dispose
@sta_output[actor_index].dispose
@cp_output[actor_index].bitmap.dispose
@cp_output[actor_index].dispose
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
alias xrxs_bp1_refresh refresh
def refresh
unless @update_cp_only
xrxs_bp1_refresh
end
refresh_cp
@wall.refresh
end
#--------------------------------------------------------------------------
# ○ リフレッシュ(CPのみ)
#--------------------------------------------------------------------------
def refresh_cp
#........................................................................
for actor in $game_party.actors
next if !actor.exist?
if actor.cp == nil
actor.cp = 0
end
@actor_cp_sprite[actor.index].x = 450 + actor.cp * 140 /65535
@actor_cp_sprite_back[actor.index].x = 450 + actor.cp * 140 /65535
end
for i in 0...$game_party.actors.size
actor = $game_party.actors
if actor.cp == nil
actor.cp = 0
end
@cp_output[i + 1].bitmap.clear
@cp_output[i + 1].bitmap.font.size = 11
@cp_output[i + 1].bitmap.font.name = "宋体"
@cp_output[i + 1].bitmap.font.color.set(50, 50, 50)
cp_height = actor.cp * @cp_bitmap.height / 65535
cp_rect = Rect.new(0, @cp_bitmap.height - cp_height, @cp_bitmap.width, cp_height)
@cp_output[i + 1].bitmap.blt(9, 6 + @cp_bitmap.height - cp_height, @cp_bitmap, cp_rect)
end
#........................................................................
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias xrxs_bp1_update update
def update
xrxs_bp1_update
# CP更新
@cp_thread.update
end
#--------------------------------------------------------------------------
# ● バトル終了
# result : 結果 (0:勝利 1:敗北 2:逃走)
#--------------------------------------------------------------------------
alias xrxs_bp1_battle_end battle_end
def battle_end(result)
# CPカウントを停止する
@cp_thread.stop
# 呼び戻す
xrxs_bp1_battle_end(result)
end
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1