赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 2372 |
最后登录 | 2013-9-13 |
在线时间 | 130 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 130 小时
- 注册时间
- 2009-1-20
- 帖子
- 100
|
这个仓库脚本明明是说可以用的 怎么出现错误呢
?谁帮帮忙 具体点谢谢01.#==============================================================================
02.# 本脚本来自www.66RPG.com,使用和转载请保留此信息
03.#==============================================================================
04.
05.#==============================================================================
06.# ■ chaochao的人物仓库ver1.02正式版
07.# 修改了Game_Party
08.# 功能:
09.# 用来存放角色的仓库……
10.# 召唤画面用$scene = Chaochao_Scene_Party.new
11.# 其它使用说明在代码里已经备注。
12.#------------------------------------------------------------------------------
13.# 作者:chaochao
14.# http://zhuchao.go1.icpcn.com
15.#==============================================================================
16.class Chaochao_Window_PartyLeft < Window_Selectable
17. def initialize
18.
19. super(0, 0, 320, 224)
20. self.contents = Bitmap.new(width - 32, height - 32)
21. self.index = 0
22.
23. refresh
24. end
25. def actor
26. return @actors[self.index]
27. end
28. def refresh
29. if self.contents != nil
30. self.contents.dispose
31. self.contents = nil
32. end
33. @actors = []
34. for i in 0...$game_party.actors.size
35. @actors.push($game_party.actors)
36. end
37. @item_max = 4
38. if @item_max > 0
39. self.contents = Bitmap.new(width - 32, (row_max+1) * 32)
40. for i in 0...@item_max
41. draw_item(i)
42. end
43. end
44. end
45. def draw_item(index)
46. if @actors[index] != nil
47. actor = @actors[index]
48. text = @actors[index].name
49. lv = @actors[index].level.to_s + " "
50. if $game_party.chaochao.include?(actor.id) or $game_party.actors.size <= 1
51. self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
52. else
53. self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
54. end
55. self.contents.draw_text(4, index * 32 + 32, 288, 32, text)
56. self.contents.font.color = normal_color
57. self.contents.font.size = 16
58. self.contents.draw_text(4, index * 32 + 36, 288, 32, "Lv: ", 2)
59. colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
60. colory = [255.0000 / 60 * @actors[index].level,255].min
61. self.contents.font.color = Color.new(colorx, colory, 0)
62. self.contents.draw_text(4, index * 32 + 36, 288, 32, lv, 2)
63. self.contents.font.color = normal_color
64. self.contents.font.size = 22
65. else
66. self.contents.draw_text(4, index * 32 + 32, 288, 32, "----------")
67. end
68. end
69. def update_cursor_rect
70. if @index < 0
71. self.cursor_rect.empty
72. return
73. end
74. row = @index / @column_max
75. if row < self.top_row
76. self.top_row = row
77. end
78. if row > self.top_row + (self.page_row_max - 1)
79. self.top_row = row - (self.page_row_max - 1)
80. end
81. cursor_width = self.width / @column_max - 32
82. x = @index % @column_max * (cursor_width + 32)
83. y = @index / @column_max * 32 - self.oy + 32
84. self.cursor_rect.set(x, y, cursor_width, 32)
85. end
86. def item_max
87. return @item_max
88. end
89. def actor?(index)
90. return @actors[index] == nil ? false : true
91. end
92. def set_index(x)
93. @index = x
94. end
95.end
96.
97.#------------------------------------------------------------------------------
98.
99.class Chaochao_Window_PartyRight < Window_Selectable
100. def initialize
101. super(320, 0, 320, 224)
102. self.contents = Bitmap.new(width - 32, height - 32)
103. self.index = -1
104. self.opacity = 160
105. refresh
106. end
107. def actor
108. return @actors[self.index]
109. end
110. def refresh
111. if self.contents != nil
112. self.contents.dispose
113. self.contents = nil
114. end
115. @actors = []
116. for i in 0...$game_party.actors2.size
117. @actors.push($game_party.actors2)
118. end
119.
120. @item_max = $game_party.actors2.size
121. if @item_max > 0
122. self.contents = Bitmap.new(width - 32, row_max * 32)
123. for i in 0...@item_max
124. draw_item(i)
125. end
126. elsif @item_max == 0
127.
128. end
129. end
130. def draw_item(index)
131. actor = @actors[index]
132. text = @actors[index].name
133. lv = @actors[index].level.to_s + " "
134. if $game_party.chaochao2.include?(actor.id) or $game_party.actors.size >= 4
135. self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
136. else
137. self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
138. end
139. self.contents.draw_text(4, index * 32, 288, 32, text)
140. self.contents.font.color = normal_color
141. self.contents.font.size = 16
142. self.contents.draw_text(4, index * 32 + 4, 288, 32, "Lv: ", 2)
143. colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
144. colory = [255.0000 / 60 * @actors[index].level,255].min
145. self.contents.font.color = Color.new(colorx, colory, 0)
146. self.contents.draw_text(4, index * 32 + 4, 288, 32, lv, 2)
147. self.contents.font.color = normal_color
148. self.contents.font.size = 22
149. end
150. def update_cursor_rect
151. if @index < 0
152. self.cursor_rect.empty
153. return
154. end
155. row = @index / @column_max
156. if row < self.top_row
157. self.top_row = row
158. end
159. if row > self.top_row + (self.page_row_max - 1)
160. self.top_row = row - (self.page_row_max - 1)
161. end
162. cursor_width = self.width / @column_max - 32
163. x = @index % @column_max * (cursor_width + 32)
164. y = @index / @column_max * 32 - self.oy
165. self.cursor_rect.set(x, y, cursor_width, 32)
166. end
167. def item_max
168. return @item_max
169. end
170. def actor?(index)
171. return @actors[index] == nil ? false : true
172. end
173. def set_index(x)
174. @index = x
175. end
176.end
177.
178.#------------------------------------------------------------------------------
179.
180.class Chaochao_Window_PartyData < Window_Base
181.
182. def initialize
183. super(0, 224, 640, 256)
184. self.contents = Bitmap.new(width - 32, height - 32)
185. @actor = nil
186. end
187.
188. def set_actor(actor)
189. self.contents.clear
190. draw_actor_name(actor, 4, 0)
191. draw_actor_state(actor, 140, 0)
192. draw_actor_hp(actor, 284, 0)
193. draw_actor_sp(actor, 460, 0)
194. @actor = actor
195. draw_actor_graphic(@actor, 40, 112)
196. draw_actor_class(@actor, 20, 124)
197. draw_actor_parameter(@actor, 100, 50, 0)
198. draw_actor_parameter(@actor, 100, 85, 1)
199. draw_actor_parameter(@actor, 100, 120, 2)
200. draw_actor_parameter(@actor, 350, 50, 3)
201. draw_actor_parameter(@actor, 350, 85, 4)
202. draw_actor_parameter(@actor, 350, 120, 5)
203. draw_actor_parameter(@actor, 350, 155, 6)
204. self.visible = true
205. end
206. def clear
207. self.contents.clear
208. end
209.end
210.
211.#------------------------------------------------------------------------------
212.
213.class Game_Party
214. attr_reader :actors2
215. attr_reader :chaochao#不能从队伍向备用角色移动的角色ID
216. attr_reader :chaochao2#不能从备用角色向队伍移动的角色ID
217. def initialize
218. @actors = []
219. @gold = 0
220. @steps = 0
221. @items = {}
222. @weapons = {}
223. @armors = {}
224. @actors2 = []
225. @chaochao = [1]
226. @chaochao2 = []
227. end
228. def add_actor(actor_id,type=1)#type为1是向队伍中添加,为2则相反。
229. case type
230. when 1
231. if $game_actors[actor_id] != nil
232. actor = $game_actors[actor_id]
233. #如果队伍没有满和队伍中没有此角色
234. if @actors.size < 4 and not @actors.include?(actor) and not @actors2.include?(actor)
235. @actors.push(actor)
236. $game_player.refresh
237. end
238. end
239. when 2
240. if $game_actors[actor_id] != nil
241. actor = $game_actors[actor_id]
242. #如果角色不在队伍中和不在备用角色队伍中的情况下
243. #向备用角色中添加角色
244. if not @actors.include?(actor) and not @actors2.include?(actor)
245. @actors2.push(actor)
246. $game_player.refresh
247. end
248. end
249. end
250. end
251.
252. def huanren(index,type=1)#type为1是从备用角色向队伍中移动,为2则相反。
253. actor = $game_actors[index]
254. case type
255. when 1
256. if @actors.size < 4 and @actors2.include?(actor) and not @chaochao2.include?(index) and not @actors.include?(actor)
257. @actors.push(actor)
258. @actors2.delete(actor)
259. $game_system.se_play($data_system.decision_se)
260. $game_player.refresh
261. end
262. when 2
263. if @actors.include?(actor) and not @chaochao.include?(index) and not @actors2.include?(actor)
264. @actors2.push(actor)
265. @actors.delete(actor)
266. $game_system.se_play($data_system.decision_se)
267. $game_player.refresh
268. end
269. end
270. end
271.
272. #type1,1是操作队伍中的角色能否向备用队伍移动,2则相反。
273. #type2,1是添加不能移动的,2是删除不能移动的。
274. def yidong(actor_id,type1,type2=1)
275. case type2
276. when 1
277. case type1
278. when 1
279. @chaochao.push(actor_id)
280. when 2
281. @chaochao2.push(actor_id)
282. end
283. when 2
284. case type1
285. when 1
286. @chaochao.delete(actor_id)
287. when 2
288. @chaochao2.delete(actor_id)
289. end
290. end
291. end
292.
293. #type,1从队伍中离开,2从备用角色中离开,3从队伍和备用角色中离开。
294. def remove_actor(actor_id,type=1)
295. actor = $game_actors[actor_id]
296. case type
297. when 1
298. @actors.delete(actor)
299. $game_player.refresh
300. when 2
301. @actors2.delete(actor)
302. $game_player.refresh
303. when 3
304. @actors.delete(actor)
305. @actors2.delete(actor)
306. $game_player.refresh
307. end
308. end
309.
310. def refresh
311. new_actors = []
312. new_actors2 = []
313. for i in [email protected]
314. if $data_actors[@actors.id] != nil
315. new_actors.push($game_actors[@actors.id])
316. end
317. end
318. @actors = new_actors
319. for i in [email protected]
320. if $data_actors[@actors2.id] != nil
321. new_actors2.push($game_actors[@actors2.id])
322. end
323. end
324. @actors2 = new_actors2
325. end
326.end
327.
328.#------------------------------------------------------------------------------
329.
330.class Chaochao_Scene_Party
331. def main
332. @left_temp_command = 0
333. @right_temp_command = 0
334. @temp = 0
335. @left_window = Chaochao_Window_PartyLeft.new
336. @left_window.active = true
337. @right_window = Chaochao_Window_PartyRight.new
338. @right_window.active = false
339. @data_window = Chaochao_Window_PartyData.new
340. update_data
341. Graphics.transition
342. loop do
343. Graphics.update
344. Input.update
345. update
346. if $scene != self
347. break
348. end
349. end
350. Graphics.freeze
351. @left_window.dispose
352. @right_window.dispose
353. @data_window.dispose
354. end
355.
356. def update
357. @left_window.update
358. @right_window.update
359. @data_window.update
360. update_command
361. update_data
362. end
363.
364. def update_command
365. if Input.trigger?(Input::B)
366. $game_system.se_play($data_system.cancel_se)
367. #画面切换
368. $scene = Scene_Map.new
369. return
370. end
371. if @left_window.active
372. update_left
373. return
374. end
375. if @right_window.active
376. update_right
377. return
378. end
379. end
380.
381. def update_left
382. if Input.trigger?(Input::RIGHT)
383. if @right_window.item_max > 0
384. @left_temp_command = @left_window.index
385. @left_window.set_index(-1)
386. $game_system.se_play($data_system.cursor_se)
387. @left_window.active = false
388. @right_window.active = true
389. @left_window.refresh
390. @right_window.refresh
391. @right_window.set_index(@right_temp_command)
392. return
393. else
394. $game_system.se_play($data_system.buzzer_se)
395. return
396. end
397. end
398. if Input.trigger?(Input::C)
399. if @left_window.active and @left_window.actor?(@left_window.index) and $game_party.actors.size > 1 and not $game_party.chaochao.include?($game_party.actors[@left_window.index].id)
400. $game_party.huanren($game_party.actors[@left_window.index].id,2)#type为1是从备用角色向队伍中移动,为2则相反。
401. @left_window.refresh
402. @right_window.refresh
403. else
404. $game_system.se_play($data_system.buzzer_se)
405. end
406. end
407. return
408. end
409.
410. def update_right
411. if Input.trigger?(Input::LEFT)
412. if @left_window.item_max > 0
413. @right_temp_command = @right_window.index
414. @right_window.set_index(-1)
415. $game_system.se_play($data_system.cursor_se)
416. @left_window.active = true
417. @right_window.active = false
418. @left_window.refresh
419. @right_window.refresh
420. @left_window.set_index(@left_temp_command)
421. return
422. else
423. $game_system.se_play($data_system.buzzer_se)
424. return
425. end
426. end
427. if Input.trigger?(Input::C)
428. if $game_party.actors.size >= 4
429. $game_system.se_play($data_system.buzzer_se)
430. return
431. end
432. if @right_window.active and @right_window.actor?(@right_window.index) and not $game_party.chaochao2.include?($game_party.actors2[@right_window.index].id)
433. $game_party.huanren($game_party.actors2[@right_window.index].id,1)#type为1是从备用角色向队伍中移动,为2则相反。
434. if $game_party.actors2.size == 0
435. @right_temp_command = @right_window.index
436. @right_window.set_index(-1)
437. $game_system.se_play($data_system.cursor_se)
438. @left_window.active = true
439. @right_window.active = false
440. @left_window.refresh
441. @right_window.refresh
442. @left_window.set_index(@left_temp_command)
443. end
444. if @right_window.index > 0
445. @right_window.set_index(@right_window.index-1)
446. end
447. @left_window.refresh
448. @right_window.refresh
449. else
450. $game_system.se_play($data_system.buzzer_se)
451. end
452. end
453. return
454. end
455.
456. def update_data
457. if @left_window.active
458. if $game_party.actors[@left_window.index] != nil
459. @data_window.set_actor($game_party.actors[@left_window.index])
460. else
461. @data_window.clear
462. end
463. return
464. end
465. if @right_window.active
466. if $game_party.actors2[@right_window.index] != nil
467. @data_window.set_actor($game_party.actors2[@right_window.index])
468. else
469. @data_window.clear
470. end
471. return
472. end
473. end
474.end
475.
476.#==============================================================================
477.# 本脚本来自www.66RPG.com,使用和转载请保留此信息
478.#============================================================================== |
|