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

Project1

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

[已经解决] 队员仓库脚本问题

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
12 小时
注册时间
2009-9-24
帖子
24
跳转到指定楼层
1
发表于 2009-10-9 16:12:03 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
本帖最后由 okok 于 2009-10-10 15:34 编辑

請問以下腳本如何更改右手邊的窗框大小,如下圖,使角色名和職業顯示4文字

http://rpg.blue/viewthread.php?tid=90864

Lv1.梦旅人

梦石
0
星屑
105
在线时间
0 小时
注册时间
2009-12-26
帖子
1
4
发表于 2009-12-26 20:10:13 | 只看该作者
脚本的这一行:
$data_actors = Marshal.load(file)
总是出问题啊
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
12 小时
注册时间
2009-9-24
帖子
24
3
 楼主| 发表于 2009-10-10 15:32:30 | 只看该作者
感谢楼上的帮忙:kiss:
回复 支持 反对

使用道具 举报

Lv2.观梦者

永遠神剣

梦石
0
星屑
339
在线时间
412 小时
注册时间
2009-8-16
帖子
1797

贵宾

2
发表于 2009-10-10 13:49:40 | 只看该作者
当然现在只是显示4个字.5个字的仍然有问题
  1. # 队员管理脚本(v1.1c)
  2. module RPG
  3. class Actor
  4. def setup
  5. @found = false
  6. @unavailable = false
  7. @required = false
  8. end
  9. attr_accessor :found
  10. attr_accessor :unavailable
  11. attr_accessor :required
  12. end
  13. end
  14. class Game_Actors
  15. attr_reader :data
  16. alias prex_party_g_actors_initialize initialize
  17. def initialize
  18. prex_party_g_actors_initialize
  19. $data_actors.each do |actor|
  20. actor.setup if actor
  21. @data[actor.id] = Game_Actor.new(actor.id) if actor
  22. end
  23. end
  24. end
  25. class Scene_File < Scene_Base
  26. alias prex_party_s_file_write_save_data write_save_data
  27. alias prex_party_s_file_read_save_data read_save_data
  28. def write_save_data(file)
  29. prex_party_s_file_write_save_data(file)
  30. Marshal.dump($data_actors, file)
  31. end
  32. def read_save_data(file)
  33. prex_party_s_file_read_save_data(file)
  34. $data_actors = Marshal.load(file)
  35. end
  36. end
  37. class Scene_Title < Scene_Base
  38. alias prex_party_s_title_command_new_game command_new_game
  39. def command_new_game
  40. prex_party_s_title_command_new_game
  41. $game_party.members.each {|s| s.actor.found = true if s}
  42. end
  43. end
  44. class Window_Base < Window
  45. def draw_item_name(item, x, y, enabled = true, width = 172)
  46. if item != nil
  47. draw_icon(item.icon_index, x, y, enabled)
  48. self.contents.font.color = normal_color
  49. self.contents.font.color.alpha = enabled ? 255 : 128
  50. self.contents.draw_text(x + 24, y, width, WLH, item.name)
  51. end
  52. end
  53. end
  54. class Scene_Party < Scene_Base
  55. def start
  56. super
  57. create_menu_background
  58. create_windows
  59. end
  60. def create_windows
  61. @member_window = Window_CurrentMember.new
  62. @party_window = Window_CurrentParty.new
  63. @party_window.active = true
  64. @selectable_window = Window_SelectMember.new
  65. end
  66. def update_windows
  67. @member_window.update
  68. @party_window.update
  69. @selectable_window.update
  70. if @party_window.active
  71. @member_window.set_member(@party_window.member)
  72. elsif @selectable_window.active
  73. @member_window.set_member(@selectable_window.member)
  74. end
  75. end
  76. def terminate
  77. super
  78. @member_window.dispose
  79. @party_window.dispose
  80. @selectable_window.dispose
  81. end
  82. def update
  83. super
  84. update_windows
  85. update_input
  86. end
  87. def update_input
  88. if Input.trigger?(Input::A)
  89. if @member_window.mode == 1
  90. @member_window.set_mode(0)
  91. elsif @member_window.mode == 0
  92. @member_window.set_mode(1)
  93. end
  94. end
  95. if @party_window.active
  96. if Input.trigger?(Input::B)
  97. Sound.play_cancel
  98. $scene = Scene_Map.new
  99. elsif Input.trigger?(Input::C)
  100. member = @party_window.member
  101. if member != nil
  102. if member.actor.unavailable or member.actor.required
  103. Sound.play_buzzer
  104. return
  105. end
  106. end
  107. Sound.play_decision
  108. @party_window.active = false
  109. @selectable_window.active = true
  110. @selectable_window.index = 0
  111. end
  112. elsif @selectable_window.active
  113. if Input.trigger?(Input::B)
  114. Sound.play_cancel
  115. @selectable_window.index = -1
  116. @selectable_window.active = false
  117. @party_window.active = true
  118. elsif Input.trigger?(Input::C)
  119. member = @selectable_window.member
  120. if member != nil
  121. if member.actor.unavailable
  122. Sound.play_buzzer
  123. return
  124. end
  125. end
  126. Sound.play_decision
  127. $game_party.remove_actor(@party_window.member.id) if @party_window.member != nil
  128. $game_party.add_actor(@selectable_window.member.id) if @selectable_window.member != nil
  129. @selectable_window.refresh
  130. @party_window.refresh
  131. @selectable_window.index = -1
  132. @selectable_window.active = false
  133. @party_window.active = true
  134. end
  135. end
  136. end
  137. end
  138. class Window_CurrentMember < Window_Base
  139. attr_reader :mode
  140. def initialize(member = nil, mode = 0)
  141. super(304-12, 80, 192+24, 256)
  142. create_contents
  143. @member = member
  144. @mode = 0
  145. refresh
  146. end
  147. def member
  148. return @member
  149. end
  150. def set_member(member)
  151. old_member = @member
  152. @member = member
  153. refresh if old_member != @member
  154. end
  155. def set_mode(mode)
  156. @mode = mode if [0, 1].include?(mode)
  157. refresh
  158. end
  159. def refresh
  160. self.contents.clear
  161. return unless @member
  162. x, y = 0, 0
  163. self.draw_actor_name(@member, x + 100, y)
  164. self.draw_actor_class(@member, x + 100, y + WLH)
  165. self.draw_actor_level(@member, x + 103, y + WLH*2)
  166. case @mode
  167. when 0
  168. self.draw_actor_face(@member, x, y, 96) #****
  169. self.draw_actor_hp(@member, x, y + WLH*3, 160)
  170. self.draw_actor_mp(@member, x, y + WLH*4, 160)
  171. self.draw_actor_parameter(@member, x, y + WLH*5, 0)
  172. self.draw_actor_parameter(@member, x, y + WLH*6, 1)
  173. self.draw_actor_parameter(@member, x, y + WLH*7, 2)
  174. self.draw_actor_parameter(@member, x, y + WLH*8, 3)
  175. when 1
  176. self.draw_actor_face(@member, x, y, 96) #****
  177. for i in [email protected]
  178. item = @member.equips[i]
  179. self.draw_item_name(item, x, y + WLH*(3+i), true, self.contents.width - 24)
  180. end
  181. end
  182. end
  183. end
  184. class Window_CurrentParty < Window_Selectable
  185. def initialize
  186. super(48-12, 80, 256, 64)
  187. @item_max = 4
  188. @column_max = @item_max
  189. create_contents
  190. self.index = 0
  191. refresh
  192. end
  193. def member
  194. return $game_party.members[self.index]
  195. end
  196. def refresh
  197. for i in 0...@item_max
  198. rect = item_rect(i)
  199. self.contents.clear_rect(rect)
  200. end
  201. for i in 0...$game_party.members.size
  202. rect = item_rect(i)
  203. bitmap = Cache.character($game_party.members[i].character_name)
  204. sign = $game_party.members[i].character_name[/^[\!\$]./]
  205. if sign != nil and sign.include?('$')
  206. cw = bitmap.width / 3
  207. ch = bitmap.height / 4
  208. else
  209. cw = bitmap.width / 12
  210. ch = bitmap.height / 8
  211. end
  212. n = $game_party.members[i].character_index
  213. src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
  214. if $game_party.members[i].actor.unavailable
  215. self.contents.blt(rect.x, rect.y, bitmap, src_rect, 128)
  216. else
  217. self.contents.blt(rect.x, rect.y, bitmap, src_rect, 255)
  218. end
  219. if $game_party.members[i].actor.required
  220. lock_bitmap = Cache.system("Locked")
  221. self.contents.blt(rect.x + rect.width - lock_bitmap.width,
  222. rect.y + rect.height - lock_bitmap.height,
  223. lock_bitmap, lock_bitmap.rect)
  224. end
  225. end
  226. end
  227. def item_rect(index)
  228. rect = Rect.new(0, 0, 0, 0)
  229. rect.width = (contents.width + @spacing) / @column_max - @spacing
  230. rect.height = 32
  231. rect.x = index % @column_max * (rect.width + @spacing)
  232. rect.y = index / @column_max * 32
  233. return rect
  234. end
  235. end
  236. class Window_SelectMember < Window_Selectable
  237. def initialize
  238. super(48-12, 144, 256, 192)
  239. calculate_actors
  240. @item_max = @actors.size + 1
  241. @column_max = 4
  242. self.index = -1
  243. self.active = false
  244. refresh
  245. end
  246. def calculate_actors
  247. @actors = []
  248. for a in $game_actors.data
  249. @actors << a if a != nil and a.actor.found and !$game_party.members.include?(a)
  250. end
  251. end
  252. def member
  253. return @actors[self.index]
  254. end
  255. def refresh
  256. self.contents.clear
  257. calculate_actors
  258. @item_max = @actors.size + 1
  259. for i in [email protected]
  260. rect = item_rect(i)
  261. bitmap = Cache.character(@actors[i].character_name)
  262. sign = @actors[i].character_name[/^[\!\$]./]
  263. if sign != nil and sign.include?('$')
  264. cw = bitmap.width / 3
  265. ch = bitmap.height / 4
  266. else
  267. cw = bitmap.width / 12
  268. ch = bitmap.height / 8
  269. end
  270. n = @actors[i].character_index
  271. src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
  272. if @actors[i].actor.unavailable
  273. self.contents.blt(rect.x, rect.y, bitmap, src_rect, 128)
  274. else
  275. self.contents.blt(rect.x, rect.y, bitmap, src_rect, 255)
  276. end
  277. if @actors[i].actor.required
  278. lock_bitmap = Cache.system("Locked")
  279. self.contents.blt(rect.x + rect.width - lock_bitmap.width,
  280. rect.y + rect.height - lock_bitmap.height,
  281. lock_bitmap, lock_bitmap.rect)
  282. end
  283. end
  284. end
  285. def item_rect(index)
  286. rect = Rect.new(0, 0, 0, 0)
  287. rect.width = (contents.width + @spacing) / @column_max - @spacing
  288. rect.height = 32
  289. rect.x = index % @column_max * (rect.width + @spacing)
  290. rect.y = index / @column_max * 32
  291. return rect
  292. end
  293. end
复制代码
新的UI 旧的开始
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-1-12 13:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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