设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 4285|回复: 16
打印 上一主题 下一主题

[已经解决] 想美化一下战斗胜利结果窗口

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1055 小时
注册时间
2010-6-17
帖子
85
跳转到指定楼层
1
发表于 2010-6-24 16:56:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
战斗胜利以后想插进入一张图片做底图,这图片怎么插进去?(图片上面画的是“exp”“战利品”“钱”等字)
还有就是想加入角色胜利以后总经验值,但是我加进去以后显示的总是获得这次战斗经验值以前的值,怎么办?

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1055 小时
注册时间
2010-6-17
帖子
85
2
 楼主| 发表于 2010-6-24 19:10:13 | 只看该作者
没人吗?
回复 支持 反对

使用道具 举报

Lv3.寻梦者

宛若

梦石
0
星屑
1568
在线时间
526 小时
注册时间
2007-8-19
帖子
1493

极短24参与开拓者

3
发表于 2010-6-24 20:16:06 | 只看该作者
本帖最后由 逸豫 于 2010-6-24 20:22 编辑
  1. #==============================================================================
  2. # ■ Window_BattleResult
  3. #------------------------------------------------------------------------------
  4. #  战斗结束时、显示获得的 EXP 及金钱的窗口。
  5. #==============================================================================

  6. class Window_BattleResult < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     exp       : EXP
  10.   #     gold      : 金钱
  11.   #     treasures : 宝物
  12.   #--------------------------------------------------------------------------
  13.   def initialize(exp, gold, treasures)
  14.     @exp = exp
  15.     @gold = gold
  16.     @treasures = treasures
  17.     @bg = Sprite.new
  18.     @bg.bitmap =Bitmap.new("Graphics/Pictures/背景图.png")
  19.     super(160, 0, 320, @treasures.size * 32 + 64)
  20.     self.contents = Bitmap.new(width - 32, height - 32)
  21.     self.y = 160 - height / 2
  22.     self.back_opacity = 160
  23.     self.visible = false
  24.     refresh
  25.   end
  26.   #--------------------------------------------------------------------------
  27.   # ● 刷新
  28.   #--------------------------------------------------------------------------
  29.   def refresh
  30.     self.contents.clear
  31.     x = 4
  32.     self.contents.font.color = normal_color
  33.     cx = contents.text_size(@exp.to_s).width
  34.     self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
  35.     x += cx + 4
  36.     self.contents.font.color = system_color
  37.     cx = contents.text_size("EXP").width
  38.     self.contents.draw_text(x, 0, 64, 32, "EXP")
  39.     x += cx + 16
  40.     self.contents.font.color = normal_color
  41.     cx = contents.text_size(@gold.to_s).width
  42.     self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
  43.     x += cx + 4
  44.     self.contents.font.color = system_color
  45.     self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
  46.     y = 32
  47.     for item in @treasures
  48.       draw_item_name(item, 4, y)
  49.       y += 32
  50.     end
  51.   end
  52.   alias d dispose
  53.   def dispose
  54.     d
  55.     @bg.dispose
  56.   end
  57. end
复制代码
插入至main脚本前面,在picture里面放上背景图.png


Scene_Battle 2 172行会为角色添加EXP,如果想显示角色经验值请在此行之后显示

评分

参与人数 1星屑 +200 收起 理由
「旅」 + 200 认可答案

查看全部评分

[url=http://rpg.blue/thread-219730-1-1.html]http://unhero.sinaapp.com/wi.php[/url]
[color=Red]如你所见这是个死坑,没错这就是打我的脸用的[/color]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
70
在线时间
275 小时
注册时间
2008-10-22
帖子
205
4
发表于 2010-6-24 20:42:22 | 只看该作者
本帖最后由 u566 于 2010-6-24 20:44 编辑
  1. #==============================================================================
  2. #  战斗结束动态增加EXP条 v0.1    作者:灯笼菜刀王
  3. #==============================================================================
  4. class Window_BattleResult < Window_Base
  5.   #--------------------------------------------------------------------------
  6.   # ● 初始化对像
  7.   #     exp       : EXP
  8.   #     gold      : 金钱
  9.   #     treasures : 宝物
  10.   #--------------------------------------------------------------------------
  11.   def initialize(exp, gold, treasures)
  12.     @exp = exp
  13.     @gold = gold
  14.     @treasures = treasures
  15.     @expup = []
  16.     @expnow = []
  17.     for i in 0...$game_party.actors.size
  18.      actor = $game_party.actors[i]
  19.      now = actor.now_exp
  20.      max = actor.next_exp
  21.      now = now > max ? max : now
  22.      @expnow[i] = max != 0 ? 98 * now / max.to_f : 0
  23.       now2 = actor.now_exp - @exp
  24.       now2 = now2 > max ? max : now2
  25.      @expup[i] = max != 0 ? 98 * now2 / max.to_f : 0
  26.     end
  27.     super(140, 0, 400, 8 * 32 + 64)
  28.     self.contents = Bitmap.new(width - 32, height - 32)
  29.     self.y = 160 - height / 2
  30.     self.back_opacity = 160
  31.     self.visible = false
  32.     refresh
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● 刷新
  36.   #--------------------------------------------------------------------------
  37.   def refresh
  38.     self.contents.clear
  39.     x = 6
  40.     self.contents.font.color = normal_color
  41.     cx = contents.text_size(@exp.to_s).width
  42.     self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
  43.     x += cx + 4
  44.     self.contents.font.color = system_color
  45.     cx = contents.text_size("EXP").width
  46.     self.contents.draw_text(x, 0, 64, 32, "EXP")
  47.     x += cx + 16
  48.     self.contents.font.color = normal_color
  49.     cx = contents.text_size(@gold.to_s).width
  50.     self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
  51.     x += cx + 4
  52.     self.contents.font.color = system_color
  53.     self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
  54.     cx = contents.text_size($data_system.words.gold).width
  55.     self.contents.draw_text(208,0,128,32,"战利品")
  56.     for i in 0...$game_party.actors.size
  57.       actor = $game_party.actors[i]
  58.       draw_actor_graphic(actor, 20, i*60+92)
  59.       draw_actor_name(actor, 34, i*60+42)
  60.       self.contents.fill_rect(26, i*60+76, 100, 8,Color.new(192,192,192,255))
  61.       self.contents.fill_rect(28, i*60+78, 96, 4, Color.new(128,128,128,128))
  62.       now = actor.now_exp - @exp
  63.       max = actor.next_exp
  64.       now = now > max ? max : now
  65.       a = max != 0 ? 78 * now / max.to_f : 0
  66.       self.contents.fill_rect(27, i*60+77, @expup[i], 6, Color.new(150, 255, 150, 255))
  67.     end
  68.     y = 32
  69.     for item in @treasures
  70.       draw_item_name(item, 180, y)
  71.       y += 32
  72.     end
  73.   end
  74. def update
  75.    for i in 0...$game_party.actors.size
  76.      if @expup[i] < @expnow[i]
  77.        @expup[i] += 1
  78.      end
  79.    end
  80.    refresh
  81. end
  82. end
  83. class Game_Actor < Game_Battler
  84.   def now_exp
  85.    return @exp - @exp_list[@level]
  86.   end
  87.   def next_exp
  88.    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  89.   end
  90. end
  91. class Scene_Battle
  92.   def update
  93.     # 执行战斗事件中的情况下
  94.     if $game_system.battle_interpreter.running?
  95.       # 刷新解释器
  96.       $game_system.battle_interpreter.update
  97.       # 强制行动的战斗者不存在的情况下
  98.       if $game_temp.forcing_battler == nil
  99.         # 执行战斗事件结束的情况下
  100.         unless $game_system.battle_interpreter.running?
  101.           # 继续战斗的情况下、再执行战斗事件的设置
  102.           unless judge
  103.             setup_battle_event
  104.           end
  105.         end
  106.         # 如果不是结束战斗回合的情况下
  107.         if @phase != 5
  108.           # 刷新状态窗口
  109.           @status_window.refresh
  110.         end
  111.       end
  112.     end
  113.     # 系统 (计时器)、刷新画面
  114.     $game_system.update
  115.     $game_screen.update
  116.     # 计时器为 0 的情况下
  117.     if $game_system.timer_working and $game_system.timer == 0
  118.       # 中断战斗
  119.       $game_temp.battle_abort = true
  120.     end
  121.     # 刷新窗口
  122.     @help_window.update
  123.     @party_command_window.update
  124.     @actor_command_window.update
  125.     @status_window.update
  126.     @message_window.update
  127.     #####菜刀王到此一游################
  128.     if @result_window != nil
  129.       @result_window.update
  130.     end
  131.     ###################################
  132.     # 刷新活动块
  133.     @spriteset.update
  134.     # 处理过渡中的情况下
  135.     if $game_temp.transition_processing
  136.       # 清除处理过渡中标志
  137.       $game_temp.transition_processing = false
  138.       # 执行过渡
  139.       if $game_temp.transition_name == ""
  140.         Graphics.transition(20)
  141.       else
  142.         Graphics.transition(40, "Graphics/Transitions/" +
  143.           $game_temp.transition_name)
  144.       end
  145.     end
  146.     # 显示信息窗口中的情况下
  147.     if $game_temp.message_window_showing
  148.       return
  149.     end
  150.     # 显示效果中的情况下
  151.     if @spriteset.effect?
  152.       return
  153.     end
  154.     # 游戏结束的情况下
  155.     if $game_temp.gameover
  156.       # 切换到游戏结束画面
  157.       $scene = Scene_Gameover.new
  158.       return
  159.     end
  160.     # 返回标题画面的情况下
  161.     if $game_temp.to_title
  162.       # 切换到标题画面
  163.       $scene = Scene_Title.new
  164.       return
  165.     end
  166.     # 中断战斗的情况下
  167.     if $game_temp.battle_abort
  168.       # 还原为战斗前的 BGM
  169.       $game_system.bgm_play($game_temp.map_bgm)
  170.       # 战斗结束
  171.       battle_end(1)
  172.       return
  173.     end
  174.     # 等待中的情况下
  175.     if @wait_count > 0
  176.       # 减少等待计数
  177.       @wait_count -= 1
  178.       return
  179.     end
  180.     # 强制行动的角色存在、
  181.     # 并且战斗事件正在执行的情况下
  182.     if $game_temp.forcing_battler == nil and
  183.        $game_system.battle_interpreter.running?
  184.       return
  185.     end
  186.     # 回合分支
  187.     case @phase
  188.     when 1  # 自由战斗回合
  189.       update_phase1
  190.     when 2  # 同伴命令回合
  191.       update_phase2
  192.     when 3  # 角色命令回合
  193.       update_phase3
  194.     when 4  # 主回合
  195.       update_phase4
  196.     when 5  # 战斗结束回合
  197.       update_phase5
  198.     end
  199.   end
  200.   def start_phase5
  201.     # 转移到回合 5
  202.     @phase = 5
  203.     # 演奏战斗结束 ME
  204.     $game_system.me_play($game_system.battle_end_me)
  205.     # 还原为战斗开始前的 BGM
  206.     $game_system.bgm_play($game_temp.map_bgm)
  207.     # 初始化 EXP、金钱、宝物
  208.     exp = 0
  209.     gold = 0
  210.     treasures = []
  211.     # 循环
  212.     for enemy in $game_troop.enemies
  213.       # 敌人不是隐藏状态的情况下
  214.       unless enemy.hidden
  215.         # 获得 EXP、增加金钱
  216.         exp += enemy.exp
  217.         gold += enemy.gold
  218.         # 出现宝物判定
  219.         if rand(100) < enemy.treasure_prob
  220.           if enemy.item_id > 0
  221.             treasures.push($data_items[enemy.item_id])
  222.           end
  223.           if enemy.weapon_id > 0
  224.             treasures.push($data_weapons[enemy.weapon_id])
  225.           end
  226.           if enemy.armor_id > 0
  227.             treasures.push($data_armors[enemy.armor_id])
  228.           end
  229.         end
  230.       end
  231.     end
  232.     # 限制宝物数为 6 个
  233.     treasures = treasures[0..5]
  234.     # 获得 EXP
  235.     for i in 0...$game_party.actors.size
  236.       actor = $game_party.actors[i]
  237.       if actor.cant_get_exp? == false
  238.         last_level = actor.level
  239.         actor.exp += exp
  240.         if actor.level > last_level
  241.           @status_window.level_up(i)
  242.           actor.hp = actor.maxhp;   
  243.           actor.sp = actor.maxsp
  244.         end
  245.       end
  246.     end
  247.     # 获得金钱
  248.     $game_party.gain_gold(gold)
  249.     # 获得宝物
  250.     for item in treasures
  251.       case item
  252.       when RPG::Item
  253.         $game_party.gain_item(item.id, 1)
  254.       when RPG::Weapon
  255.         $game_party.gain_weapon(item.id, 1)
  256.       when RPG::Armor
  257.         $game_party.gain_armor(item.id, 1)
  258.       end
  259.     end
  260.     # 生成战斗结果窗口
  261.     @result_window = Window_BattleResult.new(exp, gold, treasures)
  262.     ######菜刀王到此一游###############
  263.     @result_window.visible = true
  264.     ###################################
  265.     # 设置等待计数
  266.     @phase5_wait_count = 100
  267.   end
  268. end
复制代码
插入至main脚本前面即可
额,这个不能插图的

评分

参与人数 1星屑 +200 收起 理由
「旅」 + 200 认可答案

查看全部评分

本人处男作《江湖传之剑侠情》
脚本 ||||||||80%
声音 ||15%
素材 |||30%
剧情 |||||||||90%
物品 ||||||60%
地图 |6%
技能 |10%
职业 |||||||70%
综合 |||26%
━━━━━━━━━━━━━━━━━━━━━
已用时:68小时
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1055 小时
注册时间
2010-6-17
帖子
85
5
 楼主| 发表于 2010-6-24 20:59:40 | 只看该作者
都试了一下,都很好用,谢谢
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1055 小时
注册时间
2010-6-17
帖子
85
6
 楼主| 发表于 2010-6-24 23:27:18 | 只看该作者
如果我想执行一个过渡再出现图片,这该怎么做?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
77 小时
注册时间
2008-5-16
帖子
194
7
发表于 2010-6-25 03:07:10 | 只看该作者
过渡什么。。。像仙剑那样显示个战斗胜利的图片,然后在显示结果窗口么-。-
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
270 小时
注册时间
2010-2-4
帖子
1305
8
发表于 2010-6-25 07:34:09 | 只看该作者
不解释
  1. class Scene_Battle
  2. alias banxian_main main
  3. def main
  4.   banxian_main
  5.   Graphics.transition(40, "Graphics/Transitions/" +
  6.      $data_system.battle_transition)
  7.    end
  8. end
复制代码
好歹当年也当过大魔王过,orz
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1055 小时
注册时间
2010-6-17
帖子
85
9
 楼主| 发表于 2010-6-25 08:22:12 | 只看该作者
插在哪里?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
77 小时
注册时间
2008-5-16
帖子
194
10
发表于 2010-6-25 08:33:24 | 只看该作者
看样子应该直接加在MAIN前面就可以了。。。。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-29 16:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表