Project1
标题:
怎么实现按键触发事件?
[打印本页]
作者:
a1578032454
时间:
2012-12-9 12:14
标题:
怎么实现按键触发事件?
本人正在制作一个挖宝的事件,内容:一个地图内,主角在一个地方按下键,触发了一个事件,事件根据X轴和Y轴计算出离宝物的距离,可是在设置按键的方面,设置不到,总不可能全地图都设置一个 按确定是触发吧...,可是不这样,只设置一个,触发改为并行处理,却不能够一按下就触发,所以来此向各位求助。
作者:
zhangbanxian
时间:
2012-12-9 16:58
本帖最后由 zhangbanxian 于 2012-12-9 17:00 编辑
- -b用并行处理事件,内容是条件分歧某键是否按下,若按下则执行某某某...
作者:
896409879
时间:
2012-12-10 01:19
#==============================================================================
#
# ▼ Yanfly Engine Ace - Button Common Events v1.00
# -- Last Updated: 2012.01.09
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-ButtonCommonEvents"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.09 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# RPG Maker VX Ace supports 8 different action buttons to use. However, only
# 3 of those are used (A, B, and C) on the field map. The rest of them aren't
# used at all. This script allows usage of the L, R, X, Y, and Z buttons by
# binding them to common events.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# Modify the COMMON_EVENT hash in the script module to adjust which common
# events are used for each button.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
module YEA
module BUTTON_EVENT
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Button Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This sets the common events that are to run when the particular button
# is pressed. The following chart shows the respective keyboard buttons.
#
# :Button Default Keyboard Button
# :L Q
# :R W
# :X A
# :Y S
# :Z D
#
# If you do not wish to associate a button with a common event, set the
# common event for that button to 0.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
COMMON_EVENT ={
# :Button => Common Event,
:L => 0, # Does not run a common event.
:R => 0, # Does not run a common event.
:X => 1, # Runs common event 1.
:Y => 2, # Runs common event 2.
:Z => 3, # Runs common event 3.
} # Do not remove this.
end # BUTTON_EVENT
end # YEA
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# alias method: update_scene
#--------------------------------------------------------------------------
alias scene_map_update_scene_bce update_scene
def update_scene
scene_map_update_scene_bce
update_button_common_events unless scene_changing?
end
#--------------------------------------------------------------------------
# new method: update_button_common_events
#--------------------------------------------------------------------------
def update_button_common_events
for key in YEA::BUTTON_EVENT::COMMON_EVENT
next unless Input.trigger?(key[0])
next if key[1] <= 0
$game_temp.reserve_common_event(key[1])
end
end
end # Scene_Map
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
复制代码
作者:
xggzga117
时间:
2012-12-10 20:16
沙发正解——
偶系脚本盲……
作者:
a1578032454
时间:
2012-12-14 22:50
896409879 发表于 2012-12-10 01:19
看不懂...理解下脚本盲吧...
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1