Project1
标题:
帮我修改一下脚本
[打印本页]
作者:
气味123
时间:
2011-4-15 00:58
标题:
帮我修改一下脚本
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ 简易职业转职脚本 - FSL_JOB ◆ VX ◆
#_/
#_/ ◇ 项目分类 : 角色辅助
#_/ ◇ 项目版本 : 1.6.826
#_/ ◇ 建立日期 : 2010/8/23
#_/ ◇ 最后更新 : 2010/8/26 ◇
#_/----------------------------------------------------------------------------
#_/ 脚本作者:wangswz
#_/============================================================================
#_/ 【基本机能】方便职业转换和职业成长设置
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#$scene = Scene_Job.new(0,false)于事件中调用
module FSL
module JOB
# ◆ 职业成长系数 初始化
JOB_MAX = []
# ◆ 设置 hp,mp,atk,def,spi,agi,职业图标号
JOB_MAX[1] = [ 100, 10, 1, 1, 1, 1, 32]
JOB_MAX[2] = [ 300, 50, 15, 10, 3, 0, 3]
JOB_MAX[3] = [ 3, 3, 3, 3, 3, 4, 33]
JOB_MAX[4] = [ 4, 4, 4, 4, 4, 4, 34]
JOB_MAX[5] = [ 4, 4, 4, 4, 4, 4, 35]
JOB_MAX[6] = [ 4, 4, 4, 4, 4, 4, 36]
JOB_MAX[7] = [ 4, 4, 4, 4, 4, 4, 37]
# ◆ 设置缺省职业成长系数
#当职业成长系数中未给出指定值时使用
JOB_Default = [15,15, 2, 2, 2, 2, 0]
# ◆ 属性用语 初始化
JOB_text = []
# ◆ 设置
JOB_text[1] = ["体力增长"]
JOB_text[2] = ["魔力增长"]
JOB_text[3] = ["攻击增长"]
JOB_text[4] = ["防御增长"]
JOB_text[5] = ["精神增长"]
JOB_text[6] = ["敏捷增长"]
# ◆ 职业窗口每行显示数
JOB_W = 4
# ◆ 职业转职限制开关
#true 设置限制转职列表
#false 全职业可用
Advanced = true
# ◆ 职业不可转职列表 Advanced = true时有效
JOB_Advanced = []
#设置
# <例> JOB_Advanced[1] = [4,5]
# 数据库1号职业 不可转职为4,5号职业
JOB_Advanced[1] = [4,5]
JOB_Advanced[2] = [2,4,7]
JOB_Advanced[3] = [1]
# ◆ 职业转职列表显示开关
#true 灰色显示不可转职职业
#false不显示不可转职职业
Advanced2 = false
# ◆ 追加菜单
#在菜单窗口最下方增加转职窗口按钮
JOB_COMMAND = false
# ◆ 追加菜单文字信息
JOB_MENU_VOCAB = "-转职列表-"
# ◆ 转职命令文字信息
JOB_COMMAND_s1 = "-转职-"
JOB_COMMAND_s2 = "-取消-"
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$fscript = {} if $fscript == nil
$fscript["FSL_JOB"] = [ 1, 6, 826]
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Base
#------------------------------------------------------------------------------
# 处理转职画面的类
#==============================================================================
class Scene_Job < Scene_Base
#--------------------------------------------------------------------------
# * 初始化对象
# actor_index : 角色位置
#--------------------------------------------------------------------------
def initialize(actor_index = 0, from_menu = true, job_index = 0)
@actor_index = actor_index
@from_menu = from_menu
@Job_menu_index = job_index
end
#--------------------------------------------------------------------------
# * 开始处理
#--------------------------------------------------------------------------
def start
super
#~ @actor = $game_party.members[@actor_index]
create_menu_background
@actor = $game_party.members[@actor_index]
@class_status_window = Window_ClassStatus.new(@actor)
create_class_list
create_option_list
@command_window.active = false
@command_window2.active = true
end
#--------------------------------------------------------------------------
# * 创建选项列表
#--------------------------------------------------------------------------
def create_option_list
s1 = FSL::JOB::JOB_COMMAND_s1
s2 = FSL::JOB::JOB_COMMAND_s2
@command_window2 = Window_Command.new(544, [s1, s2], 2)
@command_window2.x = 0
@command_window2.y = 0
@command_window2.height = 56
end
#--------------------------------------------------------------------------
# * 创建职业列表
#--------------------------------------------------------------------------
def create_class_list
#生成职业列表
com = []
@com2 = []
for i in 1...$data_classes.size
if FSL::JOB::Advanced == true && FSL::JOB::Advanced2 == false
if FSL::JOB::JOB_Advanced[@actor.class_id] != nil &&
FSL::JOB::JOB_Advanced[@actor.class_id].include?(i)
next
else
com << " "+$data_classes[i].name if $data_classes[i].name != ""
@com2 << i
end
else
com << " "+$data_classes[i].name if $data_classes[i].name != ""
@com2 << i
end
end
#~ for i in 1...$data_classes.size
#~ com << " "+$data_classes[i].name if $data_classes[i].name != ""
#~ end
@command_window = Window_Command.new(544, com, FSL::JOB::JOB_W)
#生成不可转职视觉效果
for i in 1..com.size
if FSL::JOB::Advanced == true && FSL::JOB::Advanced2 == true
if FSL::JOB::JOB_Advanced[@actor.class_id] != nil &&
FSL::JOB::JOB_Advanced[@actor.class_id].include?(i)
@command_window.draw_item(i-1, false)
end
end
end
#设置窗口数值
@command_window.x = 0
@command_window.y = 256
@command_window.height = 160
x = 0
y = 0
i = 0
p = 0
if FSL::JOB::Advanced2 == false
for m in 1..(Integer($data_classes.size / FSL::JOB::JOB_W)+1)
for n in 1..FSL::JOB::JOB_W
i += 1
if FSL::JOB::JOB_MAX[i] != nil && FSL::JOB::JOB_MAX[i][6] != nil
if @com2.include?(i)
@command_window.draw_icon(FSL::JOB::JOB_MAX[i][6], x, y)
x += (544 / FSL::JOB::JOB_W)
p += 1
if p % FSL::JOB::JOB_W == 0
x = 0
y += 24
end
end
else
if FSL::JOB::Advanced2
@command_window.draw_icon(FSL::JOB::JOB_Default[6], x, y)
x += (544 / FSL::JOB::JOB_W)
end
end
break if i == ($data_classes.size - 1)
end
end
else
for m in 1..(Integer($data_classes.size / FSL::JOB::JOB_W)+1)
for n in 1..FSL::JOB::JOB_W
i += 1
if FSL::JOB::JOB_MAX[i] != nil && FSL::JOB::JOB_MAX[i][6] != nil
@command_window.draw_icon(FSL::JOB::JOB_MAX[i][6], x, y)
else
@command_window.draw_icon(FSL::JOB::JOB_Default[6], x, y)
end
x += (544 / FSL::JOB::JOB_W)
break if i == ($data_classes.size - 1)
end
x = 0
y += 24
end
end
end
#--------------------------------------------------------------------------
# * 终止处理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@class_status_window.dispose
@command_window.dispose
@command_window2.dispose
end
#--------------------------------------------------------------------------
# * 切换到下一个角色
#--------------------------------------------------------------------------
def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
$scene = Scene_Job.new(@actor_index, @from_menu)
end
#--------------------------------------------------------------------------
# * 切换到上一个角色
#--------------------------------------------------------------------------
def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
$scene = Scene_Job.new(@actor_index, @from_menu)
end
#--------------------------------------------------------------------------
# * 更新选择窗口 >> 允许检查输入
#--------------------------------------------------------------------------
def update_class_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window2.active = true
@command_window.active = false
elsif Input.trigger?(Input::C)
Sound.play_decision
if FSL::JOB::Advanced == true
if FSL::JOB::Advanced2 == true
if FSL::JOB::JOB_Advanced[@actor.class_id] != nil &&
FSL::JOB::JOB_Advanced[@actor.class_id].include?(@command_window.index + 1)
Sound.play_buzzer
else
@actor.class_id = @command_window.index + 1
$scene = Scene_Job.new(@actor_index, @from_menu)
end
else
@actor.class_id = @com2[@command_window.index]
$scene = Scene_Job.new(@actor_index, @from_menu)
end
else
@actor.class_id = @command_window.index + 1
$scene = Scene_Job.new(@actor_index, @from_menu)
end
end
end
#--------------------------------------------------------------------------
# * 更新选择窗口 >> 允许检查输出
#--------------------------------------------------------------------------
def update_option_selection
if Input.trigger?(Input::B)
Sound.play_cancel
if @from_menu == false
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(@Job_menu_index)
end
elsif Input.trigger?(Input::C)
Sound.play_decision
case @command_window2.index
when 0
Sound.play_decision
@command_window.active = true
@command_window2.active = false
when 1
Sound.play_decision
if @from_menu == false
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(@Job_menu_index)
end
end
end
end
#--------------------------------------------------------------------------
# * 更新框架
#--------------------------------------------------------------------------
def update
update_menu_background
if @command_window2.active
update_option_selection
else
update_class_selection
end
@command_window.update
@command_window2.update
@class_status_window.update
if Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
end
super
end
end
#==============================================================================
# ■ Window_ClassStatus
#------------------------------------------------------------------------------
# 角色和职业状态信息的窗口
#==============================================================================
class Window_ClassStatus < Window_Base
#--------------------------------------------------------------------------
# * 初始化对象
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 56, 544, 200)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 10, 100)
draw_actor_class(@actor, 10, 124)
draw_actor_face(@actor, 0, 0)
draw_actor_graphic(@actor, 96, 96)
draw_basic_info(110, 0)
end
#--------------------------------------------------------------------------
# * 制定基本参数
# x : 绘出X轴坐标
# y : 绘出Y轴坐标
#--------------------------------------------------------------------------
def draw_basic_info(x, y)
draw_actor_level(@actor, x, y + WLH * 0)
draw_actor_hp(@actor, x, y + WLH * 1)
draw_actor_mp(@actor, x, y + WLH * 2)
draw_actor_parameter(@actor, x, y + WLH * 3,0)
draw_actor_parameter(@actor, x, y + WLH * 4,1)
draw_actor_parameter(@actor, x, y + WLH * 5,2)
draw_actor_parameter(@actor, x, y + WLH * 6,3)
self.contents.font.color = text_color(12)
for i in 1..6
self.contents.draw_text(x+200, y, 100, WLH * i*2-1,FSL::JOB::JOB_text[i])
if FSL::JOB::JOB_MAX[@actor.class_id] != nil
self.contents.draw_text(x+300, y, 100, WLH * i*2, FSL::JOB::JOB_MAX[@actor.class_id][i-1])
else
self.contents.draw_text(x+300, y, 100, WLH * i*2, FSL::JOB::JOB_Default[i-1])
end
end
self.contents.font.color = normal_color
end
#--------------------------------------------------------------------------
# * 经验信息
# x : 绘出X轴坐标
# y : 绘出Y轴坐标
#--------------------------------------------------------------------------
def draw_exp_info(x, y)
s1 = @actor.exp_s
s2 = @actor.next_rest_exp_s
s_next = sprintf(Vocab::ExpNext, Vocab::level)
self.contents.font.color = system_color
self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal)
self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next)
self.contents.font.color = normal_color
self.contents.draw_text(x, y + WLH * 1, 180, WLH, s1, 0)
self.contents.draw_text(x, y + WLH * 3, 180, WLH, s2, 0)
end
end
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# 菜单改造窗口
#==============================================================================
class Scene_Menu < Scene_Base
if FSL::JOB::JOB_COMMAND
#--------------------------------------------------------------------------
# ● 创建命令窗口
#--------------------------------------------------------------------------
alias create_command_window_FSL_JOB create_command_window
def create_command_window
create_command_window_FSL_JOB
@command_FSL_JOB_index = @command_window.add_command(FSL::JOB::JOB_MENU_VOCAB)
if @command_window.oy > 0
@command_window.oy -= Window_Base::WLH
end
@command_window.index = @menu_index
end
end
#--------------------------------------------------------------------------
# ● 更新命令选择
#--------------------------------------------------------------------------
alias update_command_selection_FSL_JOB update_command_selection
def update_command_selection
#~ current_menu_index = @command_FSL_JOB_index
call_FSL_JOB_flag = false
if Input.trigger?(Input::C)
case @command_window.index
when @command_FSL_JOB_index
call_FSL_JOB_flag = true
end
end
if call_FSL_JOB_flag
Sound.play_decision
$scene = Scene_Job.new( 0, true, @command_window.index)
return
end
update_command_selection_FSL_JOB
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。本类在 Game_Actors 类 ($game_actors) 的内部使用、
# Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 升级
#--------------------------------------------------------------------------
#~ alias FSL_JOB_level_up level_up
def level_up
@level += 1
if FSL::JOB::JOB_MAX[@class_id] != nil
@maxhp_plus += FSL::JOB::JOB_MAX[@class_id][0]
@maxmp_plus += FSL::JOB::JOB_MAX[@class_id][1]
@atk_plus += FSL::JOB::JOB_MAX[@class_id][2]
@def_plus += FSL::JOB::JOB_MAX[@class_id][3]
@spi_plus += FSL::JOB::JOB_MAX[@class_id][4]
@agi_plus += FSL::JOB::JOB_MAX[@class_id][5]
else
@maxhp_plus += FSL::JOB::JOB_Default[0]
@maxmp_plus += FSL::JOB::JOB_Default[1]
@atk_plus += FSL::JOB::JOB_Default[2]
@def_plus += FSL::JOB::JOB_Default[3]
@spi_plus += FSL::JOB::JOB_Default[4]
@agi_plus += FSL::JOB::JOB_Default[5]
end
for learning in self.class.learnings
learn_skill(learning.skill_id) if learning.level == @level
end
end
end
#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
# 一般的命令选择行窗口。
#==============================================================================
class Window_Command < Window_Selectable
unless method_defined?(:add_command)
#--------------------------------------------------------------------------
# ○ 添加一个命令
# 返回额外的位置
#--------------------------------------------------------------------------
def add_command(command)
@commands << command
@item_max = @commands.size
item_index = @item_max - 1
refresh_command
draw_item(item_index)
return item_index
end
#--------------------------------------------------------------------------
# ○ 刷新命令
#--------------------------------------------------------------------------
def refresh_command
buf = self.contents.clone
self.height = [self.height, row_max * WLH + 32].max
create_contents
self.contents.blt(0, 0, buf, buf.rect)
buf.dispose
end
#--------------------------------------------------------------------------
# ○ 插入命令
#--------------------------------------------------------------------------
def insert_command(index, command)
@commands.insert(index, command)
@item_max = @commands.size
refresh_command
refresh
end
#--------------------------------------------------------------------------
# ○ 删除命令
#--------------------------------------------------------------------------
def remove_command(command)
@commands.delete(command)
@item_max = @commands.size
refresh
end
end
end
复制代码
帮我把不可转职改为只可转职!
气味123于2011-4-18 07:44补充以下内容:
需要职业设定的有点多!!!!!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1