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

Project1

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

[已经解决] 新人求问·关于技能使用菜单不关

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2016-6-10
帖子
5
跳转到指定楼层
1
发表于 2016-9-3 18:14:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
首先大家好啊{:2_251:}
既然没什么想说的我就开门见山一下{:2_251:}
就是那些在菜单中使用的技能{:2_250:}
怎样让技能使用完后菜单不消失{:2_264:}
我想作死弄一个撸键盘加经验的技能{:2_257:}
并着这个帖子在咱们版报道一下{:2_277:}
谢谢热心的网友{:2_287:}

Lv3.寻梦者

梦石
0
星屑
1345
在线时间
378 小时
注册时间
2015-6-16
帖子
571
2
发表于 2016-9-4 07:40:20 | 只看该作者
有个简单的办法技能——公共事件
循环
选项A 加经验
选项B 跳出
结束
技能使用除非是 治疗那种
我还有一个办法是用公式,不过很长,你要就加我QQ1286124843
P1不太上了,有问题加个Q1286124843,不管是脚本还是游戏问题都可以来找我
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
582
在线时间
310 小时
注册时间
2016-2-29
帖子
210
3
发表于 2016-9-4 10:17:21 | 只看该作者
公共事件第一行添加注释<run scene: current>
  1. =begin
  2. #===============================================================================
  3. Title: Scene Interpreter
  4. Author: Hime
  5. Date: Nov 21, 2015
  6. --------------------------------------------------------------------------------
  7. ** Change log
  8. Nov 21, 2015
  9.    - fixed bug where item menu crashes when using common event
  10. Nov 17, 2015
  11.    - create scene message windows, not normal windows
  12. Oct 24, 2015
  13.    - implement callback function for scene interpreter
  14. Sep 18, 2015
  15.    - fixed major memory leak issues reported by Sixth
  16. May 26, 2015
  17.    - fixed issue with common events called by scene interpreter
  18. Jan 27, 2015
  19.    - experimental cross-scene common events
  20. Nov 19, 2014
  21.    - Interpreter is re-created on reset so commands don't continue to run from
  22.      the previous session
  23. Oct 13, 2014
  24.    - added support for disabling other windows when interpreter takes control
  25.    - moved interpreter into SceneManager as a global scene interpreter
  26. Sep 5, 2013
  27.    - fixed bug where common events returning to map did not execute properly
  28. Apr 24, 2013
  29.    - fixed bug where game crashed when no common events were reserved
  30. Apr 3, 2013
  31.    - Added comment to determine scene to run common event
  32. Mar 30, 2013
  33.    - Initial release
  34. --------------------------------------------------------------------------------   
  35. ** Terms of Use
  36. * Free to use in non-commercial projects
  37. * Contact me for commercial use
  38. * No real support. The script is provided as-is
  39. * Will do bug fixes, but no compatibility patches
  40. * Features may be requested but no guarantees, especially if it is non-trivial
  41. * Credits to Hime Works in your project
  42. * Preserve this header
  43. --------------------------------------------------------------------------------
  44. ** Description

  45. This script adds an interpreter and message window to every scene so that
  46. you can run common events in any scene.

  47. --------------------------------------------------------------------------------
  48. ** Installation

  49. Place this below Materials and above Main. You should place this above other
  50. custom scripts.

  51. --------------------------------------------------------------------------------
  52. ** Usage

  53. If you would like a common event to run in the current scene, create a
  54. comment in the common event command list with this string

  55.    <run scene: current>
  56.   
  57. #===============================================================================
  58. =end
  59. $imported = {} if $imported.nil?
  60. $imported["TH_SceneInterpreter"] = true
  61. #===============================================================================
  62. # ** Configuration
  63. #===============================================================================
  64. module TH
  65.   module Scene_Interpreter
  66.    
  67.     # Run common events directly in scene without going to map
  68.     No_Return_Scene = true
  69.    
  70.     Run_Regex = /<run[-_ ]scene:\s*(\w+)/i
  71.   end
  72. end
  73. #===============================================================================
  74. # ** Rest of Script
  75. #===============================================================================
  76. module RPG
  77.   class CommonEvent
  78.    
  79.     #---------------------------------------------------------------------------
  80.     # Which scene to run this common event
  81.     #---------------------------------------------------------------------------
  82.     def run_scene
  83.       return @run_scene unless @run_scene.nil?
  84.       parse_comments_scene_interpreter
  85.       return @run_scene
  86.     end
  87.    
  88.     #---------------------------------------------------------------------------
  89.     # Parse the commands for a Run Scene comment
  90.     #---------------------------------------------------------------------------
  91.     def parse_comments_scene_interpreter
  92.       # just an arbitrary default value
  93.       @run_scene = :map
  94.       @list.each do |cmd|
  95.         if cmd.code == 108 && cmd.parameters[0] =~ TH::Scene_Interpreter::Run_Regex
  96.           @run_scene = $1.downcase.to_sym
  97.         end
  98.       end
  99.     end
  100.   end
  101. end

  102. module SceneManager
  103.   
  104.   class << self
  105.     alias :th_scene_interpreter_run :run
  106.   end
  107.   
  108.   def self.run   
  109.     init_interpreter
  110.     th_scene_interpreter_run
  111.   end
  112.   
  113.   def self.init_interpreter
  114.     @interpreter = Game_SceneInterpreter.new   
  115.   end
  116.   
  117.   def self.interpreter
  118.     @interpreter
  119.   end
  120. end

  121. #-------------------------------------------------------------------------------
  122. # A special interpreter for scenes
  123. #-------------------------------------------------------------------------------
  124. class Game_SceneInterpreter < Game_Interpreter
  125.   attr_accessor :callback
  126.   
  127.   def pause_windows
  128.     SceneManager.scene.store_active_windows
  129.   end
  130.   
  131.   def unpause_windows
  132.     SceneManager.scene.restore_active_windows
  133.   end
  134.   
  135.   def update
  136.     @fiber.resume if @fiber
  137.   end
  138.   
  139.   alias :th_scene_interpreter_run :run
  140.   def run
  141.     th_scene_interpreter_run
  142.     if @callback
  143.       @callback.call
  144.       @callback = nil
  145.     end
  146.   end
  147. end

  148. class Scene_Base
  149.   
  150.   alias :th_scene_interpreter_start :start
  151.   def start
  152.     @active_windows = []
  153.     @windows = []
  154.     th_scene_interpreter_start
  155.     create_message_window
  156.   end
  157.   
  158.   alias :th_scene_interpreter_post_start :post_start
  159.   def post_start
  160.     instance_variables.each do |varname|
  161.       ivar = instance_variable_get(varname)
  162.       if !ivar.is_a?(Window_SceneMessage) && ivar.is_a?(Window)
  163.         @windows << ivar
  164.       end
  165.     end
  166.     th_scene_interpreter_post_start
  167.   end
  168.   
  169.   #-----------------------------------------------------------------------------
  170.   # Create message window
  171.   #-----------------------------------------------------------------------------
  172.   def create_message_window
  173.     @message_window = Window_SceneMessage.new
  174.   end
  175.   
  176.   alias :th_scene_interpreter_update :update
  177.   def update
  178.     th_scene_interpreter_update
  179.     update_interpreter
  180.   end
  181.   
  182.   #-----------------------------------------------------------------------------
  183.   # Run any common events
  184.   #-----------------------------------------------------------------------------
  185.   def update_interpreter
  186.    
  187.     loop do      
  188.       SceneManager.interpreter.update      
  189.       return if SceneManager.interpreter.running?
  190.       
  191.       # Don't setup the common event if it doesn't run in the current scene
  192.       return if $game_temp.common_event_reserved? && $data_common_events[$game_temp.common_event_id].run_scene != :current
  193.       
  194.       if SceneManager.interpreter.setup_reserved_common_event
  195.         store_active_windows
  196.       else
  197.         restore_active_windows
  198.         return
  199.       end
  200.     end   
  201.   end
  202.   
  203.   #-----------------------------------------------------------------------------
  204.   # Go through all windows and store them if they're active
  205.   #-----------------------------------------------------------------------------
  206.   def store_active_windows
  207.     restore_active_windows
  208.     @windows.each do |win|
  209.       if win.active
  210.         @active_windows.push(win)
  211.         win.deactivate
  212.       end
  213.     end   
  214.   end
  215.   
  216.   def restore_active_windows
  217.     @active_windows.each do |win|
  218.       win.activate
  219.     end
  220.     @active_windows = []
  221.   end
  222. end

  223. class Scene_ItemBase < Scene_MenuBase
  224.   alias :th_scene_interpreter_check_common_event :check_common_event
  225.   def check_common_event
  226.     return if !$game_temp.common_event_reserved? || ($game_temp.common_event_reserved? && $data_common_events[$game_temp.common_event_id].run_scene == :current)
  227.     SceneManager.interpreter.callback = Proc.new { @actor_window.refresh unless @actor_window.disposed? }
  228.     th_scene_interpreter_check_common_event
  229.   end
  230. end

  231. class Window_SceneMessage < Window_Message
  232.   
  233.   #-----------------------------------------------------------------------------
  234.   # These are all random z values
  235.   #-----------------------------------------------------------------------------
  236.   alias :th_scene_interpreter_initialize :initialize
  237.   def initialize
  238.     super
  239.     self.z = 500
  240.     @gold_window.z = 500
  241.     @item_window.z = 500
  242.     @number_window.z = 500
  243.     @choice_window.z = 500
  244.   end
  245. end

  246. class Game_Interpreter
  247.   attr_reader :index
  248.   
  249.   alias :th_scene_interpreter_command_117 :command_117
  250.   def command_117
  251.     common_event = $data_common_events[@params[0]]
  252.     if common_event && common_event.run_scene == :current      
  253.       # hack solution. When a common event is called, we check whether
  254.       # it should run in the current scene or not. If it should, we delegate
  255.       # it to the scene interpreter. However, common events from the
  256.       # scene interpreter run into problems
  257.       if self.is_a?(Game_SceneInterpreter)
  258.         child = Game_SceneInterpreter.new(@depth + 1)
  259.         child.setup(common_event.list, same_map? ? @event_id : 0)
  260.         child.run
  261.       else
  262.         SceneManager.interpreter.setup(common_event.list)
  263.         Fiber.yield while SceneManager.interpreter.running?
  264.       end
  265.     else
  266.       th_scene_interpreter_command_117
  267.     end
  268.   end
  269. end

  270. # Memory leak situation is created when the following scenes create their own
  271. # message windows, overwriting the one created when the scene started. Issue reported and
  272. # fix provided by Sixth
  273. class Scene_Map
  274.   def create_message_window
  275.     @message_window = Window_SceneMessage.new unless @message_window && !@message_window.disposed?
  276.   end
  277. end

  278. class Scene_Battle
  279.   def create_message_window
  280.     @message_window = Window_SceneMessage.new unless @message_window && !@message_window.disposed?
  281.   end
  282. end
复制代码

点评

使用带公共事件的物品不会隐藏当前界面  发表于 2016-9-4 10:19

评分

参与人数 1星屑 +250 梦石 +1 收起 理由
RaidenInfinity + 250 + 1 楼主认可的解答

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2016-6-10
帖子
5
4
 楼主| 发表于 2016-9-5 17:25:24 | 只看该作者
是猪别乱叫 发表于 2016-9-4 10:17
公共事件第一行添加注释

那个,这些代码是添加到哪啊,好像直接复制不到公共事件里{:2_270:}

点评

哦!知道了,万分感谢!  发表于 2016-9-5 17:31
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-16 19:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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