SHOW:
|
|
- or go back to the newest paste.
1 | ###--------------------------------------------------------------------------### | |
2 | - | # Equipment and Skill Check Scriptlet # |
2 | + | # Equipment and Skill Check Ace Scriptlet # |
3 | # Version 1.0 # | |
4 | # # | |
5 | # Credits: # | |
6 | - | # Request by: EvilEagles # |
6 | + | # Original code by: Neonblack # |
7 | - | # Original code by: NeonBlack # |
7 | + | |
8 | # # | |
9 | # This work is licensed under the Creative Commons Attribution 3.0 Unported # | |
10 | # License. To view a copy of this license, visit # | |
11 | # http://creativecommons.org/licenses/by/3.0/. # | |
12 | ###--------------------------------------------------------------------------### | |
13 | ||
14 | ###--------------------------------------------------------------------------### | |
15 | # Revision information: # | |
16 | # V1.0 - 4.15.2012 # | |
17 | - | # V1.0 - 4.5.2012 ~ 4.15.2012 # |
17 | + | # Converted from VX # |
18 | - | # Wrote and debugged main script # |
18 | + | |
19 | ||
20 | ###--------------------------------------------------------------------------### | |
21 | # Instructions: # | |
22 | # This snippet adds the simple function to evaluate certain properties # | |
23 | # related to the party that were not previously available. These include # | |
24 | # such things as checking if the party has particular items or weapons or # | |
25 | # checking certain stats. This can be used with script calls, in actual # | |
26 | # scripts, or with the conditional branch script option. This is meant to # | |
27 | # be a scripters resource. # | |
28 | ###----- -----### | |
29 | # Usage: # | |
30 | # # | |
31 | # Check.armour(x[, y]) -or- Check.armor(x[, y]) # | |
32 | # - Used to check if the party has a particular piece of armour equipped # | |
33 | # or not. Use "x" to define the ID of the armour to check for. "y" is # | |
34 | # an optional value and does not need to be defined. If "y" is "true" # | |
35 | # then the ENTIRE party must be wearing the armour. By default it is # | |
36 | # false. # | |
37 | # # | |
38 | # Check.weapon(x[, y]) # | |
39 | # - Used to check if the party has a particular weapon equipped or not. # | |
40 | # Use "x" to define the ID of the weapon to check for. "y" is an # | |
41 | # optional value and does not need to be defined. If "y" is "true" # | |
42 | # then the ENTIRE party must be wearing the weapon. By default it is # | |
43 | # false. # | |
44 | # # | |
45 | # Check.skill(x[, y]) # | |
46 | # - Used to check if the party has a particular skill learned or not. # | |
47 | # Use "x" to define the ID of the skill to check for. "y" is an # | |
48 | # optional value and does not need to be defined. If "y" is "true" # | |
49 | # then the ENTIRE party must have learned the skill. By default it is # | |
50 | # false. # | |
51 | # # | |
52 | # Check.state(x[, y]) # | |
53 | # - Used to check if the party has a particular state afflicted or not. # | |
54 | # Use "x" to define the ID of the state to check for. "y" is an # | |
55 | # optional value and does not need to be defined. If "y" is "true" # | |
56 | # then the ENTIRE party must be afflicted with the state. By default # | |
57 | # it is false. # | |
58 | # # | |
59 | # Check.stat[(x, y)] # | |
60 | # - Used to check the value of a certain stat. Replace "stat" with one # | |
61 | # of the following: # | |
62 | # atk, def, mat, mdf, agi, luk, hit, eva, cri, cev, mev, mrf, cnt, # | |
63 | - | # atk, def, spi, agi, maxhp, maxmp, hit, eva, cri, level, # |
63 | + | # hp, mp, mhp, mmp, perhp, permp, level # |
64 | - | # hp, mp, perhp, permp # |
64 | + | |
65 | # This method returns an integer rather than true or false. There are # | |
66 | # two arguments that can be used. "x" defines the range of the value # | |
67 | # to return where -1 = return lowest, 0 = return average, and # | |
68 | # 1 = return highest. Be default, the highest value is returned. # | |
69 | # "y" defines the variable to return the value to. This can be useful # | |
70 | # if you want to tell the player one of these values. # | |
71 | ###--------------------------------------------------------------------------### | |
72 | ||
73 | - | # Check.song(x) -requires Neonblack's Ocarina script v2.0 or higher- # |
73 | + | |
74 | - | # - Used to check if the player has learned a certain song. Remember # |
74 | + | |
75 | - | # that this script uses 1 as the lowest number song rather than 0. # |
75 | + | |
76 | - | # Returns either true or false. # |
76 | + | |
77 | # Modify at your own risk! # | |
78 | - | # Check.lockpicks -requires Neonblack's Lockpick script v1.2 or higher- # |
78 | + | |
79 | - | # - Used to check if the party has any lockpicks. Does not check for the # |
79 | + | |
80 | - | # gold lockpick. Returns the number of lockpicks as an integer. # |
80 | + | |
81 | ||
82 | - | # Check.goldpick -requires Neonblack's Lockpick script v1.2 or higher- # |
82 | + | |
83 | - | # - Used to check if the party has the gold lockpick. If the creator has # |
83 | + | |
84 | - | # opted not to use the gold lockpick, a value of "false" is returned. # |
84 | + | |
85 | end | |
86 | ||
87 | def self.armour(check_arm, all = false) | |
88 | for i in 0...$game_party.members.size | |
89 | chars = $game_party.members[i] | |
90 | result = (chars.armors.include?($data_armors[check_arm])) | |
91 | break if result == true unless all | |
92 | break if result == false if all | |
93 | end | |
94 | return result | |
95 | end | |
96 | ||
97 | def self.weapon(check_wep, all = false) | |
98 | for i in 0...$game_party.members.size | |
99 | chars = $game_party.members[i] | |
100 | result = (chars.weapons.include?($data_weapons[check_wep])) | |
101 | break if result == true unless all | |
102 | break if result == false if all | |
103 | end | |
104 | return result | |
105 | end | |
106 | ||
107 | def self.skill(check_ski, all = false) | |
108 | for i in 0...$game_party.members.size | |
109 | chars = $game_party.members[i] | |
110 | result = (chars.skill_learn?($data_skills[check_ski])) | |
111 | break if result == true unless all | |
112 | break if result == false if all | |
113 | end | |
114 | return result | |
115 | end | |
116 | ||
117 | def self.state(check_sta, all = false) | |
118 | for i in 0...$game_party.members.size | |
119 | chars = $game_party.members[i] | |
120 | result = (chars.state?(check_sta)) | |
121 | break if result == true unless all | |
122 | break if result == false if all | |
123 | end | |
124 | return result | |
125 | end | |
126 | ||
127 | def self.atk(lah = 1, var = nil) | |
128 | return cstat(1, lah, var) | |
129 | end | |
130 | ||
131 | def self.def(lah = 1, var = nil) | |
132 | return cstat(2, lah, var) | |
133 | end | |
134 | ||
135 | def self.mat(lah = 1, var = nil) | |
136 | return cstat(3, lah, var) | |
137 | end | |
138 | ||
139 | def self.mdf(lah = 1, var = nil) | |
140 | return cstat(4, lah, var) | |
141 | end | |
142 | ||
143 | def self.agi(lah = 1, var = nil) | |
144 | return cstat(5, lah, var) | |
145 | end | |
146 | ||
147 | def self.luk(lah = 1, var = nil) | |
148 | return cstat(6, lah, var) | |
149 | - | def self.spi(lah = 1, var = nil) |
149 | + | |
150 | ||
151 | def self.mhp(lah = 1, var = nil) | |
152 | return cstat(7, lah, var) | |
153 | end | |
154 | ||
155 | def self.mmp(lah = 1, var = nil) | |
156 | return cstat(8, lah, var) | |
157 | - | def self.maxhp(lah = 1, var = nil) |
157 | + | |
158 | ||
159 | def self.hit(lah = 1, var = nil) | |
160 | return cstat(9, lah, var) | |
161 | - | def self.maxmp(lah = 1, var = nil) |
161 | + | |
162 | ||
163 | def self.eva(lah = 1, var = nil) | |
164 | return cstat(10, lah, var) | |
165 | end | |
166 | ||
167 | def self.cri(lah = 1, var = nil) | |
168 | return cstat(11, lah, var) | |
169 | end | |
170 | ||
171 | def self.cev(lah = 1, var = nil) | |
172 | return cstat(12, lah, var) | |
173 | end | |
174 | ||
175 | def self.mev(lah = 1, var = nil) | |
176 | return cstat(13, lah, var) | |
177 | end | |
178 | ||
179 | def self.mrf(lah = 1, var = nil) | |
180 | return cstat(14, lah, var) | |
181 | end | |
182 | ||
183 | def self.cnt(lah = 1, var = nil) | |
184 | return cstat(15, lah, var) | |
185 | end | |
186 | ||
187 | def self.hp(lah = 1, var = nil) | |
188 | return cstat(16, lah, var) | |
189 | end | |
190 | ||
191 | def self.mp(lah = 1, var = nil) | |
192 | return cstat(17, lah, var) | |
193 | end | |
194 | ||
195 | def self.level(lah = 1, var = nil) | |
196 | return cstat(100, lah, var) | |
197 | end | |
198 | ||
199 | def self.perhp(lah = 1, var = nil) | |
200 | return cstat(101, lah, var) | |
201 | end | |
202 | ||
203 | def self.permp(lah = 1, var = nil) | |
204 | return cstat(102, lah, var) | |
205 | end | |
206 | ||
207 | def self.cstat(stat, lah, var) | |
208 | var = nil if var < 1 | |
209 | vi = 0 | |
210 | si = $game_party.members.size | |
211 | for i in 0...$game_party.members.size | |
212 | chars = $game_party.members[i] | |
213 | vn = rstat(stat, chars) | |
214 | case lah | |
215 | when 0 | |
216 | vi = vn if vn < vi or vi == 0 | |
217 | when 1 | |
218 | vi += vn | |
219 | when 2 | |
220 | vi = vn if vi < vn | |
221 | end | |
222 | end | |
223 | vi /= si if lah == 1 | |
224 | $game_variables[var] = Integer(vi) if var != nil | |
225 | - | return chars.spi |
225 | + | |
226 | end | |
227 | ||
228 | def self.rstat(stat, chars) | |
229 | - | return chars.maxhp |
229 | + | |
230 | when 1 | |
231 | - | return chars.maxmp |
231 | + | |
232 | when 2 | |
233 | return chars.def | |
234 | when 3 | |
235 | return chars.mat | |
236 | when 4 | |
237 | return chars.mdf | |
238 | when 5 | |
239 | return chars.agi | |
240 | when 6 | |
241 | return chars.luk | |
242 | when 7 | |
243 | return chars.mhp | |
244 | when 8 | |
245 | return chars.mmp | |
246 | - | ms = chars.maxhp |
246 | + | |
247 | return chars.hit | |
248 | when 10 | |
249 | return chars.eva | |
250 | when 11 | |
251 | - | ms = chars.maxmp |
251 | + | |
252 | when 12 | |
253 | return chars.cev | |
254 | when 13 | |
255 | return chars.mev | |
256 | when 14 | |
257 | - | if $imported["CP_OCARINA"] |
257 | + | return chars.mrf |
258 | - | def self.song(num) |
258 | + | when 15 |
259 | - | result = $data_songs[num - 1][2] |
259 | + | return chars.cnt |
260 | - | return result |
260 | + | when 16 |
261 | return chars.hp | |
262 | when 17 | |
263 | return chars.mp | |
264 | - | if $imported["CP_LOCKPICK"] |
264 | + | |
265 | - | def self.lockpicks |
265 | + | |
266 | - | itemnum = CP::LOCKPICK::SETTINGS::PICK_ITEM |
266 | + | |
267 | - | result = $game_party.item_number($data_items[itemnum]) |
267 | + | |
268 | - | return result |
268 | + | ms = chars.mhp |
269 | rs = cs * 100 / ms | |
270 | - | |
270 | + | |
271 | - | def self.goldpick |
271 | + | |
272 | - | itemnum = CP::LOCKPICK::SETTINGS::PICK_ITEM |
272 | + | |
273 | - | usegp = CP::LOCKPICK::SETTINGS::USE_G_PICK |
273 | + | ms = chars.mmp |
274 | - | result = false |
274 | + | |
275 | - | result = $game_party.has_item?($data_items[itemnum]) if usegp |
275 | + | |
276 | - | return result |
276 | + | |
277 | end | |
278 | end | |
279 | ||
280 | # I overcomplicate things, no? | |
281 | ###--------------------------------------------------------------------------### | |
282 | # End of script. # | |
283 | ###--------------------------------------------------------------------------### |