Project1
标题:
求改个脚本。把经验该为钱就行
[打印本页]
作者:
zgm1100
时间:
2011-7-27 23:40
标题:
求改个脚本。把经验该为钱就行
本帖最后由 zgm1100 于 2011-7-27 23:41 编辑
$shizi_skillup_id = []
$shizi_skillup_exp =[]
=begin
技能升级系统
下面的为自定义内容,格式为:
$shizi_skillup_id[0] = [[技能ID] ,[技能ID] , .. ,[技能ID] ]
$shizi_skillup_exp[0] =[[升级需要EXP],[升级需要EXP], .. ,[是否保留原技能]]
$shizi_skillup_id[1] = [[技能ID] ,[技能ID] , .. ,[技能ID] ]
$shizi_skillup_exp[1] =[[升级需要EXP],[升级需要EXP], .. ,[是否保留原技能]]
...
空格可以去掉, 那只是编写时对齐用的
如果保留原技能(升级不遗忘旧技能,具体功能自己开发),“是否保留原技能”为true,
否则为false
技能ID一定要用[]框住,而“是否保留原技能”则不需要。
自定义内容↓
=end
$shizi_技能学习音 = ["005-System05",80]
$shizi_skillup_id[0] = [[1],[2],[3] ]
$shizi_skillup_exp[0] =[100,200,false]
$shizi_skillup_id[1] = [[2,3],[4] ]
$shizi_skillup_exp[1] =[500 ,true]
$shizi_skillup_id[2] = [[4] ,[5] ]
$shizi_skillup_exp[2] =[1000,false]
$shizi_skillup_id[3] = [[22],[23],[24] ]
$shizi_skillup_exp[3] =[300 ,600 ,false]
$shizi_skillup_id[4] = [[23,24],[59]]
$shizi_skillup_exp[4] =[1500 ,true]
#==============================================================================
# 脚本内容
#==============================================================================
def get_nextskill(id,actor)
get = []
if $shizi_skillup_id.size != $shizi_skillup_exp.size
p "数量不符"
exit
end
for i in 0...$shizi_skillup_id.size
i_1 = $shizi_skillup_id[i]
for j in 2..i_1.size
j_1 = i_1[i_1.size-j]
if j_1.include?(id)
skill = $shizi_skillup_exp[i]
skill_1 = skill[j_1.size-j]
if skill.include?(true)
get[get.size] = [i_1[i_1.size-j+1][0],skill[i_1.size-j],true]
else
get[get.size] = [i_1[i_1.size-j+1][0],skill[i_1.size-j],false]
end
end
end
end
skill_id = []
for i in 0...actor.skills.size
skill = $data_skills[actor.skills[i]]
if skill != nil
skill_id.push(skill)
end
end
for i in 0...get.size
if skill_id.include?(get[i][0])
get.delete_at(i)
end
end
return get
end
def get_nextskill_id(num)
get = []
for i in num
get[get.size] = i[0]
end
return get
end
#==============================================================================
# ● 空白窗口
#==============================================================================
class Window_Shizi_White < Window_Base
def initialize
super(0,0,640,480)
self.contents = Bitmap.new(width - 32, height - 32)
end
def clear
self.contents.clear
end
def refresh
self.contents = Bitmap.new(width - 32, height - 32)
end
def draw(text, align = 1)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
@align = align
end
self.visible = true
end
end
#==============================================================================
# ● 选择技能窗口
#==============================================================================
class Window_Shizi_Skill < Window_Selectable
def initialize(actor)
super(0, 0, 320, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.y = 64
@actor = actor
refresh
self.index = 0
end
def skill
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in
[email protected]
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 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
#==============================================================================
# ● 升级技能窗口
#==============================================================================
class Window_Shizi_Skillup < Window_Selectable
def initialize
super(0, 0, 320, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.y = 64
self.x = 320
self.index = 0
end
def refresh(num,exp,skil)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = get_nextskill_id(num)
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i,exp,num,skil)
end
else
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.color = disabled_color
self.contents.draw_text(0, 0, width - 32, 32, "不能再升级", 1)
end
end
def draw_item(index,exp,num,skil)
skill = $data_skills[@data[index]]
if exp >= num[index][1] or skil.include?(skill)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 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
#==============================================================================
# ● 升级技能场景
#==============================================================================
class Scene_Skillup
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
def main
@actor = $game_party.actors[@actor_index]
@skill_window = Window_Shizi_Skill.new(@actor)
@skill_window.index = 0
@skill_window.active = true
@skillup_window = Window_Shizi_Skillup.new
@skillup_window.active = false
@draw_window = Window_Shizi_White.new
@draw_window.height = 64
@draw_window.refresh
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@skill_window.dispose
@skillup_window.dispose
@draw_window.dispose
end
def update
if @skillindex == nil and @skill_window.active
@skillindex = 0
@skill_id_1 = @skill_window.skill.id
@skill_id_2 = get_nextskill(@skill_id_1,@actor)
@skillup_window.refresh(@skill_id_2,@actor.exp,get_skil)
text = @actor.name + " " + "exp:"+ @actor.exp.to_s
@draw_window.draw(text)
end
if @skillupindex == nil and @skillup_window.active
@skillupindex = 0
text ="升级需要经验:" + @skill_id_2[@skillup_window.index][1].to_s
@draw_window.draw(text)
end
@skill_window.update
@skillup_window.update
@draw_window.update
if @skill_window.active
update_skill
return
end
if @skillup_window.active
update_skillup
return
end
end
def get_skil
skil = []
for i in
[email protected]
shizi_skill = $data_skills[@actor.skills[i]]
if shizi_skill != nil
skil.push(shizi_skill.id)
end
end
return skil
end
def update_skill
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skillup.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skillup.new(@actor_index)
return
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if @skill_window.index != @skillindex
@skillindex = @skill_window.index
@skill_id_1 = @skill_window.skill.id
@skill_id_2 = get_nextskill(@skill_id_1,@actor)
@skillup_window.refresh(@skill_id_2,@actor.exp,get_skil)
end
if Input.trigger?(Input::C)
if @skill_id_2 != []
@skill_window.active = false
@skillup_window.active = true
$game_system.se_play($data_system.decision_se)
@skillindex = nil
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
def update_skillup
if @skillup_window.index != @skillupindex
@skillupindex = @skillup_window.index
text ="升级需要经验:" + @skill_id_2[@skillup_window.index][1].to_s
@draw_window.draw(text)
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skillup_window.index = 0
@skillup_window.active = false
@skill_window.active = true
@skillupindex = nil
return
end
if Input.trigger?(Input::C)
if @actor.exp >= @skill_id_2[@skillup_window.index][1] and @actor.skill_learn?(@skill_id_2[@skillup_window.index][0]) == false
Audio.se_play("Audio/SE/" + $shizi_技能学习音[0],$shizi_技能学习音[1])
@actor.exp -= @skill_id_2[@skillup_window.index][1]
if @skill_id_2[@skillup_window.index][2] == false
@actor.forget_skill(@skill_window.skill.id)
end
@actor.learn_skill(@skill_id_2[@skillup_window.index][0])
@skill_window.refresh
@skill_id_1 = @skill_window.skill.id
@skill_id_2 = get_nextskill(@skill_id_1,@actor)
@skillup_window.refresh(@skill_id_2,@actor.exp,get_skil)
@skillup_window.index = 0
if get_nextskill(@skill_window.skill.id,@actor) == []
@skillup_window.active = false
@skillupindex = nil
@skill_window.active = true
end
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
end
复制代码
就是把技能升级所需要的经验,该为需要钱升级就行。 dsu_plus_rewardpost_czw
作者:
Wind2010
时间:
2011-7-27 23:57
$shizi_skillup_id = []
$shizi_skillup_exp =[]
=begin
技能升级系统
下面的为自定义内容,格式为:
$shizi_skillup_id[0] = [[技能ID] ,[技能ID] , .. ,[技能ID] ]
$shizi_skillup_exp[0] =[[升级需要EXP],[升级需要EXP], .. ,[是否保留原技能]]
$shizi_skillup_id[1] = [[技能ID] ,[技能ID] , .. ,[技能ID] ]
$shizi_skillup_exp[1] =[[升级需要EXP],[升级需要EXP], .. ,[是否保留原技能]]
...
空格可以去掉, 那只是编写时对齐用的
如果保留原技能(升级不遗忘旧技能,具体功能自己开发),“是否保留原技能”为true,
否则为false
技能ID一定要用[]框住,而“是否保留原技能”则不需要。
自定义内容↓
=end
$shizi_技能学习音 = ["005-System05",80]
$shizi_skillup_id[0] = [[1],[2],[3] ]
$shizi_skillup_exp[0] =[100,200,false]
$shizi_skillup_id[1] = [[2,3],[4] ]
$shizi_skillup_exp[1] =[500 ,true]
$shizi_skillup_id[2] = [[4] ,[5] ]
$shizi_skillup_exp[2] =[1000,false]
$shizi_skillup_id[3] = [[22],[23],[24] ]
$shizi_skillup_exp[3] =[300 ,600 ,false]
$shizi_skillup_id[4] = [[23,24],[59]]
$shizi_skillup_exp[4] =[1500 ,true]
#==============================================================================
# 脚本内容
#==============================================================================
def get_nextskill(id,actor)
get = []
if $shizi_skillup_id.size != $shizi_skillup_exp.size
p "数量不符"
exit
end
for i in 0...$shizi_skillup_id.size
i_1 = $shizi_skillup_id[i]
for j in 2..i_1.size
j_1 = i_1[i_1.size-j]
if j_1.include?(id)
skill = $shizi_skillup_exp[i]
skill_1 = skill[j_1.size-j]
if skill.include?(true)
get[get.size] = [i_1[i_1.size-j+1][0],skill[i_1.size-j],true]
else
get[get.size] = [i_1[i_1.size-j+1][0],skill[i_1.size-j],false]
end
end
end
end
skill_id = []
for i in 0...actor.skills.size
skill = $data_skills[actor.skills[i]]
if skill != nil
skill_id.push(skill)
end
end
for i in 0...get.size
if skill_id.include?(get[i][0])
get.delete_at(i)
end
end
return get
end
def get_nextskill_id(num)
get = []
for i in num
get[get.size] = i[0]
end
return get
end
#==============================================================================
# ● 空白窗口
#==============================================================================
class Window_Shizi_White < Window_Base
def initialize
super(0,0,640,480)
self.contents = Bitmap.new(width - 32, height - 32)
end
def clear
self.contents.clear
end
def refresh
self.contents = Bitmap.new(width - 32, height - 32)
end
def draw(text, align = 1)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
@align = align
end
self.visible = true
end
end
#==============================================================================
# ● 选择技能窗口
#==============================================================================
class Window_Shizi_Skill < Window_Selectable
def initialize(actor)
super(0, 0, 320, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.y = 64
@actor = actor
refresh
self.index = 0
end
def skill
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in
[email protected]
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 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
#==============================================================================
# ● 升级技能窗口
#==============================================================================
class Window_Shizi_Skillup < Window_Selectable
def initialize
super(0, 0, 320, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.y = 64
self.x = 320
self.index = 0
end
def refresh(num,gold,skil)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = get_nextskill_id(num)
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i,gold,num,skil)
end
else
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.color = disabled_color
self.contents.draw_text(0, 0, width - 32, 32, "不能再升级", 1)
end
end
def draw_item(index,gold,num,skil)
skill = $data_skills[@data[index]]
if $game_party.gold >= num[index][1] or skil.include?(skill)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 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
#==============================================================================
# ● 升级技能场景
#==============================================================================
class Scene_Skillup
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
def main
@actor = $game_party.actors[@actor_index]
@skill_window = Window_Shizi_Skill.new(@actor)
@skill_window.index = 0
@skill_window.active = true
@skillup_window = Window_Shizi_Skillup.new
@skillup_window.active = false
@draw_window = Window_Shizi_White.new
@draw_window.height = 64
@draw_window.refresh
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@skill_window.dispose
@skillup_window.dispose
@draw_window.dispose
end
def update
if @skillindex == nil and @skill_window.active
@skillindex = 0
@skill_id_1 = @skill_window.skill.id
@skill_id_2 = get_nextskill(@skill_id_1,@actor)
@skillup_window.refresh(@skill_id_2,$game_party.gold,get_skil)
text = @actor.name + " " + "金钱:"+ $game_player.gold.to_s
@draw_window.draw(text)
end
if @skillupindex == nil and @skillup_window.active
@skillupindex = 0
text ="升级需要金钱:" + @skill_id_2[@skillup_window.index][1].to_s
@draw_window.draw(text)
end
@skill_window.update
@skillup_window.update
@draw_window.update
if @skill_window.active
update_skill
return
end
if @skillup_window.active
update_skillup
return
end
end
def get_skil
skil = []
for i in
[email protected]
shizi_skill = $data_skills[@actor.skills[i]]
if shizi_skill != nil
skil.push(shizi_skill.id)
end
end
return skil
end
def update_skill
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skillup.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skillup.new(@actor_index)
return
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if @skill_window.index != @skillindex
@skillindex = @skill_window.index
@skill_id_1 = @skill_window.skill.id
@skill_id_2 = get_nextskill(@skill_id_1,@actor)
@skillup_window.refresh(@skill_id_2,$game_party.gold,get_skil)
end
if Input.trigger?(Input::C)
if @skill_id_2 != []
@skill_window.active = false
@skillup_window.active = true
$game_system.se_play($data_system.decision_se)
@skillindex = nil
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
def update_skillup
if @skillup_window.index != @skillupindex
@skillupindex = @skillup_window.index
text ="升级需要金钱:" + @skill_id_2[@skillup_window.index][1].to_s
@draw_window.draw(text)
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skillup_window.index = 0
@skillup_window.active = false
@skill_window.active = true
@skillupindex = nil
return
end
if Input.trigger?(Input::C)
if $game_party.gold >= @skill_id_2[@skillup_window.index][1] and @actor.skill_learn?(@skill_id_2[@skillup_window.index][0]) == false
Audio.se_play("Audio/SE/" + $shizi_技能学习音[0],$shizi_技能学习音[1])
$game_party.gold -= @skill_id_2[@skillup_window.index][1]
if @skill_id_2[@skillup_window.index][2] == false
@actor.forget_skill(@skill_window.skill.id)
end
@actor.learn_skill(@skill_id_2[@skillup_window.index][0])
@skill_window.refresh
@skill_id_1 = @skill_window.skill.id
@skill_id_2 = get_nextskill(@skill_id_1,@actor)
@skillup_window.refresh(@skill_id_2,@actor.exp,get_skil)
@skillup_window.index = 0
if get_nextskill(@skill_window.skill.id,@actor) == []
@skillup_window.active = false
@skillupindex = nil
@skill_window.active = true
end
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
end
复制代码
不确定成功
作者:
zgm1100
时间:
2011-7-28 00:19
不行。。会直接退出游戏
作者:
坚强的羁绊
时间:
2011-7-28 00:35
$shizi_技能学习音 = ["005-System05",80]
$shizi_skillup_id[0] = [[1],[2],[3] ]
$shizi_skillup_gold[0] =[100,200,false]
$shizi_skillup_id[1] = [[2,3],[4] ]
$shizi_skillup_gold[1] =[500 ,true]
$shizi_skillup_id[2] = [[4] ,[5] ]
$shizi_skillup_gold[2] =[1000,false]
$shizi_skillup_id[3] = [[22],[23],[24] ]
$shizi_skillup_gold[3] =[300 ,600 ,false]
$shizi_skillup_id[4] = [[23,24],[59]]
$shizi_skillup_gold[4] =[1500 ,true]
复制代码
在自定义那覆盖上
作者:
zgm1100
时间:
2011-7-28 09:57
还是不行,,一调用$scene = Scene_Skillup.new就会退出游戏。、
作者:
Wind2010
时间:
2011-7-28 10:53
$shizi_skillup_id = []
$shizi_skillup_exp =[]
=begin
技能升级系统
下面的为自定义内容,格式为:
$shizi_skillup_id[0] = [[技能ID] ,[技能ID] , .. ,[技能ID] ]
$shizi_skillup_exp[0] =[[升级需要EXP],[升级需要EXP], .. ,[是否保留原技能]]
$shizi_skillup_id[1] = [[技能ID] ,[技能ID] , .. ,[技能ID] ]
$shizi_skillup_exp[1] =[[升级需要EXP],[升级需要EXP], .. ,[是否保留原技能]]
...
空格可以去掉, 那只是编写时对齐用的
如果保留原技能(升级不遗忘旧技能,具体功能自己开发),“是否保留原技能”为true,
否则为false
技能ID一定要用[]框住,而“是否保留原技能”则不需要。
自定义内容↓
=end
$shizi_技能学习音 = ["005-System05",80]
$shizi_skillup_id[0] = [[1],[2],[3] ]
$shizi_skillup_exp[0] =[100,200,false]
$shizi_skillup_id[1] = [[2,3],[4] ]
$shizi_skillup_exp[1] =[500 ,true]
$shizi_skillup_id[2] = [[4] ,[5] ]
$shizi_skillup_exp[2] =[1000,false]
$shizi_skillup_id[3] = [[22],[23],[24] ]
$shizi_skillup_exp[3] =[300 ,600 ,false]
$shizi_skillup_id[4] = [[23,24],[59]]
$shizi_skillup_exp[4] =[1500 ,true]
#==============================================================================
# 脚本内容
#==============================================================================
def get_nextskill(id,actor)
get = []
if $shizi_skillup_id.size != $shizi_skillup_exp.size
p "数量不符"
exit
end
for i in 0...$shizi_skillup_id.size
i_1 = $shizi_skillup_id[i]
for j in 2..i_1.size
j_1 = i_1[i_1.size-j]
if j_1.include?(id)
skill = $shizi_skillup_exp[i]
skill_1 = skill[j_1.size-j]
if skill.include?(true)
get[get.size] = [i_1[i_1.size-j+1][0],skill[i_1.size-j],true]
else
get[get.size] = [i_1[i_1.size-j+1][0],skill[i_1.size-j],false]
end
end
end
end
skill_id = []
for i in 0...actor.skills.size
skill = $data_skills[actor.skills[i]]
if skill != nil
skill_id.push(skill)
end
end
for i in 0...get.size
if skill_id.include?(get[i][0])
get.delete_at(i)
end
end
return get
end
def get_nextskill_id(num)
get = []
for i in num
get[get.size] = i[0]
end
return get
end
#==============================================================================
# ● 空白窗口
#==============================================================================
class Window_Shizi_White < Window_Base
def initialize
super(0,0,640,480)
self.contents = Bitmap.new(width - 32, height - 32)
end
def clear
self.contents.clear
end
def refresh
self.contents = Bitmap.new(width - 32, height - 32)
end
def draw(text, align = 1)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
@align = align
end
self.visible = true
end
end
#==============================================================================
# ● 选择技能窗口
#==============================================================================
class Window_Shizi_Skill < Window_Selectable
def initialize(actor)
super(0, 0, 320, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.y = 64
@actor = actor
refresh
self.index = 0
end
def skill
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in
[email protected]
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 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
#==============================================================================
# ● 升级技能窗口
#==============================================================================
class Window_Shizi_Skillup < Window_Selectable
def initialize
super(0, 0, 320, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.y = 64
self.x = 320
self.index = 0
end
def refresh(num,gold,skil)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = get_nextskill_id(num)
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i,gold,num,skil)
end
else
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.color = disabled_color
self.contents.draw_text(0, 0, width - 32, 32, "不能再升级", 1)
end
end
def draw_item(index,gold,num,skil)
skill = $data_skills[@data[index]]
if gold >= num[index][1] or skil.include?(skill)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 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
#==============================================================================
# ● 升级技能场景
#==============================================================================
class Scene_Skillup
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
def main
@actor = $game_party.actors[@actor_index]
@skill_window = Window_Shizi_Skill.new(@actor)
@skill_window.index = 0
@skill_window.active = true
@skillup_window = Window_Shizi_Skillup.new
@skillup_window.active = false
@draw_window = Window_Shizi_White.new
@draw_window.height = 64
@draw_window.refresh
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@skill_window.dispose
@skillup_window.dispose
@draw_window.dispose
end
def update
if @skillindex == nil and @skill_window.active
@skillindex = 0
@skill_id_1 = @skill_window.skill.id
@skill_id_2 = get_nextskill(@skill_id_1,@actor)
@skillup_window.refresh(@skill_id_2,$game_party.gold,get_skil)
text = @actor.name + " " + $data_system.words.gold + ":"+ $game_party.gold.to_s
@draw_window.draw(text)
end
if @skillupindex == nil and @skillup_window.active
@skillupindex = 0
text ="升级需要" + $data_system.words.gold + ":" + @skill_id_2[@skillup_window.index][1].to_s
@draw_window.draw(text)
end
@skill_window.update
@skillup_window.update
@draw_window.update
if @skill_window.active
update_skill
return
end
if @skillup_window.active
update_skillup
return
end
end
def get_skil
skil = []
for i in
[email protected]
shizi_skill = $data_skills[@actor.skills[i]]
if shizi_skill != nil
skil.push(shizi_skill.id)
end
end
return skil
end
def update_skill
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skillup.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skillup.new(@actor_index)
return
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if @skill_window.index != @skillindex
@skillindex = @skill_window.index
@skill_id_1 = @skill_window.skill.id
@skill_id_2 = get_nextskill(@skill_id_1,@actor)
@skillup_window.refresh(@skill_id_2,@actor.exp,get_skil)
end
if Input.trigger?(Input::C)
if @skill_id_2 != []
@skill_window.active = false
@skillup_window.active = true
$game_system.se_play($data_system.decision_se)
@skillindex = nil
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
def update_skillup
if @skillup_window.index != @skillupindex
@skillupindex = @skillup_window.index
text ="升级需要" + $data_system.words.gold + ":" + @skill_id_2[@skillup_window.index][1].to_s
@draw_window.draw(text)
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skillup_window.index = 0
@skillup_window.active = false
@skill_window.active = true
@skillupindex = nil
return
end
if Input.trigger?(Input::C)
if @actor.exp >= @skill_id_2[@skillup_window.index][1] and @actor.skill_learn?(@skill_id_2[@skillup_window.index][0]) == false
Audio.se_play("Audio/SE/" + $shizi_技能学习音[0],$shizi_技能学习音[1])
$game_party.gold -= @skill_id_2[@skillup_window.index][1]
#@actor.exp -= @skill_id_2[@skillup_window.index][1]
if @skill_id_2[@skillup_window.index][2] == false
@actor.forget_skill(@skill_window.skill.id)
end
@actor.learn_skill(@skill_id_2[@skillup_window.index][0])
@skill_window.refresh
@skill_id_1 = @skill_window.skill.id
@skill_id_2 = get_nextskill(@skill_id_1,@actor)
@skillup_window.refresh(@skill_id_2,@actor.exp,get_skil)
@skillup_window.index = 0
if get_nextskill(@skill_window.skill.id,@actor) == []
@skillup_window.active = false
@skillupindex = nil
@skill_window.active = true
end
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
end
复制代码
这次应该没问题了
作者:
zgm1100
时间:
2011-7-28 11:09
本帖最后由 zgm1100 于 2011-7-28 11:27 编辑
哇。。可以调出窗口了。。不过。。还有个小问题:不能学习技能,学习了就自动退出游戏。是美化得到物品提示问题?。。。
320行左右的:$game_party.gold -= @skill_id_2[@skillup_window.index][1] 有问题
zgm1100于2011-7-28 21:08补充以下内容:
$game_party.gain_gold(- @skill_id_2[@skillup_window.index][1])
该这么改。。
测试成功!!哈哈!!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1