Night.png);">
Apprendre


Vous êtes
nouveau sur
Oniromancie?

Visite guidée
du site


Découvrir
RPG Maker

RM 95
RM 2000/2003
RM XP
RM VX/VX Ace
RM MV/MZ

Apprendre
RPG Maker

Tutoriels
Guides
Making-of

Dans le
Forum

Section Entraide

Tutos: Checklist de la composition (...) / Sorties: Dread Mac Farlane - episode 8 / Sorties: Dread Mac Farlane - episode 7 / Jeux: Ce qui vit Dessous / News: Quoi de neuf sur Oniromancie (...) / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

444 connectés actuellement

29382184 visiteurs
depuis l'ouverture

5 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

RPG Maker - La Communauté

RPG Maker VX

Lumen

Alex d'Or

Kingdom Ultimate

Tous nos partenaires

Devenir
partenaire



Butin de combat aléatoire

Quand l'ennemi est vaincu, vous récupérez un objet aléatoire selon la difficulté du combat comparé au prix de l'objet. Plusieurs options dans le script pour exclure certains objets.

Script pour RPG Maker XP
Ecrit par Deke
Publié par thomastop (lui envoyer un message privé)
Signaler un script cassé

❤ 0

Créez un script au dessus de main qui portera le nom "Scene_Battle 5", je vous prévient, ce script vient de là : http://www.rpgcreative.net/


Bon alors voilà le script :

Portion de code : Tout sélectionner

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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
#===========================================================
#class Scene_Battle 5
#----------------------------------------------------------------------------------------------------------------------
#-written by Deke
#----------------------------------------------------------------------------------------------------------------------
#
# The purpose of this class is to generate random loot drops at the end of winning battles.
#This script work independently of the item drops programed in for monsters. This script allows
#easy customization of the frequency and quality of loots by simple modifications of the configure
#method-see description below (how this script works) to see what each value does.
#
#Optional feature A-Don't drop weapons/armors/items with price 0
# This option makes it so that equipment with price 0 is excluded from being dropped by monsters
# at random. Some of the items in the database have a default price of zero and have no effect.
# They are really only for event processing purposes, they really should be dropped at random.
# This also creates an easy way to designate an weapon/armor/item as "non" droppable. Simply
# set the price of the equipment to 0. By default this option is set to true.
#
#Optional feature B- Don't drop "flagged" items
#Credit RPG Advocate for creating the elemental taggin trick
# Certain weapons/armors/ and items can be designated as unique (random monsters won't drop
# them). This option requires some addition script modification. It is only recommended if you
# want to have non droppable items that the player can sell back at a later time for profit. By default
# this option is set to off. See comments at the very end of this script for information on how
# to implement this option.
#
#Optional feature C-Debug mode
# This option is allows the game tester to see what weapons/items/armor have a potential of being
# dropped. After a victory, the list of possible weapons/items/armors is displayed. This allows the
# tester to determine if the value of the "quality percentage" should be modified. By default this
# option is off.
#
#============================================================
# HOW THIS SCRIPT WORKS
#-----------------------------------------------------------------------------------------------------------------------
# Basically this script creates sorted list of weapons, armor, and items from cheapest to most
#expensive. (Actually the list are of the equipment I.D.'s) It also creates a list of experience from
#monster from the fewest eqperience to the most experience. Then the program determines a
#percentile of difficultly" based on the experience gained versus the possible experienced gained from
#any monster.
# Next, the program generats some random numbers to determine if you the party gains any
#weapons/armors/items. If the party gains equipment the "percentile cost" of that equipment should
#roughly correlate with the percentile of difficulty. Basically, what this mean is that if you kill a monster
#that gives you more exp than 30% of the monsters and you succeed at getting equipment, the cost
#of the equipments will be higher than approximatley 30% of that equipment of that type. Of course,
#there are some random variations thrown to create variety.
# Here's a list of the variables to edit to customize loot dropping.
# @option_a and option_b: see above
# @weapon_per, @armor_per, @item_per
# the percentage change that the equipment drops after a succesful battle
# Remember that armor also includes shields and accesories, so the percentage should
# proabably be higher.
# @weapon_quality_per,@armor_quality_per,@item_quality_per
# This value determines how much variance there is loot drops.
# The lower the number, the closer the loot cost percentile correlates with the difficulty percentile.
# @two_weapon_per,@two_armor_per,@two_item_per
# the percentage change that two of that type of equipment drop.
# @loot_size
# the maximum number of loots allowable after a battle INCLUDING monster specific drops
 
 
#NOTE: If this program starts to lag- it doesn't with the standard size equipment list. You may want
# to change @weapon_set, @armor_set, and @item_set, AND @exp_set to global variables.
# Just use the find and replace feature and change @weapon_set to $weapon_set... Also change
# the statements if @weapon_set==nil to $weapon_set==[]. Finally, in the Scene_Title class
# add the following lines of code right after the begining of the main method:
# $weapon_set=[]
# $armor_set=[]
# $item_set=[]
# $exp_set=[]
#Making this change will mean that the sort funcitons only run the once in the game. Sorting functions
#have the potential to take up a lot of time if the size of the equipment arrays get larg.e
 
#==========================================================
class Scene_Battle
#--------------------------------------------------------------------------------------------------------------------
 
 
#---------------------------------------------------------------------------------------------------------------
#This method sets the values for such thing as dropped percentages.
def configure
@option_a=true
@option_b=false
if @option_b
@unique=20
end
@option_c=false
@weapon_prob=10
@two_weapon_prob=1
@armor_prob = 20
@two_armor_prob=2
@item_prob=12
@two_item_prob=2
@weapon_quality_per=12
@armor_quality_per=12
@item_quality_per=18
@loot_size=5
end
 
 
 
#-----------------------------------------------------------------------------------------------------------
#This metod overwrite start_phase5 from Scene_Battle 2. It is nearly identidcal, except that
#it call the methods to create random loot drops.
 
def start_phase5
@phase = 5
$game_system.me_play($game_system.battle_end_me)
$game_system.bgm_play($game_temp.map_bgm)
exp = 0
gold = 0
highest_exp=0
treasures = []
for enemy in $game_troop.enemies
unless enemy.hidden
exp += enemy.exp
if enemy.exp > highest_exp
highest_exp=enemy.exp
end
gold += enemy.gold
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
loot=random_treasure(highest_exp)
treasures +=loot
treasures = treasures[0..@loot_size]
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
$game_party.gain_gold(gold)
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
@result_window = Window_BattleResult.new(exp, gold, treasures)
@phase5_wait_count = 100
end
 
#-----------------------------------------------------------------------------------------------------------
def random_treasure(exp)
configure
loot=[]
num=0
max=0
if @weapon_set == nil
weapon_set
end
if @armor_set==nil
armor_set
end
if @item_set==nil
item_set
end
if @exp_set == nil
exp_set
end
rank=0
for i in 0...@exp_set.size
if exp >= @exp_set[i]
rank=i
end
end
@percentile = (rank/(@exp_set.size))
n=rand(100)
if n <= @weapon_prob
weapon=weapon_drop
loot.push(weapon)
end
if n <= @two_weapon_prob
weapon=weapon_drop
loot.push(weapon)
end
n=rand(100)
if n <= @armor_prob
armor=armor_drop
loot.push(armor)
end
if n <= @two_armor_prob
armor=armor_drop
loot.push(armor)
end
n=rand(100)
if n <= @item_prob
item=item_drop
loot.push(item)
end
if n <= @two_item_prob
item=item_drop
loot.push(item)
end 
return loot
end
 
#-------------------------------------------------------------------------------------------
#This method, if called, determins what weapon should be dropped based on the difficulty of the
#battle and the settings in the configure method.
def weapon_drop
min=(@percentile-@weapon_quality_per)*@weapon_set.size
max=(@percentile+@weapon_quality_per)*@weapon_set.size
max=(max/100).ceil
min=(min/100).floor
if min <0
min=0
end
if max > @weapon_set.size
max=@weapon_set.size
end
weapons_possible=@weapon_set[min..max]
if weapons_possible.size != 0
if @option_c
for i in 0...weapons_possible.size-1
weapon=$data_weapons[weapons_possible[i]]
print weapon.name
end
end 
index=rand(weapons_possible.size)
return $data_weapons[weapons_possible[index]]
else
mid = @percentile*@weapon_set.size
mic=(mid/100).ceil
return$data_weapons[mid]
end
end
 
#-------------------------------------------------------------------------------------------
#This method, if called, determins what armor should be dropped based on the difficulty of the
#battle and the settings in the configure method.
def armor_drop
min=(@percentile-@armor_quality_per)*@armor_set.size
max=(@percentile+@armor_quality_per)*@armor_set.size
max=(max/100).ceil
min=(min/100).floor
if min <0
min=0
end
if max > @armor_set.size
max=@armor_set.size
end
armors_possible=@armor_set[min..max]
if armors_possible.size != 0
if @option_c
for i in 0...armors_possible.size-1
armor=$data_armors[armors_possible[i]]
print armor.name
end
end 
index=rand(armors_possible.size)
return $data_armors[armors_possible[index]]
else
mid = @percentile*@armor_set.size
mic=(mid/100).ceil
return$data_armors[mid]
end
end
 
 
#-------------------------------------------------------------------------------------------
#This method, if called, determins what item should be dropped based on the difficulty of the
#battle and the settings in the configure method.
def item_drop
min=(@percentile-@item_quality_per)*@item_set.size
max=(@percentile+@item_quality_per)*@item_set.size
max=(max/100).ceil
min=(min/100).floor
if min <0
min=0
end
if max > @item_set.size
max=@item_set.size
end
items_possible=@item_set[min..max]
if items_possible.size != 0
if @option_c
for i in 0...items_possible.size
item=$data_items[items_possible[i]]
print item.name
end
end 
index=rand(items_possible.size)
return $data_items[items_possible[index]]
else
mid = @percentile*@item_set.size
mic=(mid/100).ceil
return$data_items[mid]
end
end
 
#--------------------------------------------------------------------------------------------------------------
#This method creates an array of weapon indexes from the cheapest to the most expensive, if
#they are not excluded by @option_a or @option_b.
def weapon_set
@weapon_set=[]
cheap_index=nil
for i in 1...$data_weapons.size
cheap_index=nil
cheapest=9999999
for j in 1...$data_weapons.size
eligible=true
weapon=$data_weapons[j]
if @weapon_set.include?(j)
eligible =false
end
if weapon.element_set.include?(@unique) and @option_b
eligible=false
end
if weapon.price ==0 and @option_a
eligible=false
end
if weapon.price < cheapest and eligible
cheapest=$data_weapons[j].price
cheap_index=j
end
end
if cheap_index != nil
@weapon_set.push(cheap_index)
end
end
end
 
#--------------------------------------------------------------------------------------------------------------
#This method creates an array of armor indexes from the cheapest to the most expensive, if
#they are not excluded by @option_a.
def armor_set
@armor_set=[]
cheap_index=nil
for i in 1...$data_armors.size
cheap_index=nil
cheapest=9999999
for j in 1...$data_armors.size
eligible=true
armor=$data_armors[j]
if @armor_set.include?(j)
eligible =false
end
if armor.guard_element_set.include?(@unique) and @option_b
eligible=false
end
if armor.price == 0 and @option_a
eligible=false
end
if armor.price < cheapest and eligible
cheapest=$data_armors[j].price
cheap_index=j
end
end
if cheap_index != nil
@armor_set.push(cheap_index)
end
end
end
 
#--------------------------------------------------------------------------------------------------------------
#This method creates an array of item indexes from the cheapest to the most expensive, if
#they are not excluded by @option_a or @option_b.
def item_set
@item_set=[]
cheap_index=nil
for i in 1...$data_items.size
cheap_index=nil
cheapest=9999999
for j in 1...$data_items.size
eligible=true
item=$data_items[j]
if @item_set.include?(j)
eligible =false
end
if item.element_set.include?(@unique) and @option_b
eligible=false
end
if item.price == 0 and @option_a
eligible=false
end
if item.price < cheapest and eligible
cheapest=$data_items[j].price
cheap_index=j
end
end
if cheap_index != nil
@item_set.push(cheap_index)
end
end
end
 
#-------------------------------------------------------------------------------------------
#This array creates a list of possible experience gained from all the monsters in the database,
#sorted from least experience to most experience.
def exp_set
@exp_set=[]
weak_index=nil
for i in 1...$data_enemies.size
weak_index=nil
weakest=9999999
for j in 1...$data_enemies.size
eligible=true
enemy=$data_enemies[j]
if @exp_set.include?(j)
eligible =false
end
if enemy.exp < weakest and eligible
weakest=enemy.exp
weak_index=j
end
end
if weak_index != nil
@exp_set.push(weak_index)
end
end
if @exp_set.size != 0
for i in 0...@exp_set.size
enemy = $data_enemies[@exp_set[i]]
@exp_set[i] = enemy.exp
end
end
end
 
end # of class definition
#-------------------------------------------------------------------------------------------------------------
#Further instructions for elemental tagging. First, read the description here:
#http://www.phylomortis.com/resource/script/tut001.html
#Add a new effect called "no drop" or "unique" then add the proper elements.delete command
#as instructed in code sample 2.
#Finally, set the value of @unique to the number of effect (probalby 17) if you didn't add any other effects.






worms6d - posté le 02/07/2010 à 15:34:06 (2 messages postés)

❤ 0

pas la peine de faire un script pour sa, voir, si tu utilise l'autre moyen sa sera plus beau :feu


Jakylla - posté le 06/08/2010 à 16:28:40 (45 messages postés)

❤ 0

Heureux

:avert2 En fait, ce n'est pas le code de devenir rouge aux dégâts mais le code de Gain aléatoire.

On c'est tous fait avoir ! Si on pouvait modifier le titre du mod ?

:grah2

Bienvenues à tous et bonne chance pour vos RPG !

Suite à de nombreux abus, le post en invités a été désactivé. Veuillez vous inscrire si vous souhaitez participer à la conversation.

Haut de page

Merci de ne pas reproduire le contenu de ce site sans autorisation.
Contacter l'équipe - Mentions légales

Plan du site

Communauté: Accueil | Forum | Chat | Commentaires | News | Flash-news | Screen de la semaine | Sorties | Tests | Gaming-Live | Interviews | Galerie | OST | Blogs | Recherche
Apprendre: Visite guidée | RPG Maker 95 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker MV | Tutoriels | Guides | Making-of
Télécharger: Programmes | Scripts/Plugins | Ressources graphiques / sonores | Packs de ressources | Midis | Eléments séparés | Sprites
Jeux: Au hasard | Notre sélection | Sélection des membres | Tous les jeux | Jeux complets | Le cimetière | RPG Maker 95 | RPG Maker 2000 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker VX Ace | RPG Maker MV | Autres | Proposer
Ressources RPG Maker 2000/2003: Chipsets | Charsets | Panoramas | Backdrops | Facesets | Battle anims | Battle charsets | Monstres | Systems | Templates
Ressources RPG Maker XP: Tilesets | Autotiles | Characters | Battlers | Window skins | Icônes | Transitions | Fogs | Templates
Ressources RPG Maker VX: Tilesets | Charsets | Facesets | Systèmes
Ressources RPG Maker MV: Tilesets | Characters | Faces | Systèmes | Title | Battlebacks | Animations | SV/Ennemis
Archives: Palmarès | L'Annuaire | Livre d'or | Le Wiki | Divers