Auteur : ASHKA
Nombre de script : 1
Info : Voici la version " ultime " pour avoir un systeme ou plus on utilise un type d'arme, plus on fait de degats avec ce type d'arme et ou plus on utilise une competence, plus elle inflige de degats !!
Créer un nouveau script dans " Materials " et collez y ceci :
# Systeme d'evolution arme / competence
# Dans l'onglet " System " de la base de donnée, créer autant d'attribut que vous
# aurez de type d'arme dans votre jeu. Associé ces attributs aux armes qu'il
# represente dans l'onglet " Weapon ". ( Pensez à configurer la liste ci-dessous !! )
# Plus un héros utilisera un type d'arme, plus il fera de degat avec ce type d'arme.
module Maitrise
# Ci-dessous : Liste des attributs associé à un type d'arme
# Il faut respecter l'ordre des elements dans chaque tableau !!
TABLE_ATTRIBUT = [20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
# Ce tableau sert à associé un icone à chaque type d'arme :
# L'ordre est egalement le même que celui du tableau TABLE_ATTRIBUT !!
# Chaque bloc est constitué comme ceci :
# [colonne de l'icone, ligne de l'icone]
# En comptant à partir de 0
TABLE_ICONE = [[11, 0], [3, 3], [8, 0], [3, 0], [10, 1], [4, 0], [14, 1], [3, 1], [5, 1], [0, 1]]
# Ce tableau sert à determiné les noms des differentes catégories d'arme.
# L'ordre est egalement le même que celui du tableau TABLE_ATTRIBUT !!
TABLE_NOM = ["Griffe", "Gants", "Dague", "Epée", "Epée lourde", "Lance", "Hache", "Marteau", "Baton", "Arc"]
# Exp gagné à chaque utilisation du type d'arme ( Atk normale )
EXP_ARME = 3
# Montant d'exp necessaire par niveau ( fixe )
EXP_NEED_ARME = 100
# Bonus gagné par niveau ( 0.2 par niveau => degat doublé au niveau de maitrise 5 )
BONUS_ARME = 0.2
# Somme d'exp gagné à chaque utilisation de la competence
EXP_SKILL = 5
# Montant d'exp necessaire pour passer au niveau superieur ( fixe )
EXP_NEED_SKILL = 100
# Augmentation de la puissance par niveau ( si 0.2, degats doublé apres 5 niveaux )
BONUS_SKILL = 0.2
end
class Game_Battler
def make_attack_damage_value(attacker)
damage = attacker.atk * 4 - self.def * 2 # base calculation
damage = 0 if damage < 0 # if negative, make 0
damage *= elements_max_rate(attacker.element_set) # elemental adjustment
damage /= 100
if damage == 0 # if damage is 0,
damage = rand(2) # half of the time, 1 dmg
elsif damage > 0 # a positive number?
@critical = (rand(100) < attacker.cri) # critical hit?
@critical = false if prevent_critical # criticals prevented?
damage *= 3 if @critical # critical adjustment
end
damage = apply_variance(damage, 20) # variance
damage = apply_guard(damage)
####
if attacker.actor? and damage > 0
for attribut in $data_weapons[attacker.weapon_id].element_set
if Maitrise::TABLE_ATTRIBUT.include?(attribut)
$maitrise_arme[attacker.id][attribut] += Maitrise::EXP_ARME
exp = $maitrise_arme[attacker.id][attribut]
indice = 1
while exp > Maitrise::EXP_NEED_ARME
exp -= Maitrise::EXP_NEED_ARME
indice += Maitrise::BONUS_ARME
end
damage *= indice
end
end
end
####
@hp_damage = damage.to_i # damage HP
end
def make_obj_damage_value(user, obj)
damage = obj.base_damage # get base damage
if damage > 0 # a positive number?
damage += user.atk * 4 * obj.atk_f / 100 # Attack F of the user
damage += user.spi * 2 * obj.spi_f / 100 # Spirit F of the user
unless obj.ignore_defense # Except for ignore defense
damage -= self.def * 2 * obj.atk_f / 100 # Attack F of the target
damage -= self.spi * 1 * obj.spi_f / 100 # Spirit F of the target
end
damage = 0 if damage < 0 # If negative, make 0
elsif damage < 0 # a negative number?
damage -= user.atk * 4 * obj.atk_f / 100 # Attack F of the user
damage -= user.spi * 2 * obj.spi_f / 100 # Spirit F of the user
end
damage *= elements_max_rate(obj.element_set) # elemental adjustment
damage /= 100
damage = apply_variance(damage, obj.variance) # variance
damage = apply_guard(damage) # guard adjustment
####
if user.actor? and obj.is_a?(RPG::Skill) and damage > 0
$maitrise_skill[user.id][obj.id] += Maitrise::EXP_SKILL
exp = $maitrise_skill[user.id][obj.id]
indice = 1
while exp > Maitrise::EXP_NEED_SKILL
exp -= Maitrise::EXP_NEED_SKILL
indice += Maitrise::BONUS_SKILL
end
damage *= indice
end
####
if obj.damage_to_mp
@mp_damage = damage.to_i # damage MP
else
@hp_damage = damage.to_i # damage HP
end
end
end
################################################################################
class Scene_Title < Scene_Base
def start
super
$maitrise_arme = Hash.new(0)
$maitrise_skill = Hash.new(0)
load_database # Load database
create_game_objects # Create game objects
check_continue # Determine if continue is enabled
create_title_graphic # Create title graphic
create_command_window # Create command window
play_title_music # Play title screen music
end
def command_new_game
confirm_player_location
Sound.play_decision
for id in 1..($data_actors.size - 1)
$maitrise_arme[id] = {}
$maitrise_skill[id] = {}
end
for id in 1..($data_actors.size - 1)
for i in Maitrise::TABLE_ATTRIBUT
$maitrise_arme[id][i] = 0
end
end
for id in 1..($data_actors.size - 1)
for i in 1..($data_skills.size - 1)
$maitrise_skill[id][i] = 0
end
end
$game_party.setup_starting_members # Initial party
$game_map.setup($data_system.start_map_id) # Initial map position
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$scene = Scene_Map.new
RPG::BGM.fade(1500)
close_command_window
Graphics.fadeout(60)
Graphics.wait(40)
Graphics.frame_count = 0
RPG::BGM.stop
$game_map.autoplay
end
end
################################################################################
class Scene_File < Scene_Base
def write_save_data(file)
characters = []
for actor in $game_party.members
characters.push([actor.character_name, actor.character_index])
end
$game_system.save_count += 1
$game_system.version_id = $data_system.version_id
@last_bgm = RPG::BGM::last
@last_bgs = RPG::BGS::last
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
Marshal.dump(@last_bgm, file)
Marshal.dump(@last_bgs, file)
Marshal.dump($game_system, file)
Marshal.dump($game_message, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Marshal.dump($maitrise_arme, file)
Marshal.dump($maitrise_skill, file)
end
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
$game_system = Marshal.load(file)
$game_message = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$maitrise_arme = Marshal.load(file)
$maitrise_skill = Marshal.load(file)
if $game_system.version_id != $data_system.version_id
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
end
end
################################################################################
class Window_Base < Window
def draw_item_name(item, x, y, enabled = true, actor = nil)
if item != nil
draw_icon(item.icon_index, x, y, enabled)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
if item.is_a?(RPG::Skill)
exp = $maitrise_skill[actor.id][item.id]
level = 1
while exp > Maitrise::EXP_NEED_SKILL
exp -= Maitrise::EXP_NEED_SKILL
level += 1
end
text = " - Lv : " + level.to_s
else
text = ""
end
self.contents.draw_text(x + 24, y, 172, WLH, item.name + text)
end
end
end
################################################################################
class Window_Skill < Window_Selectable
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = @actor.skill_can_use?(skill)
draw_item_name(skill, rect.x, rect.y, enabled, @actor)
self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
end
end
end
################################################################################
class Scene_Status < Scene_Base
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@status_window = Window_Status.new(@actor)
@maitrise = Window_Maitrise.new(@actor)
@maitrise.back_opacity = 255
@maitrise.z = 150
@maitrise.visible = false
end
def terminate
super
dispose_menu_background
@status_window.dispose
@maitrise.dispose
end
def update
update_menu_background
@status_window.update
@maitrise.update
if @maitrise.visible
update_maitrise
return
end
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
Sound.play_decision
@maitrise.visible = true
end
super
end
def update_maitrise
if Input.trigger?(Input::B)
Sound.play_cancel
@maitrise.visible = false
end
end
end
################################################################################
class Window_Maitrise < Window_Base
def initialize(actor)
# Les quatres nombres ci-dessous sont :
# Position x / Position y / Largueur / Hauteur
# Pour avoir la fenetre au centre de l'ecran :
# Pos x = (544 / 2) - (largueur / 2)
# Pos y = (416 / 2) - (hauteur / 2)
super(82, 43, 380, 330)
@actor = actor
refresh
end
def refresh
self.contents.clear
for i in 0..(Maitrise::TABLE_ATTRIBUT.size - 1)
bitmap = Cache.system("Iconset")
rect = Rect.new(Maitrise::TABLE_ICONE[i][0] * 24, Maitrise::TABLE_ICONE[i][1] * 24, 24, 24)
self.contents.blt(0, i * 30, bitmap, rect, 255)
self.contents.draw_text(30, i * 30, 150, 25, Maitrise::TABLE_NOM[i].to_s)
att = Maitrise::TABLE_ATTRIBUT[i]
text = $maitrise_arme[@actor.id][att]
level = 1
while text >= Maitrise::EXP_NEED_ARME
text -= Maitrise::EXP_NEED_ARME
level += 1
end
self.contents.draw_text(130, i * 30, 200, 25, "Lv : " + level.to_s + " - Exp : " + text.to_s, 2)
end
end
end
################################################################################ASHKA

Aide
Ajouter une réponse



Multi-citation








