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

Project1

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

[已经解决] 怎么实现按键触发事件?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
164 小时
注册时间
2011-8-15
帖子
238
跳转到指定楼层
1
发表于 2012-12-9 12:14:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本人正在制作一个挖宝的事件,内容:一个地图内,主角在一个地方按下键,触发了一个事件,事件根据X轴和Y轴计算出离宝物的距离,可是在设置按键的方面,设置不到,总不可能全地图都设置一个 按确定是触发吧...,可是不这样,只设置一个,触发改为并行处理,却不能够一按下就触发,所以来此向各位求助。

点评

公共事件1——并行处理,按键打开某开关。公共事件2——某开关开时自动执行,执行完毕后关闭开关。  发表于 2012-12-26 22:24
用物品触发事件好了!弄个藏宝图啥的……  发表于 2012-12-9 22:53

Lv1.梦旅人

梦石
0
星屑
50
在线时间
270 小时
注册时间
2010-2-4
帖子
1305
2
发表于 2012-12-9 16:58:50 | 只看该作者
本帖最后由 zhangbanxian 于 2012-12-9 17:00 编辑

- -b用并行处理事件,内容是条件分歧某键是否按下,若按下则执行某某某...

点评

我的确是这样设置了...但没有用= =  发表于 2012-12-14 22:51
好歹当年也当过大魔王过,orz
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
616 小时
注册时间
2010-10-29
帖子
463
3
发表于 2012-12-10 01:19:58 | 只看该作者
  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 =>   1,    # Runs common event 1.
  64.            :Y =>   2,    # Runs common event 2.
  65.            :Z =>   3,    # Runs common event 3.
  66.     } # Do not remove this.
  67.    
  68.   end # BUTTON_EVENT
  69. end # YEA

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

  75. #==============================================================================
  76. # ■ Scene_Map
  77. #==============================================================================

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

  101. #==============================================================================
  102. #
  103. # ▼ End of File
  104. #
  105. #==============================================================================
复制代码
我命令你给我点下面的东西!

LBQ Works
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
170
在线时间
227 小时
注册时间
2011-5-19
帖子
736
4
发表于 2012-12-10 20:16:18 | 只看该作者
沙发正解——
偶系脚本盲……
休息中……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
164 小时
注册时间
2011-8-15
帖子
238
5
 楼主| 发表于 2012-12-14 22:50:09 | 只看该作者
896409879 发表于 2012-12-10 01:19

看不懂...理解下脚本盲吧...
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-10 16:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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