Project1
标题:
关于被动技能设置的问题
[打印本页]
作者:
童话镇的蜗牛
时间:
2017-4-3 23:04
标题:
关于被动技能设置的问题
想请教一下,如果想设置被动技能(类似面对同属性的对手时攻击力上升,或者是受到攻击时会反击这样的),该怎么设置呢?
作者:
童话镇的蜗牛
时间:
2017-4-4 00:05
有大佬能帮帮忙吗?
作者:
世界第一中二
时间:
2017-4-4 01:08
我也是萌新dasi!
先发个dalao的脚本抛砖引玉吧,看看还有没有别的dalao愿意给你更详细的解答
#===============================================================================
# ■ 战斗中自动附加被动状态
# By :VIPArcher [email:
[email protected]
]
# -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
#==============================================================================
# ■ 在战斗开始时自动为每一位战斗者附加上设置好的状态,战斗结束时移除
# 使用说明:
# 在角色|职业|装备|敌人的备注栏备注<被动状态:状态ID> 例如 <被动状态:18>
# 同时备注多个被动状态亦可叠加,都会为其附加上对应的状态。只有战斗开始时附加一次状态
# 的备注栏应该也可以用,只要战斗开始前有某状态亦可附加上该状态备注栏里指定对的状态
#==============================================================================
$VIPArcherScript ||= {};$VIPArcherScript[:battle_state] = 20141102
#--------------------------------------------------------------------------------
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# ● 战斗开始处理
#--------------------------------------------------------------------------
alias state_battle_start on_battle_start
def on_battle_start
state_battle_start
self.feature_objects.each {|obj| obj.note.split(/[\r\n]+/).each{ |line|
self.add_state($1.to_i) if line =~ /<被动状态:\s*(\d+)>/}}
end
#--------------------------------------------------------------------------
# ● 战斗结束处理
#--------------------------------------------------------------------------
alias state_on_battle_end on_battle_end
def on_battle_end
state_on_battle_end
self.feature_objects.each {|obj| obj.note.split(/[\r\n]+/).each{ |line|
self.remove_state($1.to_i) if line =~ /<被动状态:\s*(\d+)>/}}
end
end
复制代码
另外,
善用搜索
,请在论坛搜索栏中搜索关键词“被动技能”
作者:
graygod
时间:
2017-4-4 04:44
#==============================================================================
#
# ▼ Yanfly Engine Ace - Passive States v1.02
# -- Last Updated: 2012.01.23
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-PassiveStates"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.23 - Compatibility Update: Doppelganger
# 2012.01.08 - Added passive state checks for adding/removing states.
# 2011.12.14 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script allows for actors, classes, weapons, armours, and enemies to have
# passives that are based off of states. Passive states will be active at all
# times and are immune to restrictions and will only disappear if the battler
# dies. Once the battler revives, the passives will return.
#
#==============================================================================
# ▼ 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.
#
# -----------------------------------------------------------------------------
# Actor Notetags - These notetags go in the actors notebox in the database.
# -----------------------------------------------------------------------------
# <passive state: x>
# <passive state: x, x>
# This will cause state x to be always on (unless the battler is dead). To have
# multiple passives, insert multiples of this notetag.
#
# -----------------------------------------------------------------------------
# Class Notetags - These notetags go in the class notebox in the database.
# -----------------------------------------------------------------------------
# <passive state: x>
# <passive state: x, x>
# This will cause state x to be always on (unless the battler is dead). To have
# multiple passives, insert multiples of this notetag.
#
# -----------------------------------------------------------------------------
# Weapon Notetags - These notetags go in the weapons notebox in the database.
# -----------------------------------------------------------------------------
# <passive state: x>
# <passive state: x, x>
# This will cause state x to be always on (unless the battler is dead). To have
# multiple passives, insert multiples of this notetag.
#
# -----------------------------------------------------------------------------
# Armour Notetags - These notetags go in the armours notebox in the database.
# -----------------------------------------------------------------------------
# <passive state: x>
# <passive state: x, x>
# This will cause state x to be always on (unless the battler is dead). To have
# multiple passives, insert multiples of this notetag.
#
# -----------------------------------------------------------------------------
# Enemy Notetags - These notetags go in the enemies notebox in the database.
# -----------------------------------------------------------------------------
# <passive state: x>
# <passive state: x, x>
# This will cause state x to be always on (unless the battler is dead). To have
# multiple passives, insert multiples of this notetag.
#
#==============================================================================
# ▼ 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.
#
#==============================================================================
# ▼ 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.
#==============================================================================
module YEA
module REGEXP
module BASEITEM
PASSIVE_STATE =
/<(?:PASSIVE_STATE|passive state):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
end # BASEITEM
end # REGEXP
end # YEA
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_pst load_database; end
def self.load_database
load_database_pst
load_notetags_pst
end
#--------------------------------------------------------------------------
# new method: load_notetags_pst
#--------------------------------------------------------------------------
def self.load_notetags_pst
groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
$data_enemies]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_pst
end
end
end
end # DataManager
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :passive_states
#--------------------------------------------------------------------------
# common cache: load_notetags_pst
#--------------------------------------------------------------------------
def load_notetags_pst
@passive_states = []
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::BASEITEM::PASSIVE_STATE
$1.scan(/\d+/).each { |num|
@passive_states.push(num.to_i) if num.to_i > 0 }
#---
end
} # self.note.split
#---
end
end # RPG::BaseItem
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: state?
#--------------------------------------------------------------------------
alias game_battlerbase_state_check_pst state?
def state?(state_id)
return true if passive_state?(state_id)
return game_battlerbase_state_check_pst(state_id)
end
#--------------------------------------------------------------------------
# alias method: states
#--------------------------------------------------------------------------
alias game_battlerbase_states_pst states
def states
array = game_battlerbase_states_pst
array |= passive_states
return array
end
#--------------------------------------------------------------------------
# new method: passive_state?
#--------------------------------------------------------------------------
def passive_state?(state_id)
@passive_states = [] if @passive_states.nil?
return @passive_states.include?(state_id)
end
#--------------------------------------------------------------------------
# new method: passive_states
#--------------------------------------------------------------------------
def passive_states
array = []
if actor?
for state_id in self.actor.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
for state_id in self.class.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
for equip in equips
next if equip.nil?
for state_id in equip.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
end
else # enemy
for state_id in self.enemy.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
if $imported["YEA-Doppelganger"] && !self.class.nil?
for state_id in self.class.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
end
end
create_passive_state_array(array)
sort_passive_states(array)
set_passive_state_turns(array)
return array
end
#--------------------------------------------------------------------------
# new method: create_passive_state_array
#--------------------------------------------------------------------------
def create_passive_state_array(array)
@passive_states = []
for state in array
@passive_states.push(state.id)
end
end
#--------------------------------------------------------------------------
# new method: passive_state_addable?
#--------------------------------------------------------------------------
def passive_state_addable?(state_id)
return false if $data_states[state_id].nil?
return alive?
end
#--------------------------------------------------------------------------
# new method: set_passive_state_turns
#--------------------------------------------------------------------------
def sort_passive_states(array)
array.sort! do |state_a, state_b|
if state_a.priority != state_b.priority
state_b.priority <=> state_a.priority
else
state_a.id <=> state_b.id
end
end
return array
end
#--------------------------------------------------------------------------
# new method: set_passive_state_turns
#--------------------------------------------------------------------------
def set_passive_state_turns(array)
for state in array
@state_turns[state.id] = 0 unless @states.include?(state.id)
@state_steps[state.id] = 0 unless @states.include?(state.id)
end
end
end # Game_BattlerBase
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: state_addable?
#--------------------------------------------------------------------------
alias game_battler_state_addable_ps state_addable?
def state_addable?(state_id)
return false if passive_state?(state_id)
return game_battler_state_addable_ps(state_id)
end
#--------------------------------------------------------------------------
# alias method: remove_state
#--------------------------------------------------------------------------
alias game_battler_remove_state_ps remove_state
def remove_state(state_id)
return if passive_state?(state_id)
game_battler_remove_state_ps(state_id)
end
end # Game_Battler
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
复制代码
作者:
童话镇的蜗牛
时间:
2017-4-14 22:52
世界第一中二 发表于 2017-4-4 01:08
我也是萌新dasi!
先发个dalao的脚本抛砖引玉吧,看看还有没有别的dalao愿意给你更详细的解答
谢谢你!!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1