以下引用xephon于2008-2-26 8:27:48的发言:
<br><script language="javascript">
<!--
strCont="那边有改过了,会出现错误\r\n没办法直接打 $天赋数 = actor.int/10\r\n";
document.write(ubb.spbShowTopic(strCont,1));
//-->
</script>那边有改过了,会出现错误<br>
没办法直接打 $天赋数 = actor.int/10<br>
<br><br><font color="red"></font><font color="red">[本贴由作者于 2008-2-26 8:28:35 最后编辑]</font>
以下引用Iselia雪于2008-2-26 18:53:55的发言:
<br><script language="javascript">
<!--
strCont="按照LZ要求,全自动化了。\r\n\r\n某个斑竹- -|||\r\nActor类米int只说...RGSS用二维数组读取$data的预设值生成Base,但是Actor内部无法读取父类资源,返回nil可就错了。";复制代码
- #-------------------------------------------------------------------------------\r\n#天赋技能(另一种思路) By 凌冰 & 小雪\r\n#------------------------------------------------------------------------------\r\n#$天赋数 = 3 #修改这里更改可以学会的技能数\r\n#----------------------------------------------------------------------------------\r\nclass Window_Base < Window\r\n def pressed_color #为了与可在菜单使用的颜色区分,定义一种颜色表示已点击\r\n return Color.new(255, 255, 0, 255)#如果不需要区分,就改称return normal_color\r\n end\r\nend\r\n#--------------------------------------------------------------------------------\r\nclass Game_Actor\r\n attr_accessor :skill_press\r\n attr_accessor :press\r\n attr_accessor :press_use\r\n alias skill_updata_init setup\r\n def setup(actor_id)\r\n skill_updata_init(actor_id)\r\n @skill_press = []\r\n @press_use = 0\r\n @press = $data_actors[actor_id].parameters[5,$data_actors[actor_id].initial_level] / 10\r\n for id in 1...$data_skills.size\r\n @skill_press[id] = false\r\n end\r\n end\r\n alias eci_skill_can_use? skill_can_use?\r\n def skill_can_use?(skill_id)\r\n result = eci_skill_can_use?(skill_id)\r\n if skill_press[skill_id] == false\r\n result = false\r\n end\r\n return result\r\n end\r\n #--------------------------------------------------------------------------\r\n # ● 更改 EXP\r\n # exp : 新的 EXP\r\n #--------------------------------------------------------------------------\r\n def exp=(exp)\r\n @exp = [[exp, 9999999].min, 0].max\r\n intori = @int\r\n # 升级\r\n while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0\r\n @level += 1\r\n @press = ($data_actors[@actor_id].parameters[5,@level] / 10) - @press_use\r\n # 学会特技\r\n for j in $data_classes[@class_id].learnings\r\n if j.level == @level\r\n learn_skill(j.skill_id)\r\n end\r\n end\r\n end\r\n # 降级\r\n while @exp < @exp_list[@level]\r\n @level -= 1\r\n end\r\n # 修正当前的 HP 与 SP 超过最大值\r\n @hp = [@hp, self.maxhp].min\r\n @sp = [@sp, self.maxsp].min\r\n end\r\nend\r\nclass Scene_Skill\r\n alias eci_update_skill update_skill\r\n def update_skill\r\n eci_update_skill\r\n if Input.trigger?(Input::C)\r\n if @actor.skill_press[@skill.id] or @actor.press == 0\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n else\r\n $game_system.se_play($data_system.decision_se)\r\n @actor.skill_press[@skill.id] = true\r\n @actor.press -= 1\r\n @actor.press_use += 1\r\n @skill_window.refresh\r\n end\r\n end\r\n end\r\nend\r\nclass Window_Skill < Window_Selectable\r\n def draw_item(index)\r\n skill = @data[index]\r\n if @actor.skill_can_use?(skill.id)\r\n self.contents.font.color = normal_color\r\n elsif @actor.skill_press[skill.id]\r\n self.contents.font.color = pressed_color\r\n else\r\n self.contents.font.color = disabled_color\r\n end\r\n x = 4 + index % 2 * (288 + 32)\r\n y = index / 2 * 32\r\n rect = Rect.new(x, y, self.width / @column_max - 32, 32)\r\n self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))\r\n bitmap = RPG::Cache.icon(skill.icon_name)\r\n opacity = self.contents.font.color == normal_color ? 255 : 128\r\n self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)\r\n self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)\r\n self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)\r\n end\r\nend\r\n
document.write(ubb.spbShowTopic(strCont,1));
//-->
</script>按照LZ要求,全自动化了。<br>
<textarea style="border: 1px solid rgb(255, 102, 0); width: 100%;" id="dbg_3" name="dbg" rows="8">#-------------------------------------------------------------------------------
#天赋技能(另一种思路) By 凌冰 & 小雪
#------------------------------------------------------------------------------
#$天赋数 = 3 #修改这里更改可以学会的技能数
#----------------------------------------------------------------------------------
class Window_Base < Window
def pressed_color #为了与可在菜单使用的颜色区分,定义一种颜色表示已点击
return Color.new(255, 255, 0, 255)#如果不需要区分,就改称return normal_color
end
end
#--------------------------------------------------------------------------------
class Game_Actor
attr_accessor :skill_press
attr_accessor :press
attr_accessor :press_use
alias skill_updata_init setup
def setup(actor_id)
skill_updata_init(actor_id)
@skill_press = []
@press_use = 0
@press = $data_actors[actor_id].parameters[5,$data_actors[actor_id].initial_level] / 10
for id in 1...$data_skills.size
@skill_press[id] = false
end
end
alias eci_skill_can_use? skill_can_use?
def skill_can_use?(skill_id)
result = eci_skill_can_use?(skill_id)
if skill_press[skill_id] == false
result = false
end
return result
end
#--------------------------------------------------------------------------
# ● 更改 EXP
# exp : 新的 EXP
#--------------------------------------------------------------------------
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
intori = @int
# 升级
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
@press = ($data_actors[@actor_id].parameters[5,@level] / 10) - @press_use
# 学会特技
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
# 降级
while @exp < @exp_list[@level]
@level -= 1
end
# 修正当前的 HP 与 SP 超过最大值
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
end
class Scene_Skill
alias eci_update_skill update_skill
def update_skill
eci_update_skill
if Input.trigger?(Input::C)
if @actor.skill_press[@skill.id] or @actor.press == 0
$game_system.se_play($data_system.buzzer_se)
return
else
$game_system.se_play($data_system.decision_se)
@actor.skill_press[@skill.id] = true
@actor.press -= 1
@actor.press_use += 1
@skill_window.refresh
end
end
end
end
class Window_Skill < Window_Selectable
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
elsif @actor.skill_press[skill.id]
self.contents.font.color = pressed_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
</textarea><br><br>
某个斑竹- -|||<br>
Actor类米int只说...RGSS用二维数组读取$data的预设值生成Base,但是Actor内部无法读取父类资源,返回nil可就错了。
<br><br><font color="red"></font><font color="red">[本贴由作者于 2008-2-26 19:00:15 最后编辑]</font>
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |