幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2547|回复: 0

[RMXP] 环形图标战斗菜单脚本怎么用啊?

[复制链接]

40

主题

190

帖子

1635

积分

⑥精研

●~  ●~   ●

积分
1635
发表于 2011-8-22 15:03:20 | 显示全部楼层 |阅读模式
一进入战斗就跳出这个出错提示:脚本 ‘环形图标战斗菜单’ 的316行发生了TypeError。cannot convert Array into String


脚本:
  1. ########################################################################
  2. #▼▲▼ XRXS_MP 6. 环形菜单 ▼▲▼ # By 和希成纳 、桜雅在土 网上搜索到的不知道对不对
  3. # 翻译者未知
  4. #▼▲▼图标战斗菜单▼▲▼ 没有翻译没有原作者署名 也是来自日本的 因为注释也是日文 不可能国人写的加上日文注释的吧
  5. #########################################################################
  6. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7. # ▽(以下为XRXS_MP 6. 环形菜单作者的感想)
  8. # 1.在脚本编辑器的Main的前一个位置进行插入操作,然后将本脚本复制到新的页里
  9. # 2.Window_RingMenu最开始的7个RPG::Cache.icon("") 的 "" 的中的图标作用在右边
  10. # 的说明里标注了分别是什么项目的,可以根据需要进行修改
  11. # (最下方禁止使用项目的图标建议使用类似“φ”的图标)
  12. # (译者按:就是原图标上多一个横杠或是斜杠的图片)
  13. ###############################################################################
  14. module Momo_IconCommand
  15. # 定义各种图标,以便之后使用
  16. ICON_ITEM = "aniu/B攻击" # 「攻击」项目的图标
  17. ICON_SKILL = "aniu/B技能" # 「特技」项目的图标
  18. ICON_EQUIP = "aniu/B防御" # 「防御」项目的图标
  19. ICON_STATUS = "aniu/B道具" # 「道具」项目的图标
  20. ICON_SAVE = "aniu/B逃跑" # 「逃跑」项目的图标
  21. #ICON_DISABLE= "" # 禁止使用项目的图标
  22. # 选择时图标的动作
  23. # 0:静止 1:放大
  24. SELECT_TYPE = 0
  25. # 闪烁时光芒的颜色
  26. FLASH_COLOR = Color.new(255, 255, 255, 128)
  27. # 闪烁时间
  28. FLASH_DURATION = 10
  29. # 闪烁间隔
  30. FLASH_INTERVAL = 20
  31. end
  32. #==============================================================================
  33. # ■ Window_RingMenu
  34. #------------------------------------------------------------------------------
  35. #  显示环形菜单画面
  36. #==============================================================================
  37. class Window_RingMenu < Window_Base
  38. #--------------------------------------------------------------------------
  39. # ○ 类常量定义
  40. # 这里定义的变量是整个Window_RingMenu类都可以用的常量
  41. # 所有变量名都是用大写,以区别其他变量
  42. #--------------------------------------------------------------------------
  43. # 打开菜单使用的帧数,数字越小打开菜单时速度越快
  44. STARTUP_FRAMES = 12
  45. # 切换选项时使用的帧数,数字越小切换选项速度越快
  46. MOVING_FRAMES = 10
  47. # 环的半径(单位:象素),数字越大环越大←本句为废话
  48. RING_R = 50
  49. # 定义各种状态时的赋值。
  50. # 译注:对于程序而言,个人感觉多此一举…不过的确方便了阅读
  51. MODE_START = 1 # 动画开始时
  52. MODE_WAIT = 2 # 待机中
  53. MODE_MOVER = 3 # 顺时针旋转(往右)
  54. MODE_MOVEL = 4 # 逆时针旋转(往左)
  55. MODE_MOVEZ = 5 # 还原第一个图标
  56. # X坐标修正
  57. X_PLUS = 60
  58. # Y坐标修正
  59. Y_PLUS = 0#100
  60. # 是否写出文字的名称
  61. COM_NAME_DROW = true
  62. # 文字内容
  63. ATTACK_NAME = "攻击" # 攻击
  64. SKILL_NAME = "异能" # 特技
  65. GUARD_NAME = "防御" # 防御
  66. ITEM_NAME = "背包" # 物品
  67. ESCAPE_NAME = "逃跑" # 逃跑
  68. # 文字颜色
  69. COM_NAME_COLOR = Color.new(255, 255, 255, 255)
  70. #--------------------------------------------------------------------------
  71. # ○ 定义实例变量
  72. #--------------------------------------------------------------------------
  73. attr_accessor :index
  74. #--------------------------------------------------------------------------
  75. # ● 初始化对象
  76. #--------------------------------------------------------------------------
  77. def initialize( center_x, center_y , move_flag,cms)
  78. super(0, 0, 640, 480)
  79. self.contents = Bitmap.new(width-32, height-32)
  80. self.opacity = 0
  81. self.back_opacity = 0
  82. s1 = ATTACK_NAME
  83. s2 = SKILL_NAME
  84. s3 = GUARD_NAME
  85. s4 = ITEM_NAME
  86. s5 = ESCAPE_NAME
  87. @commands = [ s1, s2, s3, s4, s5]
  88. @item_max = 5
  89. @index = 0
  90. @items = cms#[ ICON_ITEM, ICON_SKILL, ICON_EQUIP, ICON_STATUS, ICON_SAVE]
  91. @disabled = [ false, false, false, false, false, false ]
  92. @cx = center_x
  93. @cy = center_y
  94. @sprite = []
  95. for i in 0...@item_max
  96. @sprite = Sprite_Icon.new(nil,@items)
  97. end
  98. @xxiu = X_PLUS
  99. @yxiu = Y_PLUS
  100. # 初始化动画
  101. setup_move_start(move_flag)
  102. @old_mode = 0
  103. # 刷新
  104. refresh
  105. end
  106. #追加释放功能
  107. def dispose
  108. for sprite in @sprite
  109. sprite.dispose unless sprite.nil?
  110. end
  111. super
  112. end
  113. #--------------------------------------------------------------------------
  114. # ● 刷新画面
  115. #--------------------------------------------------------------------------
  116. def update
  117. super
  118. if @old_mode != @mode
  119. refresh
  120. end
  121. icon_update
  122. end
  123. def icon_update
  124. for i in 0...@sprite.size
  125. # if animation? #判断是否动画中
  126. # @sprite.active = false
  127. # else
  128. # @sprite.active = true
  129. # end
  130. @sprite.active = (self.index == i)
  131. @sprite.z = (self.index == i) ? self.z + 2 : self.z + 1
  132. @sprite.visible = self.visible
  133. @sprite.update
  134. end
  135. end
  136. #--------------------------------------------------------------------------
  137. # ● 画面描绘(刷新)
  138. #--------------------------------------------------------------------------
  139. def refresh
  140. self.contents.clear
  141. # 选择描绘方式
  142. case @mode
  143. when MODE_START
  144. refresh_start
  145. when MODE_WAIT
  146. refresh_wait
  147. @old_mode = @mode
  148. refresh_wait
  149. when MODE_MOVER
  150. refresh_move(1)
  151. when MODE_MOVEL
  152. refresh_move(0)
  153. end
  154. # 指令名描绘
  155. rect = Rect.new(@cx - 325 +X_PLUS, @cy-153+Y_PLUS, self.contents.width-32, 32)
  156. self.contents.font.color = COM_NAME_COLOR
  157. self.contents.draw_text(rect, @commands[@index],1) if COM_NAME_DROW
  158. end
  159. #--------------------------------------------------------------------------
  160. # ○ 画面生成
  161. #--------------------------------------------------------------------------
  162. def refresh_start
  163. d1 = 2.0 * Math::PI / @item_max
  164. d2 = 1.0 * Math::PI / STARTUP_FRAMES
  165. r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES
  166. for i in 0...@item_max
  167. j = i - @index
  168. d = d1 * j + d2 * @steps
  169. x = @cx + ( r * Math.sin( d ) ).to_i
  170. y = @cy - ( r * Math.cos( d ) ).to_i
  171. # draw_item(x, y, i)
  172. @sprite.x = x+@xxiu
  173. @sprite.y = y+@yxiu
  174. end
  175. @steps -= 1
  176. if @steps < 0
  177. @mode = MODE_WAIT
  178. end
  179. end
  180. #--------------------------------------------------------------------------
  181. # ○ 画面再描绘(待机时)
  182. #--------------------------------------------------------------------------
  183. def refresh_wait
  184. d = 2.0 * Math::PI / @item_max
  185. for i in 0...@item_max
  186. j = i - @index
  187. x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
  188. y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
  189. # draw_item(x, y, i)
  190. @sprite.x = x+@xxiu
  191. @sprite.y = y+@yxiu
  192. end
  193. end
  194. #--------------------------------------------------------------------------
  195. # ○ 画面再描绘(旋转时)
  196. # mode : 旋转方向(0 : 逆时针旋转时,1 : 顺时针旋转时)
  197. #--------------------------------------------------------------------------
  198. def refresh_move( mode )
  199. d1 = 2.0 * Math::PI / @item_max
  200. d2 = d1 / MOVING_FRAMES
  201. d2 *= -1 if mode != 0
  202. for i in 0...@item_max
  203. # 以下便是那华丽的曲线公式
  204. j = i - @index
  205. d = d1 * j + d2 * @steps
  206. x = @cx + ( RING_R * Math.sin( d ) ).to_i
  207. y = @cy - ( RING_R * Math.cos( d ) ).to_i
  208. # draw_item(x, y, i)
  209. @sprite.x = x+@xxiu
  210. @sprite.y = y+@yxiu
  211. end
  212. @steps -= 1
  213. if @steps < 0
  214. @mode = MODE_WAIT
  215. end
  216. end
  217. #--------------------------------------------------------------------------
  218. # ● 描绘图片
  219. # i : 项目编号
  220. #--------------------------------------------------------------------------
  221. def draw_item(x, y, i)
  222. rect = Rect.new(0, 0, @items.width, @items.height)
  223. if @index == i
  224. self.contents.blt( x, y, @items, rect )
  225. if @disabled[@index]
  226. self.contents.blt( x, y, ICON_DISABLE, rect )
  227. end
  228. else
  229. self.contents.blt( x, y, @items, rect, 220 )
  230. if @disabled[@index]
  231. self.contents.blt( x, y, ICON_DISABLE, rect, 220 )
  232. end
  233. end
  234. end
  235. #--------------------------------------------------------------------------
  236. # ● 项目无效化
  237. # index : 项目编号
  238. #--------------------------------------------------------------------------
  239. def disable_item(index)
  240. for i in 0...@sprite.size
  241. @sprite.dispose if @sprite != nil
  242. end
  243. @disabled[index] = true
  244. end
  245. #--------------------------------------------------------------------------
  246. # ○ 初始化动画准备
  247. #--------------------------------------------------------------------------
  248. def setup_move_start(move_flag,kg = false)
  249. @mode = move_flag ? MODE_START : 1
  250. @steps = move_flag ? STARTUP_FRAMES : 1
  251. end
  252. #--------------------------------------------------------------------------
  253. # ○ 回转动画准备
  254. #--------------------------------------------------------------------------
  255. def setup_move_move(mode)
  256. if mode == MODE_MOVER
  257. @index -= 1
  258. @index = @items.size - 1 if @index < 0
  259. elsif mode == MODE_MOVEL
  260. @index += 1
  261. @index = 0 if @index >= @items.size
  262. else
  263. return
  264. end
  265. @mode = mode
  266. @steps = MOVING_FRAMES
  267. end
  268. #--------------------------------------------------------------------------
  269. # ○ 还原动画准备
  270. #--------------------------------------------------------------------------
  271. def setup_move_huan(mode)
  272. if mode == MODE_MOVEL
  273. @index = 0
  274. @mode = mode
  275. @steps = MOVING_FRAMES
  276. end
  277. end
  278. #--------------------------------------------------------------------------
  279. # ○ 判断是否在动画中
  280. #--------------------------------------------------------------------------
  281. def animation?
  282. return @mode != MODE_WAIT
  283. end
  284. end
  285. ##############################################
  286. # アイコン用スプライト
  287. class Sprite_Icon < Sprite
  288. attr_accessor :active
  289. attr_accessor :icon_name
  290. #------------------------------------------------------------------------
  291. # ● オブジェクト初期化
  292. #------------------------------------------------------------------------
  293. def initialize(viewport, icon_name)
  294. super(viewport)
  295. @icon_name = icon_name
  296. @count = 0
  297. self.bitmap = RPG::Cache.icon(@icon_name)
  298. self.ox = self.bitmap.width / 2
  299. self.oy = self.bitmap.height / 2
  300. @active = false
  301. end
  302. #------------------------------------------------------------------------
  303. # ● 解放
  304. #------------------------------------------------------------------------
  305. def dispose
  306. if self.bitmap != nil
  307. self.bitmap.dispose
  308. end
  309. super
  310. end
  311. #------------------------------------------------------------------------
  312. # ● フレーム更新
  313. #------------------------------------------------------------------------
  314. def update
  315. super
  316. if @active
  317. @count += 1
  318. case Momo_IconCommand::SELECT_TYPE
  319. when 0
  320. icon_flash
  321. when 1
  322. icon_zoom
  323. end
  324. @count = 0 if @count == 20
  325. else
  326. icon_reset
  327. end
  328. end
  329. def icon_flash
  330. if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 1
  331. self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
  332. end
  333. end
  334. def icon_zoom
  335. case @count
  336. when 1..10
  337. zoom = 1.0 + @count / 10.0
  338. when 11..20
  339. zoom = 2.0 - (@count - 10) / 10.0
  340. end
  341. self.zoom_x = zoom
  342. self.zoom_y = zoom
  343. end
  344. def icon_reset
  345. @count = 0
  346. self.zoom_x = 1.0
  347. self.zoom_y = 1.0
  348. end
  349. end
  350. #############################################
  351. class Scene_Battle
  352. #------------------------------------------------------------------------
  353. # ● プレバトルフェーズ開始
  354. #------------------------------------------------------------------------
  355. alias :orzfoxzu_update_phase3_basic_command :update_phase3_basic_command
  356. def update_phase3_basic_command
  357. # 按下 B 键的情况下
  358. if Input.trigger?(Input::B)
  359. # 转向前一个角色的指令输入
  360. phase3_prior_actor
  361. @actor_command_window.refresh
  362. return
  363. end
  364. ###############
  365. # 动画中不能执行光标处理
  366. # 这句的意思就是如果正处于动画中就return,这样下面的语句就不会执行了
  367. # 换言之,如果正处于动画处理中,那么就无法移动菜单
  368. return if @actor_command_window.animation?
  369. ###############
  370. # 按下 ↑ 或 ← 键的情况下 #改成相反的
  371. # if Input.press?(Input::UP) or Input.press?(Input::LEFT)
  372. if Input.press?(Input::DOWN) or Input.press?(Input::RIGHT)
  373. # 演奏光标 SE
  374. $game_system.se_play($data_system.cursor_se)
  375. # 向左旋转
  376. @actor_command_window.setup_move_move(Window_RingMenu::MODE_MOVEL)
  377. return
  378. end
  379. # 按下 ↓ 或 → 键的情况下 #改成相反的
  380. # if Input.press?(Input::DOWN) or Input.press?(Input::RIGHT)
  381. if Input.press?(Input::UP) or Input.press?(Input::LEFT)
  382. # 演奏光标 SE
  383. $game_system.se_play($data_system.cursor_se)
  384. # 向右旋转
  385. @actor_command_window.setup_move_move(Window_RingMenu::MODE_MOVER)
  386. return
  387. end
  388. ##################
  389. orzfoxzu_update_phase3_basic_command
  390. end
  391. alias scene_battle_icon_command_start_phase1 start_phase1
  392. def start_phase1
  393. #指定图标的图片
  394. com1 = Momo_IconCommand::ICON_ITEM
  395. com2 = Momo_IconCommand::ICON_SKILL
  396. com3 = Momo_IconCommand::ICON_EQUIP
  397. com4 = Momo_IconCommand::ICON_STATUS
  398. com5 = Momo_IconCommand::ICON_SAVE
  399. #赋予圆心的位置和初试开关
  400. @flag = true
  401. px = 220
  402. py = 240
  403. @actor_command_window = Window_RingMenu.new(px,py,@flag,[com1, com2, com3, com4, com5])
  404. @actor_command_window.active = false
  405. @actor_command_window.visible = false
  406. @actor_command_window.update
  407. scene_battle_icon_command_start_phase1
  408. end
  409. #------------------------------------------------------------------------
  410. # ● アクターコマンドウィンドウのセットアップ
  411. #------------------------------------------------------------------------
  412. alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
  413. def phase3_setup_command_window
  414. scene_battle_icon_command_phase3_setup_command_window
  415. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  416. # 设置角色指令窗口的位置
  417. @actor_command_window.setup_move_start(0,true)
  418. @actor_command_window.refresh
  419. # @actor_command_window.x = @actor_index * 160
  420. @actor_command_window.x = 20#280#@active_battler.screen_x - 10#320#
  421. @actor_command_window.y = 120#0#@active_battler.screen_y - 140#120#
  422. @actor_command_window.z = 50#@active_battler.screen_z - 1
  423. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  424. end
  425. end
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2024-4-19 02:15 , Processed in 0.021085 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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