❤ 0 Auteur : Fomar0153
Logiciel : RPG Maker VX Ace
Nombre de scripts : 3
Source : http://cobbtocs.co.uk/wp/?p=155 (remerciements à Fomar0153 et NOZVEZ)
Conditions d'utilisation
- Vous devez créditer l'auteur
- Vous pouvez utiliser ce script dans vos projets commerciaux
- Vous pouvez partager ce script tant que vous créditez l'auteur
Bonjour a tous, Ceci est une trouvaille fort intéressante pour nous les créateurs à qui je pense pourra peut ètre vous aider, avec script a la main et actuce j'ai fait en sorte de répondre a vos question les plus probables comme "Où doit-on le mettre?" ou "Comment fait-on pour avoir que l'arme ameliorable ou l'inverse".
Alors pour commencer, vous avez besoin des 3 codes différents pour arriver au point de la fonction "level Weapon".
le premier est la modification d'équipement (il le rend unique et modifiable en plein jeu) C'est la base des programme d'équipement pour modifier.
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
| =begin
Individual Equipment
by Fomar0153
Version 1.1
----------------------
Notes
----------------------
This script changes the way weapons and armours are handled
in game. This script make every weapon and armour unique.
----------------------
Instructions
----------------------
Plug and play.
If you want to be able to carry more than 150 weapons and 150 armors
edit MAX_INVENTORY_SIZE which you can find at the top of the script.
This script is designed to be a base for other scripts.
For example:
Proper Weapon and Armour Customisation.
----------------------
Change Log
----------------------
1.0 -> 1.1 Added a single character (@) to fix a bug where you
created new equipment when changing equipment.
----------------------
Known bugs
----------------------
None
=end
module CustomEquip
MAX_INVENTORY_SIZE = 150
end
class Game_CustomEquip < Game_BaseItem
#--------------------------------------------------------------------------
# ● New attr_accessor & attr_reader
#--------------------------------------------------------------------------
attr_accessor :pos
attr_reader :item_id
#--------------------------------------------------------------------------
# ● Pos is used to identify weapons and armors
#--------------------------------------------------------------------------
def initialize
super
@pos = 0
end
#--------------------------------------------------------------------------
# ● The rest of the methods allow this item to pretend to be RPG::Weapon
# and RPG::Armor in some cases, increasing compatability, thought not
# as much as I would like.
#--------------------------------------------------------------------------
def description
return nil if is_nil?
return object.description
end
def name
return nil if is_nil?
return object.name
end
def icon_index
return nil if is_nil?
return object.icon_index
end
def price
return nil if is_nil?
return object.price
end
def animation_id
return nil if is_nil?
return nil if is_armor? # variable only exists for RPG::Weapon
return object.animation_id
end
def note
return nil if is_nil?
return object.note
end
def id
return nil if is_nil?
return object.id
end
def features
return nil if is_nil?
return object.features
end
def params
return nil if is_nil?
return object.params
end
def etype_id
return nil if is_nil?
return object.etype_id
end
def wtype_id
return nil if is_nil?
return nil if is_armor? # variable only exists for RPG::Weapon
return object.wtype_id
end
def atype_id
return nil if is_nil?
return nil if is_weapon? # variable only exists for RPG::Armor
return object.atype_id
end
# performance returns an integer calculated from the equip item's params.
# each point in a param increasing performance by one, except
# for attack and magic on weapon which counts double
# for defence and magic defence on armours which counts double
def performance
return nil if is_nil?
return object.performance
end
end
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● Aliases init_all_items
#--------------------------------------------------------------------------
alias ie_init_all_items init_all_items
def init_all_items
ie_init_all_items
@weapons = []
@armors = []
end
#--------------------------------------------------------------------------
# ● Rewrites weapons
#--------------------------------------------------------------------------
def weapons
return @weapons
end
#--------------------------------------------------------------------------
# ● Rewrites armors
#--------------------------------------------------------------------------
def armors
return @armors
end
#--------------------------------------------------------------------------
# ● Aliases item_number + Probably rewrite
#--------------------------------------------------------------------------
alias ie_item_number item_number
def item_number(item)
if item.class == RPG::Weapon or item.class == RPG::Armor
return 1 # I haven't found this to cause unexpected behaviour
# but I don't like it
else
return ie_item_number(item)
end
end
#--------------------------------------------------------------------------
# ● Aliases gain_item
#--------------------------------------------------------------------------
alias ie_gain_item gain_item
def gain_item(item, amount, include_equip = false)
if item.class == RPG::Weapon
if amount > 0
for i in 1..amount
t = Game_CustomEquip.new
t.object = item
@weapons.push(t)
end
weapon_sort
end
elsif item.is_a?(Game_CustomEquip) && item.is_weapon?
if amount == 1
@weapons.push(item)
weapon_sort
elsif amount == -1
# Can't sell more than 1 at a time
# (is there any other way to remove more than 1 at a time?
# except through events?)
@weapons.delete_at(item.pos)
weapon_sort
end
elsif item.class == RPG::Armor
if amount > 0
for i in 1..amount
t = Game_CustomEquip.new
t.object = item
@armors.push(t)
end
armor_sort
end
elsif item.is_a?(Game_CustomEquip) && item.is_armor?
if amount == 1
@armors.push(item)
armor_sort
elsif amount == -1
# Can't sell more than 1 at a time
# (is there any other way to remove more than 1 at a time?
# except through events?)
@armors.delete_at(item.pos)
armor_sort
end
else
ie_gain_item(item, amount, include_equip)
return
end
$game_map.need_refresh = true
end
def weapon_sort
@weapons.sort! { |a, b| a.item_id <=> b.item_id }
for i in 0..@weapons.size - 1
@weapons[i].pos = i
end
end
def armor_sort
@armors.sort! { |a, b| a.item_id <=> b.item_id }
for i in 0..@armors.size - 1
@armors[i].pos = i
end
end
alias ie_max_item_number max_item_number
def max_item_number(item)
if item.class == RPG::Weapon
return CustomEquip::MAX_INVENTORY_SIZE - @weapons.size
elsif item.class == RPG::Armor
return CustomEquip::MAX_INVENTORY_SIZE - @armors.size
else
return ie_max_item_number(item)
end
end
end
class Window_ItemList < Window_Selectable
alias ie_include? include?
def include?(item)
case @category
when :weapon
item.is_a?(Game_CustomEquip) && item.object.is_a?(RPG::Weapon)
when :armor
item.is_a?(Game_CustomEquip) && item.object.is_a?(RPG::Armor)
else
ie_include?(item)
end
end
alias ie_draw_item draw_item
def draw_item(index)
item = @data[index]
if item && !item.is_a?(Game_CustomEquip)
ie_draw_item(index)
elsif item && item.is_a?(Game_CustomEquip)
rect = item_rect(index)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enable?(item))
#draw_item_number(rect, item) just this line removed from the default
end
end
end
class Window_EquipItem < Window_ItemList
#--------------------------------------------------------------------------
# ● Aliases include?
#--------------------------------------------------------------------------
alias ie2_include? include?
def include?(item)
return true if item == nil
return false unless item.is_a?(Game_CustomEquip)
return ie2_include?(item.object)
end
#--------------------------------------------------------------------------
# ● Rewrites update_help
#--------------------------------------------------------------------------
def update_help
super
if @actor && @status_window
temp_actor = Marshal.load(Marshal.dump(@actor))
temp_actor.force_change_equip(@slot_id, item) unless item.nil?
@status_window.set_temp_actor(temp_actor)
end
end
end
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● Rewrites init_equips
#--------------------------------------------------------------------------
def init_equips(equips)
@equips = Array.new(equip_slots.size) { Game_CustomEquip.new } # only change
equips.each_with_index do |item_id, i|
etype_id = index_to_etype_id(i)
slot_id = empty_slot(etype_id)
@equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
end
refresh
end
#--------------------------------------------------------------------------
# ● Rewrites change_equip
#--------------------------------------------------------------------------
def change_equip(slot_id, item)
return unless trade_item_with_party(item, @equips[slot_id])
return if item && equip_slots[slot_id] != item.etype_id
if item.nil?
@equips[slot_id] = Game_CustomEquip.new
else
@equips[slot_id] = item
end
refresh
end
#--------------------------------------------------------------------------
# ● Rewrites force_change_equip
#--------------------------------------------------------------------------
def force_change_equip(slot_id, item)
if item.nil?
@equips[slot_id] = Game_CustomEquip.new
else
@equips[slot_id] = item
end
release_unequippable_items(false)
refresh
end
#--------------------------------------------------------------------------
# ● Rewrites trade_item_with_party
#--------------------------------------------------------------------------
def trade_item_with_party(new_item, old_item)
#return false if new_item && !$game_party.has_item?(new_item) removed
$game_party.gain_item(old_item, 1)
$game_party.lose_item(new_item, 1)
return true
end
#--------------------------------------------------------------------------
# ● Rewrites change_equip_by_id
#--------------------------------------------------------------------------
def change_equip_by_id(slot_id, item_id)
if equip_slots[slot_id] == 0
t = Game_CustomEquip.new
t.object = $data_weapons[item_id]
$game_party.gain_item(t, 1)
change_equip(slot_id, t)
else
t = Game_CustomEquip.new
t.object = $data_armors[item_id]
$game_party.gain_item(t, 1)
change_equip(slot_id, t)
end
end
#--------------------------------------------------------------------------
# ● Rewrites optimize_equipments or does it
#--------------------------------------------------------------------------
def optimize_equipments
clear_equipments
equip_slots.size.times do |i|
next if !equip_change_ok?(i)
items = $game_party.equip_items.select do |item|
item.etype_id == equip_slots[i] &&
equippable?(item.object) && item.performance >= 0
end
change_equip(i, items.max_by {|item| item.performance })
end
end
end
class Window_ShopStatus < Window_Base
alias ie_draw_possession draw_possession
def draw_possession(x, y)
return if @item.is_a?(RPG::EquipItem)
ie_draw_possession(x, y)
end
alias ie_draw_equip_info draw_equip_info
def draw_equip_info(x, y)
ie_draw_equip_info(x, y - line_height * 2)
end
end |
Le second est le système des AP qui vous permet d'aquérir le système de "points d'expériences d'armes".
(nécessaire pour augmenter les armes, sinon sans ce programme vous ne pourrez pas monter les levels.
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
| =begin
AP System Script II
by Fomar0153
Version 1.0
----------------------
Notes
----------------------
No requirements
Implements an ap system for you to use when creating skill
systems that utilise AP.
----------------------
Instructions
----------------------
Notetag <ap x> e.g. <ap 4> <ap 100>
----------------------
Known bugs
----------------------
None
=end
module Vocab
ObtainAp = "%s AP was obtained!"
end
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● New Method gain_ap
#--------------------------------------------------------------------------
def gain_ap(ap)
# your code goes here
end
end
module BattleManager
#--------------------------------------------------------------------------
# ● Rewrote self.display_exp
#--------------------------------------------------------------------------
def self.display_exp
if $game_troop.exp_total > 0
text = sprintf(Vocab::ObtainExp, $game_troop.exp_total)
$game_message.add('\.' + text)
end
if $game_troop.ap_total > 0
text = sprintf(Vocab::ObtainAp, $game_troop.ap_total)
$game_message.add('\.' + text)
end
end
#--------------------------------------------------------------------------
# ● Rewrote self.gain_exp
#--------------------------------------------------------------------------
def self.gain_exp
$game_party.all_members.each do |actor|
actor.gain_exp($game_troop.exp_total)
end
wait_for_message
$game_party.all_members.each do |actor|
actor.gain_ap($game_troop.ap_total)
end
wait_for_message
end
end
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# ● New Method ap_total
#--------------------------------------------------------------------------
def ap_total
dead_members.inject(0) {|r, enemy| r += enemy.ap }
end
end
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● New Method ap_total
#--------------------------------------------------------------------------
def ap
if enemy.note =~ /<ap (.*)>/i
return $1.to_i
else
return 0
end
end
end |
Le troisième est le plus important qui est "level equipement" qui est la base du fonctionnement et du rapprochement des deux autres codes:
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
| =begin
Equipment Levels Up
by Fomar0153
Version 1.0
----------------------
Notes
----------------------
This script allows weapons to grow stronger and level up when they
gain exp or ap.
----------------------
Instructions
----------------------
Requires my individual equipment script. (Make sure it is version 1.1+)
Requires an AP script if leveling weapons using AP.
Customise the variables in the module below to set up the script to your
liking.
Notetags
<maxlevel x> - adds a non-default max level to the tagged equipment.
----------------------
Known bugs
----------------------
None
=end
module Fomar
# If you only want to implement this for weapons or armours set
# the following to false as you see fit
WLU_WEAPONS_LEVEL_UP = true
WLU_ARMOURS_LEVEL_UP = true
# This script can be set up to use either EXP or AP
# For AP you will also need an AP system.
# true -> uses AP
# false -> uses EXP
WLU_USE_AP = false
# Determines the order of the substitutions
# true -> level, name
# false -> name, level
WLU_PREFIX = false
# the %s are replaced by the level and name of the weapon
WLU_VOCAB_WEAPON_NAME = "%s LV %s"
# Default max level
# set to 0 to only allow chosen weapons to level up
WLU_DEF_MAX_LEVEL = 5
# Default stat increase per level (percentage)
WLU_DEF_PARAM_INC = 25
# Set to false if you want the price of the item to be unaffected
# by leveling up
WLU_PRICE_LEVEL_UP = true
# Default experience per level
# I have provided two defaults, one designed for EXP and one for AP
def self.WLU_EXP_FOR_LEVEL(item); return item.performance * 10; end
def self.WLU_AP_FOR_LEVEL(item); return item.performance; end
end
class Game_CustomEquip < Game_BaseItem
alias wlu_initialize initialize
def initialize
wlu_initialize
@exp = 0
@level = 1
end
def gain_exp(exp)
return unless levels?
@exp += exp
last_level = @level
unless Fomar::WLU_USE_AP
while @exp >= @level * Fomar.WLU_EXP_FOR_LEVEL(object) and @level < object.max_level
@level += 1
$game_message.add(object.name + " levels up.")
end
else
while @exp >= @level * Fomar.WLU_AP_FOR_LEVEL(object) and @level < object.max_level
@level += 1
$game_message.add(object.name + " levels up.")
end
end
end
def levels?
return false if is_nil?
return (((is_weapon? and Fomar::WLU_WEAPONS_LEVEL_UP) or
(is_armor? and Fomar::WLU_ARMOURS_LEVEL_UP)) and
object.max_level > 0)
end
alias wlu_name name
def name
return nil if is_nil?
return wlu_name unless levels?
return sprintf(Fomar::WLU_VOCAB_WEAPON_NAME,@level,wlu_name) if Fomar::WLU_PREFIX
return sprintf(Fomar::WLU_VOCAB_WEAPON_NAME,wlu_name,@level)
end
alias wlu_price price
def price
return nil if is_nil?
return wlu_price unless levels?
return wlu_price unless Fomar::WLU_PRICE_LEVEL_UP
return (100 + Fomar::WLU_DEF_PARAM_INC * @level + object.price)/100
end
def params
return nil if is_nil?
par = object.params.clone
for i in 0..par.size - 1
par[i] *= 100 + Fomar::WLU_DEF_PARAM_INC * (@level - 1)
par[i] /= 100
end
return par
end
alias wlu_performance performance
def performance
return nil if is_nil?
return wlu_performance unless levels?
par = params
p = 0
for pa in par
p += pa
end
if is_weapon?
p += par[2] + par[4]
else
p += par[3] + par[5]
end
return p
end
end
module RPG
class EquipItem
def max_level
if self.note =~ /<maxlevel (.*)>/i
return $1.to_i
else
return Fomar::WLU_DEF_MAX_LEVEL
end
end
end
end
class Game_Actor < Game_Battler
alias wlu_gain_exp gain_exp
def gain_exp(exp)
for equip in @equips
equip.gain_exp(exp)
end
wlu_gain_exp(exp)
end
def gain_ap(ap)
for equip in @equips
equip.gain_exp(ap)
end
end
def custom_equips
return @equips
end
# rewrites param_plus
def param_plus(param_id)
p = super(param_id)
for equip in @equips
p += equip.params[param_id] unless equip.is_nil?
end
return p
end
end
class Window_Base < Window
alias wlu_draw_item_name draw_item_name
def draw_item_name(item, x, y, enabled = true, width = 172)
return unless item
if item.is_a?(Game_CustomEquip)
return if item.is_nil?
end
wlu_draw_item_name(item, x, y, enabled = true, width)
end
end
class Window_EquipSlot < Window_Selectable
# rewrites draw_item
def draw_item(index)
return unless @actor
rect = item_rect_for_text(index)
change_color(system_color, enable?(index))
draw_text(rect.x, rect.y, 92, line_height, slot_name(index))
draw_item_name(@actor.custom_equips[index], rect.x + 92, rect.y, enable?(index))
end
end |
Voila les trois codes. Pour l'insérer, allez dans "Script" dans le logiciel Rpg Maker VX ACE et insérer le dans "Materials" ou "Main Process", et voila vous aviez le mode "Level Equipement" a vos mains.
Modification utiles:
Si vous tenez a ce que ce sois seulement vos armes qui s'améliore ou seulement vos armures, aller a la ligne
30 du 3ème Script de la liste que je vous ai donné qui est "level equipement":
1
2
3
4
| # If you only want to implement this for weapons or armours set
# the following to false as you see fit
WLU_WEAPONS_LEVEL_UP = true
WLU_ARMOURS_LEVEL_UP = true |
Si vous voulez retirer Weapons pour arme vous mettez à la place de true "False" pour le retirer ( facile non?)
ainsi que pour Armours (qui est armures) vous faites pareils.
Voila bonne chance a tous pour vos futurs jeux...
|