-
Notifications
You must be signed in to change notification settings - Fork 173
/
Cast_Animations.rb
207 lines (182 loc) · 7.93 KB
/
Cast_Animations.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#==============================================================================
#
# ▼ Yanfly Engine Ace - Cast Animations v1.00
# -- Last Updated: 2011.12.18
# -- Level: Easy, Normal
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-CastAnimations"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2011.12.18 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Casting animations are actually great visual tools to help players recognize
# and acknowledge which battler on the screen is currently taking an action.
# The other thing is that casting animations also provide eye candy. This
# script provides easy access to generate cast animations and to allow even
# separate animations for each individual skill.
#
#==============================================================================
# ▼ 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.
#
# -----------------------------------------------------------------------------
# Skill Notetags - These notetags go in the skills notebox in the database.
# -----------------------------------------------------------------------------
# <cast ani: x>
# Sets the casting animation for this skill to be x. This animation will always
# be played before this skill is used. If this tag isn't used, the default cast
# animation will be the one set by the script's module.
#
# <no cast ani>
# Sets the casting animation for this skill to be 0, making it so that no cast
# animation will be played before this skill is used.
#
# -----------------------------------------------------------------------------
# Item Notetags - These notetags go in the items notebox in the database.
# -----------------------------------------------------------------------------
# <cast ani: x>
# Sets the casting animation for this item to be x. This animation will always
# be played before this item is used. If this tag isn't used, the default cast
# animation will be the one set by the script's module.
#
# <no cast ani>
# Sets the casting animation for this item to be 0, making it so that no cast
# animation will be played before this item is used.
#
#==============================================================================
# ▼ 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 CAST_ANIMATIONS
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Default Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings set the default casting animations for all skills that do
# not use a unique casting animation. If you don't want any of the settings
# below to have a cast animation, set it to 0 to disable it.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
NORMAL_ATTACK_ANI = 0 # Default animation for skill #1.
DEFEND_ANIMATION = 0 # Default animation for skill #2.
PHYSICAL_ANIMATION = 81 # Default animation for physical skills.
MAGICAL_ANIMATION = 43 # Default animation for magical skills.
ITEM_USE_ANIMATION = 0 # Default animation for using items.
end # CAST_ANIMATIONS
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.
#==============================================================================
module YEA
module REGEXP
module USABLEITEM
CAST_ANI = /<(?:CAST_ANI|cast ani|cast animation):[ ](\d+)>/i
NO_CAST_ANI = /<(?:NO_CAST_ANI|no cast ani|no cast animation)>/i
end # USABLEITEM
end # REGEXP
end # YEA
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_cani load_database; end
def self.load_database
load_database_cani
load_notetags_cani
end
#--------------------------------------------------------------------------
# new method: load_notetags_cani
#--------------------------------------------------------------------------
def self.load_notetags_cani
groups = [$data_items, $data_skills]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_cani
end
end
end
end # DataManager
#==============================================================================
# ■ RPG::UsableItem
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variable
#--------------------------------------------------------------------------
attr_accessor :cast_ani
#--------------------------------------------------------------------------
# common cache: load_notetags_cani
#--------------------------------------------------------------------------
def load_notetags_cani
@cast_ani = 0
if self.is_a?(RPG::Skill)
if @id == 1
@cast_ani = YEA::CAST_ANIMATIONS::NORMAL_ATTACK_ANI
elsif @id == 2
@cast_ani = YEA::CAST_ANIMATIONS::DEFEND_ANIMATION
elsif self.physical?
@cast_ani = YEA::CAST_ANIMATIONS::PHYSICAL_ANIMATION
elsif self.magical?
@cast_ani = YEA::CAST_ANIMATIONS::MAGICAL_ANIMATION
end
else
@cast_ani = YEA::CAST_ANIMATIONS::ITEM_USE_ANIMATION
end
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::USABLEITEM::CAST_ANI
@cast_ani = $1.to_i
when YEA::REGEXP::USABLEITEM::NO_CAST_ANI
@cast_ani = 0
#---
end
} # self.note.split
#---
end
end # RPG::UsableItem
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# alias method: use_item
#--------------------------------------------------------------------------
alias scene_battle_use_item_cani use_item
def use_item
process_casting_animation unless $imported["YEA-BattleEngine"]
scene_battle_use_item_cani
end
#--------------------------------------------------------------------------
# new method: process_casting_animation
#--------------------------------------------------------------------------
def process_casting_animation
item = @subject.current_action.item
cast_ani = item.cast_ani
return if cast_ani <= 0
show_animation([@subject], cast_ani)
end
end # Scene_Battle
#==============================================================================
#
# ▼ End of File
#
#==============================================================================