-
Frozen
-
|
во время выполнения умения появляеться шкала в которой нужно набирать показаные последовательности кнопок.
[cut] #==============================================================================
# ** Tactical Command Display Ver.1.0.1 by Claimh
#------------------------------------------------------------------------------
# This creates a window to show the keystrokes needed in battle to perform
# a skill being used. Requires: Tactical Skills
#==============================================================================
class Window_Skill Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 128, 640, 352)
@actor = actor
@column_max = 1 # 1 line indication
refresh
self.index = 0
# If in battle, move window to center of screen
# and make it semi-transparent
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % @column_max * (288 + 32) # @column_max correction
y = index / @column_max * 32 # @column_max correction
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
# If a Tactical Skill
if !TacticalSkill::T_SKILL[skill.id].nil?
tact_skill = TacticalSkill::T_SKILL[skill.id][0]
command =
for i in 0...tact_skill.size
command += Input.key_converter(tact_skill[i]) +
end
self.contents.draw_text(x + 288 + 32, y, 204, 32, command)
else
self.contents.draw_text(x + 288 + 32, y, 204, 32, Not Command )
end
end
end [/cut]
[cut] #==============================================================================
# ** Tactical Skills Ver.1.4.0 by Claimh
#------------------------------------------------------------------------------
# Allow skills in combat by pressing the proper key combinations. If the key
# combination isn t properly entered, the skill can perform less damage and
# show a different battle animation
#==============================================================================
module TacticalSkill
#==============================================================================
# ** Customization START
#==============================================================================
# Keys
A = Input::A # Keyboard:Z
B = Input::B # Keyboard:X
C = Input::C # Keyboard:C
X = Input::X # Keyboard:A
Y = Input::Y # Keyboard:S
Z = Input::Z # Keyboard:D
L = Input::L # Keyboard:Q
R = Input::R # Keyboard:W
UP = Input::UP
DOWN = Input::DOWN
LEFT = Input::LEFT
RIGHT = Input::RIGHT
# Input time per 1 key
KEY_SEC = 1.0
# Bar displaying key-input time remaining (copy into Graphics/Windowskins folder)
T_BAR_NAME = bar
# The switch ID which changes key type (it can change indication)
# ON ?Game pad system
# ?OFF ?Keyboard system
KEY_TYPE_ID = 4
# If successful, the skill s scope becomes All Enemies or All Allies
ALL_ATK = false #true
# All the Skill ID s available
ALL_ATK_SK = [57, 61]
# Skill setting
T_SKILL = {
#Skill ID = [[Key 1, Key 2,...],Power if failed(?)(, Anim.ID if failed)]
1 = [[DOWN, UP, DOWN], 50],
7 = [[UP,DOWN,], 50],
8 = [[X,C,Z], 50],
9 = [[DOWN,X,A,B], 50],
10 = [[LEFT,UP], 50],
11 = [[L,X,R], 50],
12 = [[X,C,RIGHT,R], 50],
13 = [[UP,RIGHT], 50],
14 = [[L,Z,A], 50],
15 = [[R,X,X,DOWN], 50],
16 = [[DOWN, RIGHT], 50],
17 = [[A,B,C], 50],
18 = [[Y,X,DOWN,B], 50],
19 = [[LEFT,DOWN], 50],
20 = [[Z,Y,A], 50],
21 = [[B,C,X,L], 50],
22 = [[RIGHT,DOWN], 50],
23 = [[A,B,R], 50],
24 = [[X,Y,LEFT,R], 50],
25 = [[LEFT,RIGHT], 50],
26 = [[X,L,B], 50],
27 = [[LEFT,X,C,Z], 50],
28 = [[LEFT,DOWN], 50],
29 = [[C,X,A], 50],
30 = [[X,Z,C,UP], 50],
31 = [[UP,DOWN,X], 0],
32 = [[LEFT,RIGHT,L,R], 50],
57 = [[A, C], 50],
58 = [[C, X, UP], 50],
59 = [[A, UP, RIGHT, A], 50],
60 = [[Z, C, A, B], 50],
61 = [[X, C], 50],
62 = [[UP, X, DOWN], 50],
63 = [[LEFT, C, Y, A], 50],
64 = [[X, C, Y, A], 50],
65 = [[Y, A], 50],
66 = [[RIGHT, B, A], 50],
67 = [[LEFT, UP, Z, A], 50],
68 = [[Y, B, Y, A], 50],
69 = [[LEFT, A], 50],
70 = [[A, C, A], 50],
71 = [[B, B, A, A], 50],
72 = [[A, B, X, Y], 50],
73 = [[X, A], 50],
74 = [[Y, A, B], 50],
75 = [[LEFT, RIGHT, Y, A], 50],
76 = [[A, C, L, A], 50],
77 = [[R, X], 50],
78 = [[L, C, R], 50],
79 = [[LEFT, L, RIGHT, R], 50],
80 = [[C, C, Z, RIGHT], 50]
}
# * When animation when failing is changed, it is necessary to remove several
# place comments.
#==============================================================================
# ** Customization END
#==============================================================================
end
#==============================================================================
# * Input
#==============================================================================
module Input
module_function
#--------------------------------------------------------------------------
# * Key-in decision other than designated key
#--------------------------------------------------------------------------
def n_trigger?(num)
if trigger?(num)
return false
elsif trigger?(A) or trigger?(B) or trigger?(C) or
trigger?(X) or trigger?(Y) or trigger?(Z) or
trigger?(L) or trigger?(R) or
trigger?(UP) or trigger?(DOWN) or trigger?(RIGHT) or trigger?(LEFT)
return true
end
return false # In case of the key which not yet it does not input or does not use, or
end
#--------------------------------------------------------------------------
# * Key transformation table (for characters on screen acquisition)
#--------------------------------------------------------------------------
def key_converter(key)
# Game pad type
if $game_switches[TacticalSkill::KEY_TYPE_ID]
case key
when A
return A
when B
return B
when C
return C
when X
return X
when Y
return Y
when Z
return Z
when L
return R
when R
return L
end
# Keyboard type
else
case key
when A
return Z
when B
return X
when C
return C
when X
return A
when Y
return S
when Z
return D
when L
return Q
when R
return W
end
end
case key
when UP
return ?
when DOWN
return ?
when LEFT
return ?
when RIGHT
return ?
end
end
end
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
attr_accessor :tact_flag
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias initialize_tactical initialize
def initialize
initialize_tactical # Original
@tact_flag = false
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
alias skill_effect_tactical skill_effect
def skill_effect(user, skill)
if $scene.is_a?(Scene_Battle) and user.tact_flag
skill_copy = $data_skills[skill.id].dup
skill.power = skill.power * TacticalSkill::T_SKILL[skill.id][1] / 100
skill.hit = 0 if skill.power == 0 # The revision which does not hit by power 0
end
ret = skill_effect_tactical(user, skill)
if $scene.is_a?(Scene_Battle) and user.tact_flag
user.tact_flag = false
$data_skills[skill.id] = skill_copy.dup
end
return ret
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Frame Update (main phase step 2 : start action)
#--------------------------------------------------------------------------
alias update_phase4_step2_tactical update_phase4_step2
def update_phase4_step2
update_phase4_step2_tactical
# Initialization
@active_battler.tact_flag = false
@tact_skill_ok = false
#@miss_flag = false # Remove (#) comment if using the Miss animation
end
#--------------------------------------------------------------------------
# * Make Skill Action Results
#--------------------------------------------------------------------------
alias make_skill_action_result_tactical make_skill_action_result
def make_skill_action_result
# First decision
# If not a forcing action
unless @active_battler.current_action.forcing
# If unable to use due to SP running out
unless @active_battler.skill_can_use?(@active_battler.current_action.skill_id)
# Clear battler being forced into action
$game_temp.forcing_battler = nil
# Shift to step 1
@phase4_step = 1
return
end
end
if @active_battler.is_a?(Game_Actor)
if !TacticalSkill::T_SKILL[@active_battler.current_action.skill_id].nil?
# Tactical motion
make_tactical_skill_result
end
end
if TacticalSkill::ALL_ATK and @tact_skill_ok
if TacticalSkill::ALL_ATK_SK.include?(@skill.id)
skill_copy = @skill.dup
@skill.scope = 2
end
end
make_skill_action_result_tactical # Original
if TacticalSkill::ALL_ATK and @tact_skill_ok
if TacticalSkill::ALL_ATK_SK.include?(@skill.id)
@tact_skill_ok = false
@skill = $data_skills[skill_copy.id] = skill_copy.dup
end
end
# Remove (#) comments if using the Miss animation
#if @miss_flag
# @miss_flag = false
# unless TacticalSkill::T_SKILL[@skill.id][2].nil?
# @animation2_id = TacticalSkill::T_SKILL[@skill.id][2]
# end
#end
end
#--------------------------------------------------------------------------
# ? Tactical result compilation
#--------------------------------------------------------------------------
def make_tactical_skill_result
# When flashing there is no command
#return if @active_battler.flash_flag
tact_skill = TacticalSkill::T_SKILL[@active_battler.current_action.skill_id][0]
time = TacticalSkill::KEY_SEC * tact_skill.size * Graphics.frame_rate
key_count = 0
@active_battler.tact_flag = true
# Key-in & count window compilation
window_keycount = Window_KeyCount.new(tact_skill)
window_counter = Window_KeyCounter.new
# Remove (#) Comments at time of battle position revision combined use
#case $game_party.actors.size
#when 1
# actor_x = 240
#when 2
# actor_x = @active_battler.index * 240 + 120
#when 3
# actor_x = @active_battler.index * 200 + 40
#when 4
actor_x = @active_battler.index * 160
#end
window_keycount.x = window_counter.x = actor_x
for i in 0...time
# It succeeds in key-in?
if Input.trigger?(tact_skill[key_count])
key_count += 1
window_keycount.key_in
elsif Input.n_trigger?(tact_skill[key_count]) # The key which is different was pushed
#@miss_flag = true # Remove (#) comments if using the Miss animation
# Play Miss SE
#Audio.se_play( Audio/SE/ + filename )
break
end
# Completion of all the key-in
if key_count = tact_skill.size
window_keycount.text_in( Complete )
# Play Complete SE
#Audio.se_play( Audio/SE/ + filename )
@active_battler.tact_flag = false
@tact_skill_ok = true if TacticalSkill::ALL_ATK
break
end
# Renewal of progress bar
window_counter.refresh((i*100/time).truncate)
Graphics.update
Input.update
end
# It did not input at all = mistake
if @active_battler.tact_flag
window_keycount.text_in( Miss )
end
# wait for Miss?Complete display
for i in 0...10
Graphics.update
@spriteset.update
end
window_keycount.dispose
window_counter.dispose
end
end
#==============================================================================
# ** Window_Base
#==============================================================================
class Window_Base Window
#--------------------------------------------------------------------------
# * Draw Counter Bar
# x : window x-coordinate
# y : window y-coordinate
# current : Progress ratio (?)
#--------------------------------------------------------------------------
def draw_counter_bar(x, y, current)
bitmap = RPG::Cache.windowskin(TacticalSkill::T_BAR_NAME)
cw = bitmap.width * current / 100
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x, y, bitmap, src_rect)
end
end
#==============================================================================
# ** Window_KeyCounter
#------------------------------------------------------------------------------
# ?The bar which indicates progress ratio
#==============================================================================
class Window_KeyCounter Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# key ? Key arrangement
#--------------------------------------------------------------------------
def initialize
super(0, 256, 150, 80)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.z = 1 # The battler compared to it indicates in the inner part
refresh(0)
end
#--------------------------------------------------------------------------
# * Refresh
# current : Progress ratio (?)
#--------------------------------------------------------------------------
def refresh(current)
self.contents.clear
#draw_counter_bar(0, 0, 100-current) # Progress direction ? ?
draw_counter_bar(0, 0, current) # Progress direction ? ?
end
end
#==============================================================================
# ** Window_KeyCount
#------------------------------------------------------------------------------
# ?The window which indicates the key which it inputs.
#==============================================================================
class Window_KeyCount Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# key ? Key arrangement
#--------------------------------------------------------------------------
def initialize(key)
super(0, 220, 150, 80)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 160 # Translucency
self.z = 0 # The progress bar compared to it indicates in the inner part
@key = key
@key_count = 0
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@key.size
x = i * 32 # Interval between letter: 32
if i @key_count
self.contents.font.color = knockout_color
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x, 0, 100, 32, Input.key_converter(@key[i]))
end
end
#--------------------------------------------------------------------------
# * Key count
#--------------------------------------------------------------------------
def key_in
@key_count += 1
refresh
end
#--------------------------------------------------------------------------
# * Text indication
# text :?text
#--------------------------------------------------------------------------
def text_in(text)
self.contents.clear
self.contents.draw_text(0, 0, 100, 32, text, 1)
end
end [/cut]
Демо: http://arykray.narod.ru/rpg-maker/XP/script/TS.exe
Ссылка http://www.rmxp.org/forums/index.php?topic=9137
|