Project1
标题:
总之就是脚本问题
[打印本页]
作者:
maboming1993
时间:
2012-8-30 19:23
标题:
总之就是脚本问题
本帖最后由 maboming1993 于 2012-8-30 21:06 编辑
学了两天脚本+两天的系统,觉得不自己手动连做带抄一个脚本的话实在是对不起我死去的小白经历,于是弄了一个,总之,就是想请教一下这脚本有什么问题。
这个脚本的来源是window_help,已被本人改的面目全非,失去了本来的样子,但幸运的是居然有一部分能运行····
老是报告运行不能,让小菜鸟我实在是心烦,但改了很多遍又不知道问题的纠结所在
#encoding:utf-8
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 显示特技和物品等的说明、以及角色状态的窗口
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
super(0, 312, 544, 104)
end
#--------------------------------------------------------------------------
# ● 应用“恢复 HP”效果
#--------------------------------------------------------------------------
def item_effect_recover_hp(user, item, effect)
value = (mhp * effect.value1 + effect.value2) * rec
value *= user.pha if item.is_a?(RPG::Item)
value = value.to_i
@result.hp_damage -= value
@result.success = true
self.hp += value
end
#--------------------------------------------------------------------------
# ● 应用“恢复 MP”效果
#--------------------------------------------------------------------------
def item_effect_recover_mp(user, item, effect)
value = (mmp * effect.value1 + effect.value2) * rec
value *= user.pha if item.is_a?(RPG::Item)
value = value.to_i
@result.mp_damage -= value
@result.success = true if value != 0
self.mp += value
end
#--------------------------------------------------------------------------
# ● 文字设定
# item : 物品
#--------------------------------------------------------------------------
def set_item(item)
if item.nil?
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 512, 24, $game_temp.shop_word)
@item = nil
return
end
if item != @item
@item = item
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 512, 24, @item.description)
if @item.is_a?(RPG::Item)
# 物品范围描述
scope = "[对象] : "
case @item.scope
when 0; scope += "无"
when 1; scope += "敌单体"
when 2; scope += "敌全体"
when 3; scope += "敌单体 随机"
when 4; scope += "敌二体 随机"
when 5; scope += "敌三体 随机"
when 6; scope += "敌四体 随机"
when 7; scope += "我方单体"
when 8; scope += "我方全体"
when 9; scope += "我方单体 (阵亡)"
when 10; scope += "我方全体 (阵亡)"
when 11; scope += "使用者"
end
self.contents.draw_text(0, 24, 512, 24, scope)
# 物品范围描述结束
#以上是能运行的部分↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
# 物品恢复效果描述
effection = "[效果] : "
effection += "#{Vocab.hp} + #{@item.rec}% " if @item.rec > 0
effection += "#{Vocab.hp} - #{@item.rec}% " if @item.rec < 0
effection += "#{Vocab.hp} + #{@item.item_effect_recover_hp} " if @item.item_effect_recover_hp > 0
effection += "#{Vocab.hp} - #{@item.item_effect_recover_hp} " if @item.item_effect_recover_hp < 0
if @item.item_effect_recover_mp > 0
effection += "#{Vocab.mp}+#{@item.rec}% "
elsif @item.rec < 0
effection += "#{Vocab.mp}-#{@item.rec}% "
elsif @item.rec > 0
effection += "#{Vocab.mp}+#{@item.item_effect_recover_mp} "
elsif @item.item_effect_recover_mp < 0
effection += "#{Vocab.mp}-#{@item.item_effect_recover_mp} "
end
case @item.item_effect_grow
when 1
effection += "最大#{Vocab.hp}+#{@item.item_effect_grow}"
when 2
effection += "最大#{Vocab.mp}+#{@item.item_effect_grow}"
when 3
effection += "#{Vocab.atk}+#{@item.item_effect_grow}"
when 4
effection += "#{Vocab.def}+#{@item.item_effect_grow}"
when 5
effection += "#{Vocab.spi}+#{@item.item_effect_grow}"
when 6
effection += "#{Vocab.agi}+#{@item.item_effect_grow}"
end
self.contents.draw_text(0, 48, 512, 24, effection)
# 物品恢复效果描述结束
else
# 武器防具可装备人员描述
equip = "[可装备] : "
for actor in $game_party.members
if actor.equippable?(@item)
equip += "、" if equip != "[可装备] : "
equip += actor.name
end
end
equip += "无" if equip == "[可装备] : "
self.contents.draw_text(0, 24, 512, 24, equip)
# 武器防具可装备人员描述结束
# 武器防具攻防增减描述
effection = "[属性] : "
if @item.atk != 0
effection += "攻击力+#{@item.atk} "
end
if @item.def != 0
effection += "防御力+#{@item.def} "
end
if @item.luk != 0
effection += "精神力+#{@item.luck} "
end
if @item.agi != 0
effection += "敏捷值+#{@item.agi} "
end
if @item.mmp != 0
effection += "最大HP+#{@item.mmp} "
end
if @item.mhp != 0
effection += "最大MP+#{@item.mhp} "
end
# 武器防具攻防增减描述结束
if @item.is_a?(RPG::Armor)
# 防具特殊属性描述
if @item.cev
effection += "必杀闪避#{@item.cev} "
end
if @item.mcr
effection += "消费MP#{@item.mcr} "
end
if @item.exr
effection += "经验加成#{@item.cri} "
end
if @item.hrg
effection += "自动恢复HP#{@item.hrg} "
end
if @item.mrg
effection += "自动恢复MP#{@item.meg} "
end
if @item.tgr
effection += "受到攻击的几率#{@item.tgr} "
end
# 防具特殊属性描述结束
else
# 武器特殊属性描述
if @item.dual_wield
effection += "双持武器 "
end
if @item.action_plus_set
effection += "行动次数+#{@item.action_plus_set} "
end
if @item.atk_times_add
effection += "攻击次数+#{@item.atk_times_add} "
end
if @item.cri
effection += "必杀概率+#{@item.cri} "
end
# 武器特殊属性描述结束
end
unless @item.element_set.empty?
# 武器防具属性描述(左边那一栏需要打勾的)
effection += @item.is_a?(RPG::Armor) ? " [防具状态] : " : " [武器属性] : "
for state in @item.element_set
effection += $data_system.elements[state] + " "
end
# 武器防具属性描述结束
end
unless @item.state_set.empty?
# 武器防具状态描述(右边那一栏需要打勾的)
effection += @item.is_a?(RPG::Armor) ? " [无效化属性] : " : " [附加状态] : "
for state in @item.state_set
effection += $data_states[state].name + " "
end
# 武器防具状态描述结束
end
self.contents.draw_text(0, 48, 512, 24, effection)
end
end
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_text_ex(4, 0, @text)
end
end
复制代码
另外还有解惑问题
#--------------------------------------------------------------------------
# ● 应用“恢复 HP”效果
#--------------------------------------------------------------------------
def item_effect_recover_hp(user, item, effect)
value = (mhp * effect.value1 + effect.value2) * rec
value *= user.pha if item.is_a?(RPG::Item)
value = value.to_i
@result.hp_damage -= value
@result.success = true
self.hp += value
end
复制代码
这段脚本是复制过来的,完全不理解日本人的思维,怎么解释就是不通啊,请一句一句详细的解释·····
effect.value1这1是怎么加上去的,我没看他从新定义啊
value *= user.pha if item.is_a?(RPG::Item)这括号里边啥意思,is_a to_i这两又是个什么玩意
-= *= 表示理解不能
快一个小时了这帖难道就没人接么,请言语一声让我有个期待,看不起我自己研究去%>_<% {:2_271:} ,泪奔
作者:
chxush
时间:
2012-8-30 21:09
*= -=都是自运算 x*=y 就是x=x*y to_i是强制转换为int型数据 RPG::Item
其他具体的还是看F1吧 VA的不行看VX的
作者:
maboming1993
时间:
2012-8-30 21:34
就是因为看了所以才会有问题·····
作者:
咕噜
时间:
2012-8-30 21:35
maboming1993 发表于 2012-8-30 21:34
就是因为看了所以才会有问题·····
如果需要复原就新建工程的脚本里复制新工程的脚本覆盖此工程……
VA的脚本我也不懂看……VX的还可以
作者:
maboming1993
时间:
2012-8-30 21:57
我有原始的脚本,就是想知道上边的脚本到底出了什么问题的说····
,那种wndow_hlep的程度我自己也是能写出来的大概
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1