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

Project1

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

[已经解决] 问一个关于血条脚本的问题……

 关闭 [复制链接]

Lv1.梦旅人

军火商

梦石
0
星屑
55
在线时间
7 小时
注册时间
2008-7-19
帖子
835
跳转到指定楼层
1
发表于 2009-9-26 21:12:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 MUNITIONER 于 2009-9-29 12:12 编辑

http://rpg.blue/web/index.php?doc-view-4082

用了这个血条脚本,为什么只要在战斗时设置“显示文章”,血条就变回文字了?=  =

谢谢各位。
LINE]1,#dddddd[/LINE]<font color="#666666">[/COLOR]

Lv1.梦旅人

~琉璃の雪~<

梦石
0
星屑
49
在线时间
36 小时
注册时间
2008-11-6
帖子
3678
2
发表于 2009-9-27 05:33:38 | 只看该作者
这个是血条脚本原有的bug,出自于魔力1.0,你还是换一个把
送上一个:
  1. class Window_Base < Window  
  2.   #--------------------------------------------------------------------------
  3.   # * Draw Slant Bar
  4.   #--------------------------------------------------------------------------
  5.   def draw_slant_bar(x, y, min, max, width = 152, height = 6,
  6.       bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
  7.     # Draw Border
  8.     for i in 0..height
  9.       self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
  10.     end
  11.     # Draw Background
  12.     for i in 1..(height - 1)
  13.       r = 100 * (height - i) / height + 0 * i / height
  14.       g = 100 * (height - i) / height + 0 * i / height
  15.       b = 100 * (height - i) / height + 0 * i / height
  16.       a = 255 * (height - i) / height + 255 * i / height
  17.       self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
  18.     end
  19.     # Draws Bar
  20.     for i in 1..( (min / max.to_f) * width - 1)
  21.       for j in 1..(height - 1)
  22.         r = bar_color.red * (width - i) / width + end_color.red * i / width
  23.         g = bar_color.green * (width - i) / width + end_color.green * i / width
  24.         b = bar_color.blue * (width - i) / width + end_color.blue * i / width
  25.         a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
  26.         self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
  27.       end
  28.     end
  29.   end
  30. end


  31. class Window_EnemyHP < Window_Base
  32.   
  33.   def initialize
  34.     super(0, 0, 640, 480)
  35.     self.contents = Bitmap.new(width - 32, height - 32)
  36.     self.opacity = 0
  37.     refresh
  38.   end
  39.   
  40.   def refresh
  41.     self.contents.clear
  42.     for i in 0...$game_troop.enemies.size
  43.       @enemy = $game_troop.enemies[i]
  44.       @percent = (@enemy.hp * 100) / @enemy.maxhp
  45.       unless @enemy.hp == 0
  46.       draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 10, @enemy.hp, @enemy.maxhp, width = 75, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
  47.       self.contents.draw_text(@enemy.screen_x - 39, @enemy.screen_y - 22, 100, 32, "#{@percent}" + "%")
  48.     end
  49.   end
  50. end
  51. end

  52. class Scene_Battle
  53.   
  54.   alias raz_update update
  55.   alias raz_update_phase5 update_phase5
  56.   alias raz_update_phase4_step1 update_phase4_step1
  57.   alias raz_update_phase4_step5 update_phase4_step5
  58.   alias raz_enemy_hp_main main
  59.   
  60.    def main
  61.     @troop_id = $game_temp.battle_troop_id
  62.     $game_troop.setup(@troop_id)
  63.     @enemy_window = Window_EnemyHP.new
  64.     @enemy_window.z = 95
  65.     raz_enemy_hp_main
  66.     @enemy_window.dispose
  67.   end

  68.   
  69.   def update
  70.     @enemy_window.update
  71.     raz_update
  72.   end

  73.   def update_phase5
  74.     # If wait count is larger than 0
  75.     if @phase5_wait_count > 0
  76.       # Decrease wait count
  77.       @phase5_wait_count -= 1
  78.       # If wait count reaches 0
  79.       if @phase5_wait_count == 0
  80.         @enemy_window.visible = false
  81.         # Show result window
  82.         @result_window.visible = true
  83.         # Clear main phase flag
  84.         $game_temp.battle_main_phase = false
  85.         # Refresh status window
  86.         @status_window.refresh
  87.         @enemy_window.refresh
  88.       end
  89.       return
  90.     end
  91.    raz_update_phase5
  92. end

  93. def update_phase4_step1
  94.   raz_update_phase4_step1
  95.   @enemy_window.refresh
  96. end

  97.   def update_phase4_step5
  98.     # Hide help window
  99.     @help_window.visible = false
  100.     # Refresh status window
  101.     @status_window.refresh
  102.     @enemy_window.refresh
  103.     raz_update_phase4_step5
  104.   end
  105. end

  106. class Window_BattleStatus < Window_Base
  107.   #--------------------------------------------------------------------------
  108.   # * Object Initialization
  109.   #--------------------------------------------------------------------------
  110.   def initialize
  111.     super(0, 320, 640, 160)
  112.     self.contents = Bitmap.new(width - 32, height - 32)
  113.     @level_up_flags = [false, false, false, false]
  114.     refresh
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # * Dispose
  118.   #--------------------------------------------------------------------------
  119.   def dispose
  120.     super
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # * Set Level Up Flag
  124.   #     actor_index : actor index
  125.   #--------------------------------------------------------------------------
  126.   def level_up(actor_index)
  127.     @level_up_flags[actor_index] = true
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # * Refresh
  131.   #--------------------------------------------------------------------------
  132.   def refresh
  133.     self.contents.clear
  134.     @item_max = $game_party.actors.size
  135.     for i in 0...$game_party.actors.size
  136.       actor = $game_party.actors[i]
  137.       actor_x = i * 160 + 4
  138.       draw_slant_bar(actor_x, 55, actor.hp, actor.maxhp, 120)
  139.       draw_slant_bar(actor_x, 88, actor.sp, actor.maxsp, 120, 6, bar_color = Color.new(150, 0, 150, 255), end_color = Color.new(0, 0, 255, 255))
  140.       draw_actor_name(actor, actor_x, 0)
  141.       draw_actor_hp(actor, actor_x, 32, 120)
  142.       draw_actor_sp(actor, actor_x, 64, 120)
  143.       if @level_up_flags[i]
  144.         self.contents.font.color = normal_color
  145.         self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
  146.       else
  147.         draw_actor_state(actor, actor_x, 96)
  148.       end
  149.     end
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # * Frame Update
  153.   #--------------------------------------------------------------------------
  154.   def update
  155.     super
  156.     # Slightly lower opacity level during main phase
  157.     if $game_temp.battle_main_phase
  158.       self.contents_opacity -= 4 if self.contents_opacity > 191
  159.     else
  160.       self.contents_opacity += 4 if self.contents_opacity < 255
  161.     end
  162.   end
  163. end







  164. * 教学正文:

  165.    class Window_Base < Window  
  166.   #--------------------------------------------------------------------------
  167.   # * Draw Slant Bar
  168.   #--------------------------------------------------------------------------
  169.   def draw_slant_bar(x, y, min, max, width = 152, height = 6,
  170.       bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
  171.     # Draw Border
  172.     for i in 0..height
  173.       self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
  174.     end
  175.     # Draw Background
  176.     for i in 1..(height - 1)
  177.       r = 100 * (height - i) / height + 0 * i / height
  178.       g = 100 * (height - i) / height + 0 * i / height
  179.       b = 100 * (height - i) / height + 0 * i / height
  180.       a = 255 * (height - i) / height + 255 * i / height
  181.       self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
  182.     end
  183.     # Draws Bar
  184.     for i in 1..( (min / max.to_f) * width - 1)
  185.       for j in 1..(height - 1)
  186.         r = bar_color.red * (width - i) / width + end_color.red * i / width
  187.         g = bar_color.green * (width - i) / width + end_color.green * i / width
  188.         b = bar_color.blue * (width - i) / width + end_color.blue * i / width
  189.         a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
  190.         self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
  191.       end
  192.     end
  193.   end
  194. end


  195. class Window_EnemyHP < Window_Base
  196.   
  197.   def initialize
  198.     super(0, 0, 640, 480)
  199.     self.contents = Bitmap.new(width - 32, height - 32)
  200.     self.opacity = 0
  201.     refresh
  202.   end
  203.   
  204.   def refresh
  205.     self.contents.clear
  206.     for i in 0...$game_troop.enemies.size
  207.       @enemy = $game_troop.enemies[i]
  208.       @percent = (@enemy.hp * 100) / @enemy.maxhp
  209.       unless @enemy.hp == 0
  210.       draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 10, @enemy.hp, @enemy.maxhp, width = 75, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
  211.       self.contents.draw_text(@enemy.screen_x - 39, @enemy.screen_y - 22, 100, 32, "#{@percent}" + "%")
  212.     end
  213.   end
  214. end
  215. end

  216. class Scene_Battle
  217.   
  218.   alias raz_update update
  219.   alias raz_update_phase5 update_phase5
  220.   alias raz_update_phase4_step1 update_phase4_step1
  221.   alias raz_update_phase4_step5 update_phase4_step5
  222.   alias raz_enemy_hp_main main
  223.   
  224.    def main
  225.     @troop_id = $game_temp.battle_troop_id
  226.     $game_troop.setup(@troop_id)
  227.     @enemy_window = Window_EnemyHP.new
  228.     @enemy_window.z = 95
  229.     raz_enemy_hp_main
  230.     @enemy_window.dispose
  231.   end

  232.   
  233.   def update
  234.     @enemy_window.update
  235.     raz_update
  236.   end

  237.   def update_phase5
  238.     # If wait count is larger than 0
  239.     if @phase5_wait_count > 0
  240.       # Decrease wait count
  241.       @phase5_wait_count -= 1
  242.       # If wait count reaches 0
  243.       if @phase5_wait_count == 0
  244.         @enemy_window.visible = false
  245.         # Show result window
  246.         @result_window.visible = true
  247.         # Clear main phase flag
  248.         $game_temp.battle_main_phase = false
  249.         # Refresh status window
  250.         @status_window.refresh
  251.         @enemy_window.refresh
  252.       end
  253.       return
  254.     end
  255.    raz_update_phase5
  256. end

  257. def update_phase4_step1
  258.   raz_update_phase4_step1
  259.   @enemy_window.refresh
  260. end

  261.   def update_phase4_step5
  262.     # Hide help window
  263.     @help_window.visible = false
  264.     # Refresh status window
  265.     @status_window.refresh
  266.     @enemy_window.refresh
  267.     raz_update_phase4_step5
  268.   end
  269. end

  270. class Window_BattleStatus < Window_Base
  271.   #--------------------------------------------------------------------------
  272.   # * Object Initialization
  273.   #--------------------------------------------------------------------------
  274.   def initialize
  275.     super(0, 320, 640, 160)
  276.     self.contents = Bitmap.new(width - 32, height - 32)
  277.     @level_up_flags = [false, false, false, false]
  278.     refresh
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # * Dispose
  282.   #--------------------------------------------------------------------------
  283.   def dispose
  284.     super
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # * Set Level Up Flag
  288.   #     actor_index : actor index
  289.   #--------------------------------------------------------------------------
  290.   def level_up(actor_index)
  291.     @level_up_flags[actor_index] = true
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # * Refresh
  295.   #--------------------------------------------------------------------------
  296.   def refresh
  297.     self.contents.clear
  298.     @item_max = $game_party.actors.size
  299.     for i in 0...$game_party.actors.size
  300.       actor = $game_party.actors[i]
  301.       actor_x = i * 160 + 4
  302.       draw_slant_bar(actor_x, 55, actor.hp, actor.maxhp, 120)
  303.       draw_slant_bar(actor_x, 88, actor.sp, actor.maxsp, 120, 6, bar_color = Color.new(150, 0, 150, 255), end_color = Color.new(0, 0, 255, 255))
  304.       draw_actor_name(actor, actor_x, 0)
  305.       draw_actor_hp(actor, actor_x, 32, 120)
  306.       draw_actor_sp(actor, actor_x, 64, 120)
  307.       if @level_up_flags[i]
  308.         self.contents.font.color = normal_color
  309.         self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
  310.       else
  311.         draw_actor_state(actor, actor_x, 96)
  312.       end
  313.     end
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # * Frame Update
  317.   #--------------------------------------------------------------------------
  318.   def update
  319.     super
  320.     # Slightly lower opacity level during main phase
  321.     if $game_temp.battle_main_phase
  322.       self.contents_opacity -= 4 if self.contents_opacity > 191
  323.     else
  324.       self.contents_opacity += 4 if self.contents_opacity < 255
  325.     end
  326.   end
  327. end







  328. * 教学正文:

  329.    class Window_Base < Window  
  330.   #--------------------------------------------------------------------------
  331.   # * Draw Slant Bar
  332.   #--------------------------------------------------------------------------
  333.   def draw_slant_bar(x, y, min, max, width = 152, height = 6,
  334.       bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
  335.     # Draw Border
  336.     for i in 0..height
  337.       self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
  338.     end
  339.     # Draw Background
  340.     for i in 1..(height - 1)
  341.       r = 100 * (height - i) / height + 0 * i / height
  342.       g = 100 * (height - i) / height + 0 * i / height
  343.       b = 100 * (height - i) / height + 0 * i / height
  344.       a = 255 * (height - i) / height + 255 * i / height
  345.       self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
  346.     end
  347.     # Draws Bar
  348.     for i in 1..( (min / max.to_f) * width - 1)
  349.       for j in 1..(height - 1)
  350.         r = bar_color.red * (width - i) / width + end_color.red * i / width
  351.         g = bar_color.green * (width - i) / width + end_color.green * i / width
  352.         b = bar_color.blue * (width - i) / width + end_color.blue * i / width
  353.         a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
  354.         self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
  355.       end
  356.     end
  357.   end
  358. end


  359. class Window_EnemyHP < Window_Base
  360.   
  361.   def initialize
  362.     super(0, 0, 640, 480)
  363.     self.contents = Bitmap.new(width - 32, height - 32)
  364.     self.opacity = 0
  365.     refresh
  366.   end
  367.   
  368.   def refresh
  369.     self.contents.clear
  370.     for i in 0...$game_troop.enemies.size
  371.       @enemy = $game_troop.enemies[i]
  372.       @percent = (@enemy.hp * 100) / @enemy.maxhp
  373.       unless @enemy.hp == 0
  374.       draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 10, @enemy.hp, @enemy.maxhp, width = 75, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
  375.       self.contents.draw_text(@enemy.screen_x - 39, @enemy.screen_y - 22, 100, 32, "#{@percent}" + "%")
  376.     end
  377.   end
  378. end
  379. end

  380. class Scene_Battle
  381.   
  382.   alias raz_update update
  383.   alias raz_update_phase5 update_phase5
  384.   alias raz_update_phase4_step1 update_phase4_step1
  385.   alias raz_update_phase4_step5 update_phase4_step5
  386.   alias raz_enemy_hp_main main
  387.   
  388.    def main
  389.     @troop_id = $game_temp.battle_troop_id
  390.     $game_troop.setup(@troop_id)
  391.     @enemy_window = Window_EnemyHP.new
  392.     @enemy_window.z = 95
  393.     raz_enemy_hp_main
  394.     @enemy_window.dispose
  395.   end

  396.   
  397.   def update
  398.     @enemy_window.update
  399.     raz_update
  400.   end

  401.   def update_phase5
  402.     # If wait count is larger than 0
  403.     if @phase5_wait_count > 0
  404.       # Decrease wait count
  405.       @phase5_wait_count -= 1
  406.       # If wait count reaches 0
  407.       if @phase5_wait_count == 0
  408.         @enemy_window.visible = false
  409.         # Show result window
  410.         @result_window.visible = true
  411.         # Clear main phase flag
  412.         $game_temp.battle_main_phase = false
  413.         # Refresh status window
  414.         @status_window.refresh
  415.         @enemy_window.refresh
  416.       end
  417.       return
  418.     end
  419.    raz_update_phase5
  420. end

  421. def update_phase4_step1
  422.   raz_update_phase4_step1
  423.   @enemy_window.refresh
  424. end

  425.   def update_phase4_step5
  426.     # Hide help window
  427.     @help_window.visible = false
  428.     # Refresh status window
  429.     @status_window.refresh
  430.     @enemy_window.refresh
  431.     raz_update_phase4_step5
  432.   end
  433. end

  434. class Window_BattleStatus < Window_Base
  435.   #--------------------------------------------------------------------------
  436.   # * Object Initialization
  437.   #--------------------------------------------------------------------------
  438.   def initialize
  439.     super(0, 320, 640, 160)
  440.     self.contents = Bitmap.new(width - 32, height - 32)
  441.     @level_up_flags = [false, false, false, false]
  442.     refresh
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # * Dispose
  446.   #--------------------------------------------------------------------------
  447.   def dispose
  448.     super
  449.   end
  450.   #--------------------------------------------------------------------------
  451.   # * Set Level Up Flag
  452.   #     actor_index : actor index
  453.   #--------------------------------------------------------------------------
  454.   def level_up(actor_index)
  455.     @level_up_flags[actor_index] = true
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # * Refresh
  459.   #--------------------------------------------------------------------------
  460.   def refresh
  461.     self.contents.clear
  462.     @item_max = $game_party.actors.size
  463.     for i in 0...$game_party.actors.size
  464.       actor = $game_party.actors[i]
  465.       actor_x = i * 160 + 4
  466.       draw_slant_bar(actor_x, 55, actor.hp, actor.maxhp, 120)
  467.       draw_slant_bar(actor_x, 88, actor.sp, actor.maxsp, 120, 6, bar_color = Color.new(150, 0, 150, 255), end_color = Color.new(0, 0, 255, 255))
  468.       draw_actor_name(actor, actor_x, 0)
  469.       draw_actor_hp(actor, actor_x, 32, 120)
  470.       draw_actor_sp(actor, actor_x, 64, 120)
  471.       if @level_up_flags[i]
  472.         self.contents.font.color = normal_color
  473.         self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
  474.       else
  475.         draw_actor_state(actor, actor_x, 96)
  476.       end
  477.     end
  478.   end
  479.   #--------------------------------------------------------------------------
  480.   # * Frame Update
  481.   #--------------------------------------------------------------------------
  482.   def update
  483.     super
  484.     # Slightly lower opacity level during main phase
  485.     if $game_temp.battle_main_phase
  486.       self.contents_opacity -= 4 if self.contents_opacity > 191
  487.     else
  488.       self.contents_opacity += 4 if self.contents_opacity < 255
  489.     end
  490.   end
  491. end


复制代码
~现在开始自绘头像~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

军火商

梦石
0
星屑
55
在线时间
7 小时
注册时间
2008-7-19
帖子
835
3
 楼主| 发表于 2009-9-28 18:36:32 | 只看该作者
谢谢,但请问为什么运行了会出现错误?说发生了SyntaxError。
LINE]1,#dddddd[/LINE]<font color="#666666">[/COLOR]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

~琉璃の雪~<

梦石
0
星屑
49
在线时间
36 小时
注册时间
2008-11-6
帖子
3678
4
发表于 2009-9-29 00:24:58 | 只看该作者
我运行的没错啊,是否LZ还加了其他脚本?
~现在开始自绘头像~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

军火商

梦石
0
星屑
55
在线时间
7 小时
注册时间
2008-7-19
帖子
835
5
 楼主| 发表于 2009-9-29 11:00:52 | 只看该作者
我加了一个泛用型升级提示 v1.1、地图名显示脚本以及一个黑暗圣剑传说中的Game_Actor脚本。
LINE]1,#dddddd[/LINE]<font color="#666666">[/COLOR]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

~琉璃の雪~<

梦石
0
星屑
49
在线时间
36 小时
注册时间
2008-11-6
帖子
3678
6
发表于 2009-9-29 11:03:49 | 只看该作者
工程发上来看看.
~现在开始自绘头像~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

军火商

梦石
0
星屑
55
在线时间
7 小时
注册时间
2008-7-19
帖子
835
7
 楼主| 发表于 2009-9-29 12:10:20 | 只看该作者
谢谢,弄出来了,只复制“教学正文”下面的脚本就行了。
十分感谢!
LINE]1,#dddddd[/LINE]<font color="#666666">[/COLOR]
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-1-6 23:07

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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