Project1

标题: 请问如何选择游戏内选项窗口的显示方式 [打印本页]

作者: R9560    时间: 2014-7-29 12:14
标题: 请问如何选择游戏内选项窗口的显示方式
本帖最后由 R9560 于 2014-7-29 12:17 编辑

最近把一个叫「你不是勇者2-尼鲁斯的工作」的游戏打通了,花了四个多小时,作为范例纯事件游戏,对于VA新手有很大帮助

这游戏细节做的不错,里面有一个传送道具,打开之后选项有很多,而且窗口在上面

请问这个选项窗口怎么做到的,我的事件菜单目录只有普通的那种啊


QQ截图20140729120908.png (218.69 KB, 下载次数: 57)

这种

这种

QQ截图20140729121003.png (137.54 KB, 下载次数: 57)

我只能用这种窗口

我只能用这种窗口

作者: 喵呜喵5    时间: 2014-7-29 12:16
本帖最后由 喵呜喵5 于 2014-7-29 12:18 编辑

选择贵重物品


作者: R9560    时间: 2014-7-29 12:21
喵呜喵5 发表于 2014-7-29 12:16
选择贵重物品

选择贵重物品这个框确实是这样,可是不明白的是我明明没有那些地名的贵重品,为啥可以选择

求解释这个传送选择事件具体是怎么设置的
作者: 黑化の鼠标    时间: 2014-7-29 12:27
目测是在使用那个传送道具之后先增减道具之后再进行的物品选择处理,选择完之后再把所有对应道具删除就好。
作者: R9560    时间: 2014-7-29 12:37
黑化の鼠标 发表于 2014-7-29 12:27
目测是在使用那个传送道具之后先增减道具之后再进行的物品选择处理,选择完之后再把所有对应道具 ...

你的是意思是 用这个贵重道具之后,先把所有手头贵重道具减没,然后在加入这八个地名的贵重道具,然后用完之后,在把这八个地名道具删除,然后在复原之前手里有的贵重道具吧

这样的话,我有一点不太明白,就是如何复原之前手头里有的贵重道具
作者: 1561496327    时间: 2014-7-29 12:57
本帖最后由 1561496327 于 2014-7-29 13:03 编辑

这里有脚本的,用了最好在游戏加来源,有使用范例的哦
进不去话这里有脚本的(这个我动改了一下),话说不可能进不去的,使用方法呃......不要和我说你看不懂(看不懂用谷歌)
  1. #------------------------------------------------------------------------------#
  2. #  Galv's Use Item on Event
  3. #------------------------------------------------------------------------------#
  4. #  For: RPGMAKER VX ACE
  5. #  Version 1.5
  6. #------------------------------------------------------------------------------#
  7. #  2013-01-10 - version 1.5 - added a hopeful fix for strange issue
  8. #  2012-12-13 - version 1.4 - added ability to set what happens when item is
  9. #                             used on nothing (or an event with no <key> tag).
  10. #                           - added a check for just category
  11. #  2012-12-07 - version 1.3 - bug where sometimes item doesn't register
  12. #  2012-12-07 - version 1.2 - fix indexing bug when changing categories
  13. #  2012-12-07 - version 1.1 - fixed bug when only using 1 category
  14. #  2012-12-07 - version 1.0 - release
  15. #------------------------------------------------------------------------------#
  16. #  This script allows you to bring up the "Use Key Item" box on the press of a
  17. #  button. When you select an item, it then activates the event directly in
  18. #  front of the player.
  19. #  Using EVENTING knowledge, you can set up conditional branches that contain
  20. #  'script' condition to tell the event what to do when the item the player
  21. #  selected was used on that event.
  22. #------------------------------------------------------------------------------#
  23. #  SCRIPTS for CONDITIONAL BRANCHES
  24. #------------------------------------------------------------------------------#
  25. #
  26. #  use_key?            # Returns true if you activated the event using an item.
  27. #
  28. #  key?(:category,item_id)    # Checks if that item was used.
  29. #                             # :category can be any from CATEGORIES below.
  30. #                             # item_id is the ID of the item from that category
  31. #
  32. #  keyc?(:category)           # Check if any item from that category was used
  33. #
  34. #------------------------------------------------------------------------------#
  35. #  SCRIPT call for ENDING an item-initiated event (IMPORTANT)
  36. #------------------------------------------------------------------------------#
  37. #
  38. #  end_key      # Use this instead of "Exit Event Processing" event command in
  39. #               # your item activated events to clear the item ID if you want
  40. #               # to end the event early like in the demo examples.
  41. #
  42. #------------------------------------------------------------------------------#
  43. #  COMMENT TAG FOR EVENTS
  44. #------------------------------------------------------------------------------#
  45. #
  46. #  <key>
  47. #
  48. #  Place a COMMENT in the event page with only this tag in it. Make sure the
  49. #  comment is BELOW all conditional branches checking for item used on the event
  50. #
  51. #  Any event that has this comment will be activated when using an item on it
  52. #  (just like if you used the action key). Any event without this tag will not
  53. #  be activated at all and will revert to the common event id (selected below).
  54. #
  55. #------------------------------------------------------------------------------#

  56. ($imported ||= {})["Galvs_Use_Item_on_Event"] = true
  57. module Galv_Key
  58.    
  59. #------------------------------------------------------------------------------#
  60. #  SCRIPT SETTINGS
  61. #------------------------------------------------------------------------------#  

  62.   DISABLE_SWITCH = 16
  63.    
  64.   BUTTON = :Y       # Button to call Key Item window (:X is "a")
  65.    
  66.   VARIABLE = 1      # Stores item ID in this variable to use in conditions
  67.    
  68.   NO_TARGET = 0     # Common event ID. This is called when the player uses an
  69.                     # item on nothing and can be used to set what happens for
  70.                     # each item/category in this event.
  71.                     # IMPORTANT: Set to 0 if not used. Common event MUST have
  72.                     # the key_end script call at the end of the event and end
  73.                     # of any branch as normal.
  74.    
  75.   CATEGORIES = [                 # Categories of items that can be used on an
  76.                                  # event. Cycle through these categories with
  77.     [:key_item, "贵重物品"],    # Q and W. Remove any you do not want to use
  78.     [:item, "物品"],            # in your game.
  79.     [:weapon, "武器"],
  80.     [:armor, "护甲"],
  81.    
  82.     ] # don't touch
  83.    
  84.   CHANGE_CAT_LEFT = "S <  "      # Text before the heading
  85.   LEFT_BUTTON = :Y               # Button to swap category to the left
  86.   CHANGE_CAT_RIGHT = "  > D"     # Text after the heading
  87.   RIGHT_BUTTON = :Z              # Button to swap category to the right
  88.    
  89.      
  90. #------------------------------------------------------------------------------#
  91. #  END SCRIPT SETTINGS
  92. #------------------------------------------------------------------------------#  

  93. end


  94. class Game_Interpreter

  95.   alias galv_key_item_interpreter_execute_command execute_command
  96.   def execute_command
  97.     if !@list[@index].nil?
  98.       if @list[@index].code == 108
  99.         $game_variables[Galv_Key::VARIABLE] = 0 if @list[@index].parameters[0] == "<key>"
  100.       end
  101.     end
  102.     galv_key_item_interpreter_execute_command
  103.   end
  104.    
  105.   def end_key
  106.     @index = @list.size
  107.     $game_variables[Galv_Key::VARIABLE] = 0
  108.   end

  109.   def use_key?
  110.     $game_variables[Galv_Key::VARIABLE] > 0
  111.   end
  112.    
  113.   def key?(cat,item_id)
  114.     if cat == $game_system.key_item_cat && $game_variables[Galv_Key::VARIABLE] == item_id
  115.       return true
  116.     else
  117.       return false
  118.     end
  119.   end
  120.    
  121.   def keyc?(cat)
  122.     if cat == $game_system.key_item_cat && $game_variables[Galv_Key::VARIABLE] > 0
  123.       return true
  124.     else
  125.       return false
  126.     end
  127.   end
  128.   
  129. end # Game_Interpreter


  130. class Game_Player < Game_Character

  131.   alias galv_key_item_move_by_input move_by_input
  132.   def move_by_input
  133.     galv_key_item_move_by_input
  134.     if Input.trigger?(Galv_Key::BUTTON)
  135.       return if $game_switches[Galv_Key::DISABLE_SWITCH] || jumping?
  136.       $game_message.item_choice_variable_id = Galv_Key::VARIABLE if !$game_map.interpreter.running?
  137.     end
  138.   end
  139.    
  140.   def use_on_event
  141.     case @direction
  142.     when 2; dirx = 0; diry = 1
  143.     when 4; dirx = -1; diry = 0
  144.     when 6; dirx = 1; diry = 0
  145.     when 8; dirx = 0; diry = -1
  146.     end
  147.      
  148.     @enable_event = false
  149.     for event in $game_map.events_xy(@x+dirx, @y+diry)
  150.       event.list.count.times { |i|
  151.         if event.list[i].code == 108 && event.list[i].parameters[0] == "<key>"
  152.           @enable_event = true
  153.         end
  154.       }
  155.     end
  156.      
  157.     if @enable_event
  158.       event.start
  159.     else
  160.       if Galv_Key::NO_TARGET > 0
  161.         $game_temp.reserve_common_event(Galv_Key::NO_TARGET)
  162.       else
  163.         $game_variables[Galv_Key::VARIABLE] = 0
  164.       end
  165.     end
  166.   end
  167. end # Game_Player < Game_Character


  168. class Window_KeyItem < Window_ItemList
  169.    
  170.   alias galv_key_item_key_window_on_ok on_ok
  171.   def on_ok
  172.     galv_key_item_key_window_on_ok
  173.     $game_player.use_on_event
  174.     clear_heading
  175.   end
  176.    
  177.   alias galv_key_item_key_window_on_cancel on_cancel
  178.   def on_cancel
  179.     galv_key_item_key_window_on_cancel
  180.     clear_heading
  181.   end
  182.    
  183.   alias galv_key_item_key_window_start start
  184.   def start
  185.     if !$game_switches[Galv_Key::DISABLE_SWITCH]
  186.       self.category = $game_system.key_item_cat
  187.       draw_heading
  188.       update_placement
  189.       refresh
  190.       select(0)
  191.       open
  192.       activate
  193.     else
  194.       galv_key_item_key_window_start
  195.     end
  196.   end
  197.    
  198.   def draw_heading
  199.     return if @heading != nil
  200.     @heading = Sprite.new
  201.     @heading.bitmap = Bitmap.new(Graphics.width, 25)
  202.     @heading.bitmap.font.size = 25
  203.     @heading.bitmap.font.color.set(text_color(0))
  204.     @position = 0 if @position.nil?
  205.     if Galv_Key::CATEGORIES.count > 1
  206.       text = Galv_Key::CHANGE_CAT_LEFT + Galv_Key::CATEGORIES[@position][1] + Galv_Key::CHANGE_CAT_RIGHT
  207.     else
  208.       text = Galv_Key::CATEGORIES[@position][1]
  209.     end
  210.      
  211.     @heading.bitmap.draw_text(@heading.bitmap.rect, text, 1)
  212.      
  213.     if @message_window.y >= Graphics.height / 2
  214.       @heading.y = @message_window.height
  215.     else
  216.       @heading.y = Graphics.height - height + @message_window.height
  217.     end
  218.      
  219.     @heading.z = z + 1
  220.     @heading.opacity = 0
  221.   end
  222.    
  223.   def clear_heading
  224.     @heading.dispose
  225.     @heading.bitmap.dispose
  226.     @heading = nil
  227.   end
  228.    
  229.   def enable?(item)
  230.     if !$game_switches[Galv_Key::DISABLE_SWITCH]
  231.       true
  232.     else
  233.       super
  234.     end
  235.   end
  236.    
  237.   def update
  238.     super
  239.     @heading.opacity = openness if [email protected]?
  240.     if self.active && Galv_Key::CATEGORIES.count > 1
  241.       if Input.trigger?(Galv_Key::LEFT_BUTTON)
  242.         Galv_Key::CATEGORIES.each_with_index do |c,i|
  243.           @position = i if c[0] == $game_system.key_item_cat
  244.         end
  245.         @position -= 1
  246.         @position = Galv_Key::CATEGORIES.count - 1 if @position < 0
  247.         self.category = $game_system.key_item_cat = Galv_Key::CATEGORIES[@position][0]
  248.         clear_heading
  249.         draw_heading
  250.         select(0)
  251.       end
  252.       if Input.trigger?(Galv_Key::RIGHT_BUTTON)
  253.         Galv_Key::CATEGORIES.each_with_index do |c,i|
  254.           @position = i if c[0] == $game_system.key_item_cat
  255.         end
  256.         @position += 1
  257.         @position = 0 if @position >= Galv_Key::CATEGORIES.count
  258.         self.category = $game_system.key_item_cat = Galv_Key::CATEGORIES[@position][0]
  259.         clear_heading
  260.         draw_heading
  261.         select(0)
  262.       end
  263.     end
  264.   end

  265. end # Window_KeyItem < Window_ItemList

  266. class Game_System
  267.   attr_accessor :key_item_cat
  268.    
  269.   alias galv_key_item_system_initialize initialize
  270.   def initialize
  271.     galv_key_item_system_initialize
  272.     @key_item_cat = Galv_Key::CATEGORIES[0][0]
  273.   end
  274. end
复制代码

作者: qq19750508    时间: 2014-7-29 13:05
那木有办法,
你只能使用海一样的开关了。
求你了,能不能贵重物品设置少一点,
那样,开关都不会是海一样了。
作者: VIPArcher    时间: 2014-7-29 16:38
你可以试试这样的,代价就是以后不能用物品处理处理其他的东西了。

  1. class RPG::UsableItem
  2.   def vip_item?
  3.     if $game_message.item_choice?  
  4.       /<vip>/ =~ @note ? false : true
  5.     else
  6.       /<vip>/ =~ @note ? true : false
  7.     end
  8.   end
  9. end

  10. class Window_ItemList < Window_Selectable  

  11.   def include?(item)
  12.     case @category
  13.     when :item
  14.       item.is_a?(RPG::Item) && !item.key_item?
  15.     when :weapon
  16.       item.is_a?(RPG::Weapon)
  17.     when :armor
  18.       item.is_a?(RPG::Armor)
  19.     when :key_item
  20.       item.is_a?(RPG::Item) && item.key_item? &&  !item.vip_item?
  21.     else
  22.       false
  23.     end
  24.   end
  25. end
复制代码
把那些地名的道具设为贵重物品,并且打上备注<vip>然后这些地名道具就会只在物品选择时出现
(未认真测试)
作者: R9560    时间: 2014-7-29 16:46
VIPArcher 发表于 2014-7-29 16:38
你可以试试这样的,代价就是以后不能用物品处理处理其他的东西了。把那些地名的道具设为贵重物品,并且打上 ...

谢谢,解决了




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1