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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
| #==============================================================================
# Enemy Summon Skill
# Version: 1.0
# Author: modern algebra (rmrk.net)
# Date: May 8, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# This script allows you to make skills for enemies where they can summon or
# call additional enemies to the battlefield. This is NOT a summon skill that
# can be used by actors - it can ONLY be used by enemies.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Place this script above Main and below Materials in its own slot in the
# Script Editor (F11).
#
# You can set up some basic configuration options at line 52. Please see the
# surrounding comments to see what each does.
#
# To create a summoning skill (again, this skill can ONLY be used by
# enemies), all you need to do is put the following code (can be changed at
# line 69 if you desire):
#
# \SUMMON_ENEMY[enemy_id, x, y, chance]
# enemy_id : the ID of the enemy it can summon
# x : the additional pixels along the axis the summoned creature is from
# its summoner. If omitted, it defaults to the value at line 64.
# y : the additional pixels along the axis the summoned creature is from
# its summoner. If omitted, it defaults to the value at line 67.
# chance: of the potential candidates for summoning, how likely this one
# will be chosen over the others. If omitted, this defaults to 1.
#
# As you can probably tell, you can place a number of these codes in the
# same notebox and thus you can make the same skill potentially summon
# different enemies, and you can control that through the chance.
#
# EXAMPLES:
#
# A skill with its notebox set up like this:
# \summon_enemy[1, 35, 45, 3]
# \summon_enemy[2, 25, 35, 1]
#
# Would, when it succeeds (which is governed directly by the hit ratio of the
# skill) summon the enemy with ID 1 (Default: Slime) 75% of the time and the
# enemy with ID 2 (Default: Bat) 25% of the time, and the position, if it is
# a slime would be 35 pixels to the right of the summoner and 45 pixels down,
# or if it is the bat, then 25 pixels to the right of the summoner and 35
# pixels down. The chances are 75-25 because 3 + 1 = 4, which means that 3/4
# times the slime will be summoned and 1/4 times the bat will be summoned.
#==============================================================================
# CONFIGURATION
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new constant - MAES_VOCAB_SUMMON_FAILURE; MAES_MAX_TROOP_SIZE;
# MAES_DEFAULT_X_PLUS; MAES_DEFAULT_Y_PLUS; MAES_NOTECODE
#==============================================================================
# Message shown when a summon skill fails.
=end
MAES_VOCAB_SUMMON_FAILURE = "%s failed to summon ally!"
# The maximum number of enemies in a troop (caps number of summons permitted)
MAES_MAX_TROOP_SIZE = 5
# The default x offset for a summoned enemy from its summoner. If you manually
# set this in the note box, this value will not be used.
MAES_DEFAULT_X_PLUS = 35
# The default y offset for a summoned enemy from its summoner. If you manually
# set this in the note box, this value will not be used.
MAES_DEFAULT_Y_PLUS = 25
# This is the label code you need to put into a notebox. It is RegExp
MAES_NOTECODE = "\\SUMMON_ENEMY"
#==============================================================================
# ** RPG::Skill
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new methods - ma_call_ally?; ma_call_ally
#==============================================================================
class RPG::Skill
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Call Ally Skill?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_call_ally?
return self.note[/#{MAES_NOTECODE}\[\d+.*?\]/i] != nil
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Call Ally Stats
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_call_ally
miss = rand (100)
return nil if self.hit < miss
possibilities = []
note = self.note.dup
note.gsub! (/#{MAES_NOTECODE}\[(\d+)[,;]?\s*(-?\d*)[,;]?\s*(-?\d*)[,;]?\s*(\d*)\]/i) { |match|
id = $1.to_i
x = $2.empty? ? MAES_DEFAULT_X_PLUS : $2.to_i
y = $3.empty? ? MAES_DEFAULT_Y_PLUS : $3.to_i
percent = $4.empty? ? 1 : $4.to_i
(percent).times do possibilities.push ([id, x, y]) end
""
}
return *possibilities[rand(possibilities.size)]
end
end
#==============================================================================
# ** Game Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# attr_accessor - summon_count
# aliased method - initialize, skill_can_use?
#==============================================================================
class Game_Enemy
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_accessor :ma_summon_count
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias moda_clally_intz_7uj2 initialize
def initialize (*args)
@ma_summon_count = 0
moda_clally_intz_7uj2 (*args) # Run Original Method
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Skill Can Use?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias moral_caly_skllcnuse_6yh1 skill_can_use?
def skill_can_use? (skill, *args)
return false if skill.ma_call_ally? && $game_troop.members.size >= MAES_MAX_TROOP_SIZE
return moral_caly_skllcnuse_6yh1 (skill, *args)
end
end
#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - skill_can_use?
#==============================================================================
class Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Skill Can Use?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modbr_ess_skcnuse_7uj2 skill_can_use?
def skill_can_use? (skill, *args)
return false if skill.ma_call_ally?
return modbr_ess_skcnuse_7uj2 (skill, *args)
end
end
#==============================================================================
# ** Game Troop
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - ma_call_ally
#==============================================================================
class Game_Troop
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Call Ally
# user : the enemy using the skill
# enemy_id : the ID of the enemy being summoned
# x, y : screen coordinates to display enemy
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_call_ally (user, enemy_id, x, y)
user.ma_summon_count += 1
enemy = Game_Enemy.new (@enemies.size, enemy_id)
good_position = false
while !good_position
enemy.screen_x = user.screen_x + (x*user.ma_summon_count)
enemy.screen_y = user.screen_y + (y*user.ma_summon_count)
good_position = true
@enemies.each { |baddie|
if baddie.screen_x == enemy.screen_x && baddie.screen_y == enemy.screen_y
user.ma_summon_count += 1
good_position = false
end
}
end
@enemies.push(enemy)
make_unique_names
return enemy
end
end
#==============================================================================
# ** Spriteset_Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - ma_call_enemy
#==============================================================================
class Spriteset_Battle
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Call Enemy
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_call_enemy (battler)
@enemy_sprites.push(Sprite_Battler.new(@viewport1, battler))
end
end
#==============================================================================
# ** Scene_Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - execute_action_skill
#==============================================================================
class Scene_Battle
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Execute Action Skill
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malb_callally_exactsk_5hy1 execute_action_skill
def execute_action_skill (*args)
skill = @active_battler.action.skill
if skill.ma_call_ally?
enemy_id, x, y = skill.ma_call_ally
if enemy_id.nil?
text = sprintf (MAES_VOCAB_SUMMON_FAILURE, @active_battler.name)
@message_window.add_instant_text(text)
wait (30)
return
else
target = $game_troop.ma_call_ally (@active_battler, enemy_id, x, y)
@spriteset.ma_call_enemy (target)
display_animation([target], skill.animation_id)
end
end
malb_callally_exactsk_5hy1 (*args) # Run Original Method
end
end |