查看: 3432|回复: 2

[已经解决] 请问不用并行事件如何按下按键之后执行公共事件

[复制链接]
梦石
0
星屑
2920
在线时间
713 小时
注册时间
2010-7-25
回帖
659

开拓者

发表于 2016-8-8 19:54:29 | 显示全部楼层 |阅读模式

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

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

×
我想不用并行事件,在大地图上时按下某个按键时立即执行某公共事件,请问这该怎么写?

老鹰

梦石
40
星屑
38049
在线时间
7128 小时
注册时间
2012-5-26
回帖
3306

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

发表于 2016-8-8 20:06:59 | 显示全部楼层

脚本来源(使用规约:需要署名):https://yanflychannel.wordpress. ... tton-common-events/

Yanfly Engine Ace - Button Common Events
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Button Common Events v1.00
  4. # -- Last Updated: 2012.01.09
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-ButtonCommonEvents"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.09 - Started Script and Finished.
  15. #
  16. #==============================================================================
  17. # ▼ Introduction
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # RPG Maker VX Ace supports 8 different action buttons to use. However, only
  20. # 3 of those are used (A, B, and C) on the field map. The rest of them aren't
  21. # used at all. This script allows usage of the L, R, X, Y, and Z buttons by
  22. # binding them to common events.
  23. #
  24. #==============================================================================
  25. # ▼ Instructions
  26. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  27. # To install this script, open up your script editor and copy/paste this script
  28. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  29. #
  30. # Modify the COMMON_EVENT hash in the script module to adjust which common
  31. # events are used for each button.
  32. #
  33. #==============================================================================
  34. # ▼ Compatibility
  35. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  36. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  37. # it will run with RPG Maker VX without adjusting.
  38. #
  39. #==============================================================================

  40. module YEA
  41.   module BUTTON_EVENT
  42.    
  43.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  44.     # - Button Settings -
  45.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  46.     # This sets the common events that are to run when the particular button
  47.     # is pressed. The following chart shows the respective keyboard buttons.
  48.     #
  49.     #   :Button    Default Keyboard Button
  50.     #      :L        Q
  51.     #      :R        W
  52.     #      :X        A
  53.     #      :Y        S
  54.     #      :Z        D
  55.     #
  56.     # If you do not wish to associate a button with a common event, set the
  57.     # common event for that button to 0.
  58.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  59.     COMMON_EVENT ={
  60.     # :Button => Common Event,
  61.            :L =>   0,    # Does not run a common event.
  62.            :R =>   0,    # Does not run a common event.
  63.            :X =>   0,    # Runs common event 1.
  64.            :Y =>   0,    # Runs common event 2.
  65.            :Z =>   0,    # Runs common event 3.
  66.       
  67.     } # Do not remove this.
  68.    
  69.   end # BUTTON_EVENT
  70. end # YEA

  71. #==============================================================================
  72. # ▼ Editting anything past this point may potentially result in causing
  73. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  74. # halitosis so edit at your own risk.
  75. #==============================================================================

  76. #==============================================================================
  77. # ■ Scene_Map
  78. #==============================================================================

  79. class Scene_Map < Scene_Base
  80.   
  81.   #--------------------------------------------------------------------------
  82.   # alias method: update_scene
  83.   #--------------------------------------------------------------------------
  84.   alias scene_map_update_scene_bce update_scene
  85.   def update_scene
  86.     scene_map_update_scene_bce
  87.     update_button_common_events unless scene_changing?
  88.   end
  89.   
  90.   #--------------------------------------------------------------------------
  91.   # new method: update_button_common_events
  92.   #--------------------------------------------------------------------------
  93.   def update_button_common_events
  94.     for key in YEA::BUTTON_EVENT::COMMON_EVENT
  95.       next unless Input.trigger?(key[0])
  96.       next if key[1] <= 0
  97.       $game_temp.reserve_common_event(key[1])
  98.     end
  99.   end
  100.   
  101. end # Scene_Map

  102. #==============================================================================
  103. #
  104. # ▼ End of File
  105. #
  106. #==============================================================================
复制代码


P.S. 我似乎已经回答过楼主问题了似的

点评

是的,你中午回答了我一个问题  发表于 2016-8-8 20:10

评分

参与人数 2星屑 +15 梦石 +1 收起 理由
丿梁丶小柒 + 1 认可答案
jianyulei + 15 认可答案

查看全部评分

回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部