Project1
标题:
自己把一个队员仓库脚本稍稍改了下~~
[打印本页]
作者:
xokboy
时间:
2008-6-22 01:35
标题:
自己把一个队员仓库脚本稍稍改了下~~
可以发这种贴吧,如果违规了删就是了~~
以前在论坛里找到的一个脚本,地址我已经忘了,今天翻出来改了下,希望用得着这个功能的朋友可以试下,目前我测试不出什么问题,因为脚本是英文的我看不懂,大概就是这种效果:
这个脚本不起其他同类的脚本要简陋的多,队伍人数仍然限制为4人,而且也无法在战斗中更换队员,但这种简单脚本我想也会有朋友需要吧~~
1.系统呼出命令: $scene = Scene_Party.new
2.队员锁定命令: $game_party.members[0].actor.required = true
(其中数字0表示1号队员在队伍中锁定而无法进入仓库,1即为2号队员,以此类推)
3.队员加入仓库命令: $data_actors[5].found = true
(其中数字5表示5号队员直接进入仓库等待招募而不加入队伍,当队伍满员时使用此命令)
4.队员踢除仓库命令: $data_actors[5].found = false
(其中数字5表示将呆在仓库里的5号队员清除,该命令用于离开的队员)
5.队员加入仓库但无法被招募:$data_actors[8].found = true
$data_actors[8].unavailable = true
(其中数字8表示8号队员# 直接进入仓库但无法被招募,该命令用于俘虏类)
6.仓库里无法招募的队员启动命令: $data_actors.each do |a|
a.unavailable = false if a
end
(该命令作为第5项命令的补充,使所有仓库里无法被招募的队员重启为可招募状态)
7.全体队员进入仓库: $data_actors.each do |a|
a.found = true if a
nd
(该命令使所有队员进入仓库等待招募,在队伍 中的队员不受影响)
由于脚本的缺陷及技术不足,角色名和职业名尽量控制在3个字或3个字以下,不然会出现被遮住而无法显示的画面
# 队员管理脚本(v1.1c)
module RPG
class Actor
def setup
@found = false
@unavailable = false
@required = false
end
attr_accessor :found
attr_accessor :unavailable
attr_accessor :required
end
end
class Game_Actors
attr_reader :data
alias prex_party_g_actors_initialize initialize
def initialize
prex_party_g_actors_initialize
$data_actors.each do |actor|
actor.setup if actor
@data[actor.id] = Game_Actor.new(actor.id) if actor
end
end
end
class Scene_File < Scene_Base
alias prex_party_s_file_write_save_data write_save_data
alias prex_party_s_file_read_save_data read_save_data
def write_save_data(file)
prex_party_s_file_write_save_data(file)
Marshal.dump($data_actors, file)
end
def read_save_data(file)
prex_party_s_file_read_save_data(file)
$data_actors = Marshal.load(file)
end
end
class Scene_Title < Scene_Base
alias prex_party_s_title_command_new_game command_new_game
def command_new_game
prex_party_s_title_command_new_game
$game_party.members.each {|s| s.actor.found = true if s}
end
end
class Window_Base < Window
def draw_item_name(item, x, y, enabled = true, width = 172)
if item != nil
draw_icon(item.icon_index, x, y, enabled)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x + 24, y, width, WLH, item.name)
end
end
end
class Scene_Party < Scene_Base
def start
super
create_menu_background
create_windows
end
def create_windows
@member_window = Window_CurrentMember.new
@party_window = Window_CurrentParty.new
@party_window.active = true
@selectable_window = Window_SelectMember.new
end
def update_windows
@member_window.update
@party_window.update
@selectable_window.update
if @party_window.active
@member_window.set_member(@party_window.member)
elsif @selectable_window.active
@member_window.set_member(@selectable_window.member)
end
end
def terminate
super
@member_window.dispose
@party_window.dispose
@selectable_window.dispose
end
def update
super
update_windows
update_input
end
def update_input
if Input.trigger?(Input::A)
if @member_window.mode == 1
@member_window.set_mode(0)
elsif @member_window.mode == 0
@member_window.set_mode(1)
end
end
if @party_window.active
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
member = @party_window.member
if member != nil
if member.actor.unavailable or member.actor.required
Sound.play_buzzer
return
end
end
Sound.play_decision
@party_window.active = false
@selectable_window.active = true
@selectable_window.index = 0
end
elsif @selectable_window.active
if Input.trigger?(Input::B)
Sound.play_cancel
@selectable_window.index = -1
@selectable_window.active = false
@party_window.active = true
elsif Input.trigger?(Input::C)
member = @selectable_window.member
if member != nil
if member.actor.unavailable
Sound.play_buzzer
return
end
end
Sound.play_decision
$game_party.remove_actor(@party_window.member.id) if @party_window.member != nil
$game_party.add_actor(@selectable_window.member.id) if @selectable_window.member != nil
@selectable_window.refresh
@party_window.refresh
@selectable_window.index = -1
@selectable_window.active = false
@party_window.active = true
end
end
end
end
class Window_CurrentMember < Window_Base
attr_reader :mode
def initialize(member = nil, mode = 0)
super(304, 80, 192, 256)
create_contents
@member = member
@mode = 0
refresh
end
def member
return @member
end
def set_member(member)
old_member = @member
@member = member
refresh if old_member != @member
end
def set_mode(mode)
@mode = mode if [0, 1].include?(mode)
refresh
end
def refresh
self.contents.clear
return unless @member
x, y = 0, 0
self.draw_actor_name(@member, x + 100, y)
self.draw_actor_class(@member, x + 100, y + WLH)
self.draw_actor_level(@member, x + 103, y + WLH*2)
case @mode
when 0
self.draw_actor_face(@member, x, y, 96) #****
self.draw_actor_hp(@member, x, y + WLH*3, 160)
self.draw_actor_mp(@member, x, y + WLH*4, 160)
self.draw_actor_parameter(@member, x, y + WLH*5, 0)
self.draw_actor_parameter(@member, x, y + WLH*6, 1)
self.draw_actor_parameter(@member, x, y + WLH*7, 2)
self.draw_actor_parameter(@member, x, y + WLH*8, 3)
when 1
self.draw_actor_face(@member, x, y, 96) #****
for i in
[email protected]
item = @member.equips[i]
self.draw_item_name(item, x, y + WLH*(3+i), true, self.contents.width - 24)
end
end
end
end
class Window_CurrentParty < Window_Selectable
def initialize
super(48, 80, 256, 64)
@item_max = 4
@column_max = @item_max
create_contents
self.index = 0
refresh
end
def member
return $game_party.members[self.index]
end
def refresh
for i in 0...@item_max
rect = item_rect(i)
self.contents.clear_rect(rect)
end
for i in 0...$game_party.members.size
rect = item_rect(i)
bitmap = Cache.character($game_party.members[i].character_name)
sign = $game_party.members[i].character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = $game_party.members[i].character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
if $game_party.members[i].actor.unavailable
self.contents.blt(rect.x, rect.y, bitmap, src_rect, 128)
else
self.contents.blt(rect.x, rect.y, bitmap, src_rect, 255)
end
if $game_party.members[i].actor.required
lock_bitmap = Cache.system("Locked")
self.contents.blt(rect.x + rect.width - lock_bitmap.width,
rect.y + rect.height - lock_bitmap.height,
lock_bitmap, lock_bitmap.rect)
end
end
end
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = 32
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * 32
return rect
end
end
class Window_SelectMember < Window_Selectable
def initialize
super(48, 144, 256, 192)
calculate_actors
@item_max = @actors.size + 1
@column_max = 4
self.index = -1
self.active = false
refresh
end
def calculate_actors
@actors = []
for a in $game_actors.data
@actors << a if a != nil and a.actor.found and !$game_party.members.include?(a)
end
end
def member
return @actors[self.index]
end
def refresh
self.contents.clear
calculate_actors
@item_max = @actors.size + 1
for i in
[email protected]
rect = item_rect(i)
bitmap = Cache.character(@actors[i].character_name)
sign = @actors[i].character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = @actors[i].character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
if @actors[i].actor.unavailable
self.contents.blt(rect.x, rect.y, bitmap, src_rect, 128)
else
self.contents.blt(rect.x, rect.y, bitmap, src_rect, 255)
end
if @actors[i].actor.required
lock_bitmap = Cache.system("Locked")
self.contents.blt(rect.x + rect.width - lock_bitmap.width,
rect.y + rect.height - lock_bitmap.height,
lock_bitmap, lock_bitmap.rect)
end
end
end
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = 32
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * 32
return rect
end
end
复制代码
作者:
zianyygy12
时间:
2008-9-9 10:33
顶一个·
刚好需要!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1