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

Project1

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

帮我改进下这个脚本

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
80 小时
注册时间
2008-2-3
帖子
175
跳转到指定楼层
1
发表于 2008-2-26 03:18:37 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
class Window_VariableWindow < Window_Base
  VISIBLE_ID = 1  # 可见性控制(开关ID)
  VALUE_ID = 1    # 数值控制(变量ID)
  def initialize
    super(0,0,200,60)
    self.opacity = 0
    self.visible = $game_switches[VISIBLE_ID]
    @data = $game_variables[VALUE_ID]
    refresh
  end
  def refresh
    self.contents.clear
    draw_icon(137,0,0)
    self.contents.draw_text(25, 0, 40, WLH, $game_variables[VALUE_ID])
  end
  def update
    self.visible = $game_switches[VISIBLE_ID]
    if @data != $game_variables[VALUE_ID]
      refresh
      @data = $game_variables[VALUE_ID]
    end
  end
end
class Scene_Map < Scene_Base
  alias variable_start start
  alias variable_update update
  alias variable_terminate terminate
  def start
    variable_start
    @variableWindow = Window_VariableWindow.new
  end
  def update
    @variableWindow.update
    variable_update
  end
  def terminate
    variable_terminate
    @variableWindow.dispose
  end
end

这个脚本功能为在地图左上角显示变量1作为HP。现在我想同时显示变量1 2 3 分别作为 攻 防 和 血,显示在左端。应该怎么修改呢?
版务信息:本贴由楼主自主结贴~
⊙﹏⊙

Lv1.梦旅人

梦石
0
星屑
50
在线时间
12 小时
注册时间
2006-5-21
帖子
773
10
发表于 2008-2-26 04:07:56 | 只看该作者
我有兴趣学啊= =!ls教我吧我还很多不会呢...有意短信我{/hx}
MadniMStudio|Beside
回复 支持 反对

使用道具 举报

Lv2.观梦者

天仙

梦石
0
星屑
640
在线时间
184 小时
注册时间
2008-4-15
帖子
5023

贵宾

9
发表于 2008-2-26 04:05:25 | 只看该作者
LZ不知有无兴趣学脚本
如果有的话可以看看我的脚本是怎麽改的
和原脚本对比看看

其实这只是一个很简单的修改而已

  1. class Window_VariableWindow < Window_Base
  2. VISIBLE_ID = 1  # 可见性控制(开关ID)
  3. HP_ID = 1       # 显示HP的变量ID
  4. ATK_ID = 2      # 显示攻击的变量ID
  5. DEF_ID = 3      # 显示防御的变量ID

  6. def initialize
  7.    super(0,0,200,110)
  8.    self.opacity = 0
  9.    # 设置窗口是否可见
  10.    self.visible = $game_switches[VISIBLE_ID]
  11.    # 设置变量
  12.    @hp  = $game_variables[HP_ID]
  13.    @atk = $game_variables[ATK_ID]
  14.    @def = $game_variables[DEF_ID]
  15.    # 刷新窗口
  16.    refresh
  17. end
  18. def refresh
  19.    # 清除原内容
  20.    self.contents.clear
  21.    # 显示图标
  22.    draw_icon(137,0,0)
  23.    draw_icon(1,0,24)
  24.    draw_icon(52,0,48)
  25.    # 显示变量
  26.    self.contents.draw_text(25, 0, 40, WLH, $game_variables[HP_ID])
  27.    self.contents.draw_text(25, 24, 40, WLH, $game_variables[ATK_ID])
  28.    self.contents.draw_text(25, 48, 40, WLH, $game_variables[DEF_ID])
  29. end
  30. def update
  31.    # 更新
  32.    self.visible = $game_switches[VISIBLE_ID]
  33.    
  34.    # 更新变量
  35.    if @hp != $game_variables[HP_ID]
  36.      refresh
  37.      @hp = $game_variables[HP_ID]
  38.    end
  39.    
  40.    if @atk != $game_variables[ATK_ID]
  41.      refresh
  42.      @atk = $game_variables[ATK_ID]
  43.    end
  44.    
  45.    if @def != $game_variables[DEF_ID]
  46.      refresh
  47.      @def = $game_variables[DEF_ID]
  48.    end
  49. end
  50. end

  51. class Scene_Map < Scene_Base
  52.   # 使用alias防止冲突
  53.   alias variable_start start
  54.   alias variable_update update
  55.   alias variable_terminate terminate
  56.   def start
  57.     variable_start
  58.     # 呼叫窗口
  59.     @variableWindow = Window_VariableWindow.new
  60.   end
  61.   def update
  62.     # 更新窗口
  63.     @variableWindow.update
  64.     variable_update
  65.   end
  66.   def terminate
  67.     variable_terminate
  68.     # 解放窗口
  69.     @variableWindow.dispose
  70.   end
  71. end
复制代码
VA脚本开工中...
偷窃脚本1.0 - 已完成
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
80 小时
注册时间
2008-2-3
帖子
175
8
 楼主| 发表于 2008-2-26 04:04:07 | 只看该作者
不用了,我自己改好了,谢谢各位好意
⊙﹏⊙
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
12 小时
注册时间
2006-5-21
帖子
773
7
发表于 2008-2-26 04:00:49 | 只看该作者
参照lss的  变量先开始不要赋值为角色属性就可以了
  $game_variables[HP_ID]  = $game_actors[1].hp
   $game_variables[ATK_ID] = $game_actors[1].atk
   $game_variables[DEF_ID] = $game_actors[1].def 这个地方
MadniMStudio|Beside
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
80 小时
注册时间
2008-2-3
帖子
175
6
 楼主| 发表于 2008-2-26 03:55:18 | 只看该作者
楼上的可以实行,不过误解我的意思了。我不是用游戏里的攻击防御等,而是要用变量1 2 3 控制三者,我自己会设置。所以不要读取角色的数据。能否再改下 ?
⊙﹏⊙
回复 支持 反对

使用道具 举报

Lv2.观梦者

天仙

梦石
0
星屑
640
在线时间
184 小时
注册时间
2008-4-15
帖子
5023

贵宾

5
发表于 2008-2-26 03:45:24 | 只看该作者
  1. class Window_VariableWindow < Window_Base
  2. VISIBLE_ID = 1  # 可见性控制(开关ID)
  3. HP_ID = 1       # 显示HP的变量ID
  4. ATK_ID = 2      # 显示攻击的变量ID
  5. DEF_ID = 3      # 显示防御的变量ID

  6. def initialize
  7.    super(0,0,200,110)
  8.    self.opacity = 0
  9.    self.visible = $game_switches[VISIBLE_ID]
  10.    $game_variables[HP_ID]  = $game_actors[1].hp
  11.    $game_variables[ATK_ID] = $game_actors[1].atk
  12.    $game_variables[DEF_ID] = $game_actors[1].def
  13.    
  14.    refresh
  15. end
  16. def refresh
  17.    self.contents.clear
  18.    draw_icon(137,0,0)
  19.    self.contents.draw_text(25, 0, 40, WLH, $game_variables[HP_ID])
  20.    draw_icon(1,0,24)
  21.    self.contents.draw_text(25, 24, 40, WLH, $game_variables[ATK_ID])
  22.    draw_icon(52,0,48)
  23.    self.contents.draw_text(25, 48, 40, WLH, $game_variables[DEF_ID])
  24. end
  25. def update
  26.    self.visible = $game_switches[VISIBLE_ID]
  27.    
  28.    if $game_actors[1].hp != $game_variables[HP_ID]
  29.      refresh
  30.      $game_variables[HP_ID] = $game_actors[1].hp
  31.    end
  32.    
  33.    if $game_actors[1].atk != $game_variables[ATK_ID]
  34.      refresh
  35.      $game_variables[ATK_ID] = $game_actors[1].atk
  36.    end
  37.    
  38.    if $game_actors[1].def != $game_variables[DEF_ID]
  39.      refresh
  40.      $game_variables[DEF_ID] = $game_actors[1].def
  41.    end
  42. end
  43. end
  44. class Scene_Map < Scene_Base
  45. alias variable_start start
  46. alias variable_update update
  47. alias variable_terminate terminate
  48. def start
  49.    variable_start
  50.    @variableWindow = Window_VariableWindow.new
  51. end
  52. def update
  53.    @variableWindow.update
  54.    variable_update
  55. end
  56. def terminate
  57.    variable_terminate
  58.    @variableWindow.dispose
  59. end
  60. end
复制代码


修改完成,我不晓得原来的是谁写的,不过MS完全没用
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
VA脚本开工中...
偷窃脚本1.0 - 已完成
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
12 小时
注册时间
2006-5-21
帖子
773
4
发表于 2008-2-26 03:30:30 | 只看该作者
你意思是说变量一是你自己设定的一个数值作为血而不是游戏里角色的hp值?
系统信息:本贴获得楼主认可,66RPG感谢您的热情解答~
MadniMStudio|Beside
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
80 小时
注册时间
2008-2-3
帖子
175
3
 楼主| 发表于 2008-2-26 03:22:54 | 只看该作者
最底下说了啊
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
12 小时
注册时间
2006-5-21
帖子
773
2
发表于 2008-2-26 03:21:52 | 只看该作者
怎么改进说都没说
MadniMStudio|Beside
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-22 04:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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