Project1
标题:
【vx脚本】主角选择画面+获取技能物品作用对象
[打印本页]
作者:
企鹅达达
时间:
2010-11-9 21:17
标题:
【vx脚本】主角选择画面+获取技能物品作用对象
本帖最后由 企鹅达达 于 2010-11-14 20:43 编辑
两个扩展性很好的脚本。非常简单好用。
1. 队伍中的主角选择画面,选择结果(主角id及队伍序号)带入变量(默认19、20号变量,66、68行更改)。使用方法 $scene = Scene_ActorChoice.new
#==============================================================================
# ■ Scene_ActorChoice
#------------------------------------------------------------------------------
# アクターの選択後、選択したアクターのID、選択時のインデックスを變數に代入します。
#
#「使用方法」
# イベントコマンドのスクリプトで、$scene = Scene_ActorChoice.new記入
# 使用時のウィンドウは Window_MenuStatus を使用しました。
# 變數にアクターIDや選択時のインデックスを代入した後には条件分岐で使用してください。
# 注意:選択時のインデックスは実際選択したのが何番目とかには関係なく-1をしてください。
# 例)選択時三番目のキャラを選択した時のインデックスは2になります。
#
#「カスタマイズ」
# 66, 68行
# $game_variables[n]の nに 代入する變數IDを記入してください。
#
# ※このスクリプトのベースは Scene_Menu です。
#
#==============================================================================
class Scene_ActorChoice < Scene_Base
#--------------------------------------------------------------------------
# ● OBJECTの初期化
# menu_index : カーソルの初期位置
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@status_window_index = menu_index
end
#--------------------------------------------------------------------------
# ● 開示處理
#--------------------------------------------------------------------------
def start
super
create_menu_background
@status_windows = Window_MenuStatus.new(0, 0)
@status_windows.active = true
@status_windows.index = @status_window_index
end
#--------------------------------------------------------------------------
# ● 終了處理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@status_windows.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@status_windows.update
update_actor_selection_achoice
end
#--------------------------------------------------------------------------
# ● アクター選択の更新
#--------------------------------------------------------------------------
def update_actor_selection_achoice
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_windows.index
# 19番の變數に選択したキャラの選択時のインテックス(-1)を代入する。
$game_variables[19] = @status_windows.index
# 20番の變數に選択したキャラのアクターIDを代入する。
$game_variables[20] = $game_party.members[@status_windows.index].id
Sound.play_decision
$scene = Scene_Map.new
end
end
end
########################################################
# 制作 : dest21c (韓国)
[email protected]
#
########################################################
复制代码
2. 技能和物品对象获取,可以将作用的主角对象、作用的敌人队伍序号带入变量,用开关判定作用对象为主角还是敌人、技能对象是否成功击中(使用)。脚本中设定两个变量和开关。默认变量11、12,开关13、14
#==============================================================================
# Record Target Variable
# Version: 1.0
# Author: modern algebra (rmrk.net)
# Date: August 24, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# This script allows you to save the ID of an actor or enemy targetted by a
# skill or item to a designated variable. It is perfect for use in
# Common Events that are called by using items or weapons, as you can add
# additional effects that effect the target through the common event.
#
# Note that it only works for targetted items and skills - if the scope has
# multiple targets, than it will not update the values.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Place this script above Main and below Materials.
#
# To choose which variables to use for this script, go down to lines 41 & 43
# and alter the values of SELECTED_ACTOR_VARIABLE & SELECTED_ENEMY_VARIABLE.
# Note that when selecting an actor, it saves the ID of the actor, but when
# selecting an enemy, it returns the INDEX of the enemy in the troop. This
# follows the lead of event commands in how actors are selected. There are
# also two switches you can set at lines 46 & 49; TARGET_CLASS_SWITCH_ID
# records whether the user of the skill is an actor or an enemy, while
# NOHIT_SWITCH_ID records whether the target was hit by the item or skill.
#
# Using the script is fairly easy. Simply have the item or skill call a
# common event, and in that comment you can use the values of the variables
# and switches to determine the effect.
#==============================================================================
#==============================================================================
# ** Global Constants
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# new constants - RTV_SELECTED_ACTOR_VARIABLE, RTV_SELECTED_ENEMY_VARIABLE
#==============================================================================
# The ID of the variable to which the selected actor ID will be saved.
RTV_SELECTED_ACTOR_VARIABLE = 11
# The ID of the variable to which the selected enemy INDEX will be saved.
RTV_SELECTED_ENEMY_VARIABLE = 12
# The ID of a switch which tells if the target of a skill is an actor or an enemy
# ON => Enemy is target; OFF => Actor is target(此处有误,MS是倒过来)
RTV_TARGET_CLASS_SWITCH_ID = 13
# The ID of a switch which records whether or not the skill or item hit its
# target. ON => Target missed; OFF => Target hit
RTV_NOHIT_SWITCH_ID = 14
#==============================================================================
# ** Game_Battler
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - item_effect, skill_effect
#==============================================================================
class Game_Battler
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Item Effect
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modnalgb_st_efctitm_actrvar_0bg3 item_effect
def item_effect (user, item, *args)
# Run Original Method
modnalgb_st_efctitm_actrvar_0bg3 (user, item, *args)
rtv_set_target_to_variable (item)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Skill Effect
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias algabramod_skleffect_rtv_3jc2 skill_effect
def skill_effect (user, skill, *args)
# Run Original Method
algabramod_skleffect_rtv_3jc2 (user, skill, *args)
rtv_set_target_to_variable (skill)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Set Target to Variable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def rtv_set_target_to_variable (item)
if item.for_one?
if self.actor?
$game_variables[RTV_SELECTED_ACTOR_VARIABLE] = self.id
$game_switches[RTV_TARGET_CLASS_SWITCH_ID] = true
else
$game_variables[RTV_SELECTED_ENEMY_VARIABLE] = self.index
$game_switches[RTV_TARGET_CLASS_SWITCH_ID] = false
end
$game_switches[RTV_NOHIT_SWITCH_ID] = @missed || @evaded
end
end
end
复制代码
Project1.rar
(240.75 KB, 下载次数: 401)
2010-11-14 20:42 上传
点击文件名下载附件
作者:
仲秋启明
时间:
2010-11-14 18:37
建议咱发个工程
作者:
企鹅达达
时间:
2010-11-14 19:42
回复
仲秋启明
的帖子
既然你用的是“咱”,那就麻烦你了;P
作者:
风雪优游
时间:
2010-11-16 12:02
有奇妙作用的脚本……
作者:
退屈£无聊
时间:
2010-11-16 20:12
是的呀是的呀..
原来以为地球村是个没内涵的地方- - 看来我错了= =
作者:
冰舞蝶恋
时间:
2010-12-5 22:04
看帖不回是罪人。。阿门!
作者:
一瞬间的幻觉
时间:
2010-12-12 07:29
看不太懂,怎么用?用在哪?
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1