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

Project1

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

[已经过期] 【脚本问题】转盘式选项的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
191
在线时间
835 小时
注册时间
2012-9-16
帖子
1811
跳转到指定楼层
1
发表于 2013-6-1 20:23:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 yangjunyin2002 于 2013-6-2 14:00 编辑

下面是个转盘脚本,就像苏联君的古遗迹探秘那游戏的战斗一样,战斗选项是转盘式的。不过这是用于640,480分辨率的脚本。我改来改去,还是没用。我的游戏分辨率是默认的544,416啊...
RUBY 代码复制
  1. module Zii
  2.   FIGHT = 132
  3.   ESCAPE = 9
  4.   ATTACK = 1
  5.   GUARD = 6
  6.   SKILL = 8
  7.   ITEM = 7
  8.   TURN = "Turn"
  9.   STATUS_FACE = "Face"
  10.   STATUS_LINE = "Line"
  11.   LINE_SIZE = 14
  12.   def self.turn_normal?
  13.     return false if TURN == "Turn on"
  14.     return true  if TURN == "Turn Off"
  15.     return true
  16.   end
  17.   def self.battle_face?
  18.     return true if STATUS_FACE == "Face"
  19.     return false
  20.   end
  21.   def self.line_name?
  22.     return true if STATUS_LINE == "Line"
  23.     return false
  24.   end
  25. end
  26. class Window_Base
  27.   def draw_face(face_name, face_index, x, y, size = 96, opacity = 255)
  28.     bitmap = Cache.face(face_name)
  29.     rect = Rect.new(0, 0, 0, 0)
  30.     rect.x = face_index % 4 * 96 + (96 - size) / 2
  31.     rect.y = face_index / 4 * 96 + (96 - size) / 2
  32.     rect.width = size
  33.     rect.height = size
  34.     self.contents.blt(x, y, bitmap, rect, opacity)
  35.     bitmap.dispose
  36.   end
  37.   def draw_actor_face(actor, x, y, size = 96, opacity = 255)
  38.     draw_face(actor.face_name, actor.face_index, x, y, size, opacity)
  39.   end
  40. end
  41. class Window_SpinCommand < Window_Base
  42.   attr_reader   :index
  43.   attr_reader   :help_window
  44.   def initialize(cx, cy, commands, setting = {})
  45.     @radius    = setting.has_key?("R") ? setting["R"] : 40
  46.     @speed     = setting.has_key?("S") ? setting["S"] : 36
  47.     @spin_back = setting.has_key?("G") ? setting["G"] : ""
  48.     @spin_line = setting.has_key?("L") ? setting["L"] : nil
  49.     x, y = cx - @radius - 28, cy - @radius - 28
  50.     height =210
  51.     width = 210
  52.     super(x, y, width, height)
  53.     self.opacity = 0
  54.     @index = 0
  55.     @commands = commands
  56.     @spin_right = true
  57.     @spin_count = 0
  58.     update_cursor
  59.   end
  60.   def draw_spin_graphic(i, cx, cy)
  61.     case command_kind(i)
  62.     when "icon"
  63.       draw_icon(command_pull(i), cx - 12, cy - 12, command_enabled?(i))
  64.     end
  65.   end
  66.   def refresh
  67.     set_spin
  68.   end
  69.   def draw_item(index, enabled = true)
  70.     @commands[index][3] = enabled
  71.     set_spin
  72.   end
  73.   def command_name(index = @index)
  74.     return "" if index < 0
  75.     name = @commands[index][0]
  76.     return name != nil ? name : ""
  77.   end
  78.   def command_kind(index)
  79.     result = @commands[index][1]
  80.     return result != nil ? result : ""
  81.   end
  82.   def command_pull(index)
  83.     result = @commands[index][2]
  84.     return result != nil ? result : ""
  85.   end
  86.   def command_enabled?(index)
  87.     result = @commands[index][3]
  88.     return result != nil ? result : true
  89.   end
  90.   def set_index(name)
  91.     n = -1
  92.     for i in [email]0...@commands.size[/email]
  93.       n = i if @commands[i][0] == name
  94.     end
  95.     @index = n if n >= 0
  96.     update_cursor
  97.     call_update_help
  98.     set_spin
  99.   end
  100.   def index=(index)
  101.     @index = index
  102.     update_cursor
  103.     call_update_help
  104.     set_spin
  105.   end
  106.   def center_x
  107.     return contents.width / 2
  108.   end
  109.   def center_y
  110.     return contents.height / 2
  111.   end
  112.   def item_max
  113.     return @commands.size
  114.   end
  115.   def set_background
  116.     return if @spin_back == ""
  117.     bitmap = Cache.system(@spin_back)
  118.     rect = Rect.new(-20, 3,544, 416)# 1210, 1250)
  119.     self.contents.blt(12, 12, bitmap, rect)
  120.   end
  121.   def set_text
  122.     return if @spin_line == nil
  123.     y = center_y - WLH / 2 + @spin_line
  124.     self.contents.draw_text(center_x - 48, y, 96, WLH, command_name, 1)
  125.   end
  126.   def angle_size
  127.     return (Math::PI * 2 / item_max)
  128.   end
  129.   def set_spin_count
  130.     @spin_count = angle_size * 360 / @speed
  131.     set_spin(true)
  132.   end
  133.   def set_spin(spin = false)
  134.     self.contents.clear
  135.     set_background
  136.     angle = spin ? @speed * @spin_count / 360 : 0
  137.     angle = @spin_right ? angle : -angle
  138.     for i in 0...item_max
  139.       n = (i - @index) * angle_size + angle
  140.       cx = @radius * Math.sin(n) + center_x
  141.       cy = - @radius * Math.cos(n) + center_y
  142.       draw_spin_graphic(i, cx, cy)
  143.     end
  144.     set_text
  145.   end
  146.   def update
  147.     super
  148.     update_cursor
  149.     if @spin_count > 0
  150.       @spin_count -= 1
  151.       set_spin(@spin_count >= 1)
  152.       return
  153.     end
  154.     update_command
  155.   end
  156.   def command_movable?
  157.     return false if @spin_count > 0
  158.     return false if (not visible or not active)
  159.     return false if (index < 0 or index > item_max or item_max == 0)
  160.     return false if (@opening or @closing)
  161.     return true
  162.   end
  163.   def command_right
  164.     @index = (@index + 1) % item_max
  165.     @spin_right = true
  166.     set_spin_count
  167.   end
  168.   def command_left
  169.     @index = (@index - 1 + item_max) % item_max
  170.     @spin_right = false
  171.     set_spin_count
  172.   end
  173.   def update_command
  174.     if command_movable?
  175.       if Input.press?(Input::RIGHT)
  176.         Sound.play_cursor
  177.         Zii.turn_normal? ? command_right : command_left
  178.       end
  179.       if Input.press?(Input::LEFT)
  180.         Sound.play_cursor
  181.         Zii.turn_normal? ? command_left : command_right
  182.       end
  183.     end
  184.     call_update_help
  185.   end
  186.   def update_cursor
  187.     if @index < 0
  188.       self.cursor_rect.empty
  189.     else
  190.       rect = Rect.new(0, 0, 24, 24)
  191.       rect.x = center_x - rect.width / 2
  192.       rect.y = center_y - rect.height / 2 - @radius
  193.       self.cursor_rect = rect
  194.       self.z = 150
  195.     end
  196.   end
  197.   def help_window=(help_window)
  198.     @help_window = help_window
  199.     call_update_help
  200.   end
  201.   def call_update_help
  202.     if self.active and @help_window != nil
  203.        update_help
  204.     end
  205.   end
  206.   def update_help
  207.   end
  208. end
  209. class Window_LineHelp < Window_Base
  210.   def initialize
  211.     super(-16, 0, 544, WLH + 32)
  212.     self.opacity = 0
  213.   end
  214.   def set_text(text, align = 0)
  215.     if text != @text or align != @align
  216.       self.contents.clear
  217.       back_color = Color.new(0, 0, 0, 80)
  218.       self.contents.fill_rect(0, y = 12, contents.width, WLH - y, back_color)
  219.       self.contents.font.color = normal_color
  220.       self.contents.draw_text(20, 0, self.width - 72, WLH, text, align)
  221.       @text = text
  222.       @align = align
  223.     end
  224.   end
  225. end
  226. class Window_ActorCommand < Window_SpinCommand
  227.   def initialize
  228.     s1 = ["攻击",      "icon", Zii::ATTACK, true]
  229.     s2 = [Vocab::skill,"icon", Zii::SKILL,  true]
  230.     s3 = ["防御",      "icon", Zii::GUARD,  true]
  231.     s4 = ["物品",      "icon", Zii::ITEM,   true]
  232.     s5 = ["逃跑",      "icon", Zii::ESCAPE, $game_troop.can_escape]
  233.     setting = {"R"=>40, "S"=>52, "G"=>"Spin40", "L"=>-12}
  234.     super(72, 356, [s1, s2, s3, s4, s5], setting)
  235.     self.active = false
  236.     set_spin
  237.   end
  238.   def setup(actor)
  239.     @commands[0][2] = Zii::ATTACK
  240.     @commands[1][0] = Vocab::skill
  241.     if actor.weapons[0] != nil
  242.       n = actor.weapons[0].icon_index
  243.       @commands[0][2] = n if n > 0
  244.     end
  245.     @commands[1][0] = actor.class.skill_name if actor.class.skill_name_valid
  246.     self.index = 0
  247.     set_spin
  248.   end
  249. end
  250. class Window_PartyCommand < Window_SpinCommand
  251.   def initialize
  252.     s1 = [Vocab::fight,  "icon", Zii::FIGHT,  true]
  253.     s2 = [Vocab::escape, "icon", Zii::ESCAPE, $game_troop.can_escape]
  254.     setting = {"R"=>40, "S"=>52, "G"=>"Spin40", "L"=>-12}
  255.     super(72, 356, [s1, s2], setting)
  256.     self.active = false
  257.     set_spin
  258.   end
  259. end
  260. class Window_BattleStatus < Window_Selectable
  261.   def initialize
  262.     super(0, 230, 544, 208)
  263.     @column_max = 1
  264.     refresh
  265.     self.active = false
  266.     self.opacity = 0
  267.   end
  268.   def draw_neomemo7_back
  269.     @neomemo7_clear = false
  270.     for index in 0...@item_max
  271.       x = index * 96
  272.       self.contents.clear_rect(x + 72, WLH * 3, 24, 24)
  273.       next unless Zii.battle_face?
  274.       actor = $game_party.members[index]
  275.       next if actor.hp <= 0
  276.       bitmap = Cache.face(actor.face_name)
  277.       rect = Rect.new(0, 0, 22, 22)
  278.       rect.x = actor.face_index % 4 * 96 + 72
  279.       rect.y = actor.face_index / 4 * 96 + 72
  280.       self.contents.blt(x + 72, WLH * 3, bitmap, rect, 192)
  281.     end
  282.   end
  283.   def draw_item(index)
  284.     x = index * 144 + 20
  285.     x2 = 20
  286.     y = 15
  287.     rect = Rect.new(x, 0, 96, 96)
  288.     self.contents.clear_rect(rect)
  289.     self.contents.font.color = normal_color
  290.     self.contents.font.size = 12
  291.     actor = $game_party.members[index]
  292.     draw_actor_state2(actor, x + 72 + 40, WLH)
  293.     x = index * 144
  294.     x3 = 25
  295.     draw_actor_hp(actor, x + x2 + x3 + 6, WLH * 2 + 63, 95)
  296.     draw_actor_mp(actor, x + x2 + x3 + 18, WLH * 3 + 52, 95)
  297.   end
  298.   def update_cursor
  299.     y = 15
  300.     if @index < 0                   # ƒJ[ƒ\ƒ‹ˆÊ’u‚ª 0 –¢–ž‚̏ꍇ
  301.       self.cursor_rect.empty        # ƒJ[ƒ\ƒ‹‚𖳌ø‚Æ‚·‚é
  302.     else                            # ƒJ[ƒ\ƒ‹ˆÊ’u‚ª 0 ˆÈã‚̏ꍇ
  303.       #rect = Rect.new(index * 161 - 12, 45, 137, 115)
  304.       #self.cursor_rect = rect
  305.     end
  306.   end
  307. end
  308. class Scene_Battle < Scene_Base
  309.   alias :neomemo13_create_info_viewport :create_info_viewport
  310.   def create_info_viewport
  311.     neomemo13_create_info_viewport
  312.     @info_viewport.rect.set(0, 0, 544, 416)
  313.     @party_command_window.x = 800
  314.     @status_window.x = 130
  315.     @status_window.y = 250
  316.     @actor_command_window.x = 440
  317.     @actor_command_window.y = 272
  318.     @message_window.x = 0
  319.     @message_window.y = 10
  320.     @message_window.opacity = 0
  321.     #Hanzo Battle Graphics Load
  322.     @message_skin = Sprite.new
  323.     @message_skin.bitmap = Cache.system("Battle_Message")
  324.     @message_skin.opacity = 0
  325.     @message_skin.x = -400
  326.   end
  327.   alias :neomemo13_update_info_viewport :update_info_viewport
  328.   def update_info_viewport
  329.     ox = @info_viewport.ox
  330.     neomemo13_update_info_viewport
  331.     @info_viewport.ox = ox
  332.     @status_window.update
  333.   end
  334.   alias :neomemo13_start_actor_command_selection :start_actor_command_selection
  335.   def start_actor_command_selection
  336.     neomemo13_start_actor_command_selection
  337.     @actor_command_window.visible = true
  338.   end
  339.   alias :neomemo13_update_actor_command_selection :update_actor_command_selection
  340.   def update_actor_command_selection
  341.     return unless @actor_command_window.command_movable?
  342.     neomemo13_update_actor_command_selection
  343.   end
  344.   alias :neomemo13_start_item_selection :start_item_selection
  345.   def start_item_selection
  346.     @help_window = Window_Help.new if @help_window == nil
  347.     @help_window.visible = true
  348.     @item_window = Window_Item.new(0, 56, 544, 232)
  349.     @item_window.z = 1000
  350.     @item_window.help_window = @help_window
  351.     @actor_command_window.active = false
  352.   end
  353. end

——旧坑欢迎戳

Lv1.梦旅人

梦石
0
星屑
191
在线时间
835 小时
注册时间
2012-9-16
帖子
1811
2
 楼主| 发表于 2013-6-4 17:48:20 | 只看该作者
都好几天了,能自顶下了吧...@protosssonny

——旧坑欢迎戳
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
54
在线时间
1208 小时
注册时间
2011-1-23
帖子
910

贵宾

3
发表于 2013-6-5 12:30:14 | 只看该作者
你这脚本哪来的?
是别人游戏里的还是站上找的?
如果是站上找的话八成是找错东西了吧
→→→牛排的小黑屋←←←
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
191
在线时间
835 小时
注册时间
2012-9-16
帖子
1811
4
 楼主| 发表于 2013-6-5 12:34:10 | 只看该作者
︶ㄣ牛排ぶ 发表于 2013-6-5 12:30
你这脚本哪来的?
是别人游戏里的还是站上找的?
如果是站上找的话八成是找错东西了吧 ...

我保证没错,我只是把脚本的注释删了。

——旧坑欢迎戳
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-7-1 20:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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