Naruto-bunk
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.

Naruto-bunk

nouveaux site naruto pleins de roms,emulateur,rpg maker,mugen,ect
 
AccueilAccueil  PortailPortail  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  Connexion  
Le deal à ne pas rater :
Jeux, jouets et Lego : le deuxième à -50% (large sélection)
Voir le deal

 

 un objet aléatoire à la fin de combat

Aller en bas 
AuteurMessage
Naruto
Hokage
Hokage
Naruto


Nombre de messages : 58
Date d'inscription : 18/03/2006

un objet aléatoire à la fin de combat Empty
MessageSujet: un objet aléatoire à la fin de combat   un objet aléatoire à la fin de combat EmptyVen 22 Sep - 20:29

Auteur : InconnuFonction : Permet de donner un objet aléatoire à la fin de combat
Image(s): Aucune
Ressource(s) : aucune
Remarque : Testé et fonctionnel.
Installation : Allez dans l'éditeur de script ( F11 ) et créez un script au dessus de "Main" , nommez le " Scene_Battle 5 " et collez ce script.

#===========================================================
#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

#-------------------------------------------------------------------------------------------
Revenir en haut Aller en bas
https://naruto-bunk.1fr1.net
Naruto
Hokage
Hokage
Naruto


Nombre de messages : 58
Date d'inscription : 18/03/2006

un objet aléatoire à la fin de combat Empty
MessageSujet: Re: un objet aléatoire à la fin de combat   un objet aléatoire à la fin de combat EmptyVen 22 Sep - 20:31

a la suite

#-------------------------------------------------------------------------------------------
#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.
Revenir en haut Aller en bas
https://naruto-bunk.1fr1.net
 
un objet aléatoire à la fin de combat
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Naruto-bunk :: Rpg Maker :: Script-
Sauter vers:  
Ne ratez plus aucun deal !
Abonnez-vous pour recevoir par notification une sélection des meilleurs deals chaque jour.
IgnorerAutoriser