Últimos temas
» ¿Cómo puedo mandar un PDF junto a un juego?
por Muzgar Miér Nov 13, 2019 3:48 pm

» LA BRÚJULA DE ZAZA [VXACE]
por Muzgar Miér Nov 13, 2019 3:41 pm

» Duda, ayuda
por Muzgar Miér Nov 13, 2019 3:38 pm

» Sistema de parallax, tiempo, climatologia e iluminacion
por ckunx Miér Nov 13, 2019 2:37 pm

» [MV/VX/Ace] Engine "Objetivo actual" y "Hablar con el grupo"
por ckunx Miér Nov 13, 2019 2:28 pm

» error de script (HUD)
por Klayer Lun Nov 11, 2019 10:47 pm

» LMD - Lunas de Magia Divina
por Zaabos Lun Nov 11, 2019 8:56 pm

» Heartland | IGMC 2018
por DopellSerch Lun Nov 11, 2019 3:55 pm

» Hasta luego
por InvariableZ Dom Nov 10, 2019 2:41 pm

» [Publicidad] Around Me, otra vez.
por Muzgar Dom Nov 10, 2019 12:45 pm

» KBoomEffect XP
por kyonides Sáb Nov 09, 2019 1:55 am

» KStatsRefill XP VX & ACE
por kyonides Vie Nov 08, 2019 5:00 am


SKillGem XP

Ir abajo

SKillGem XP Empty SKillGem XP

Mensaje por kyonides el Lun Oct 28, 2019 12:23 am

SKillGem XP

por Kyonides Arkanthes

Introducción

Sirve para modificar las técnicas mediante el consumo de gemas o algún otro tipo de objeto. Requeire un script y un archivo de texto TXT como plantilla.

Script
Código:
# * SKillGem XP
#  Scripter : Kyonides Arkanthes
#  v0.9.0 - 2019-10-14 (No Custom Scene Menu Included)

# This is the first step of two to let the player modify a hero's skills via
# the consumption of skill gems!

# Create a text file or save the template and name it "skillgem modifiers.txt"
# in your game folder and add as many modifiers as you wish.

# @modifiers.default represents all those skills not defined in the text file
# so modify its default values at will.

# DEBUG Constant values and effects #

# true - parse text file (for games under development)
# false or nil - load rxdata file (for closed demos or finished games)

# * Script Calls * In case you don't want to use the Skill Gem menu

# actor = $game_party.actors[Member_Index]
#  Keeps an actor aka hero in a temporary variable
# actor.skill_level(Skill_ID)
#  Returns a skill's current level
# actor.skill_level_up(Skill_ID)
#  Levels up a skill's level using the brute force method!
#  No skill gems are lost in the process!
# actor.safe_skill_level_up(Skill_ID)
#  Safely levels up a skill's level or returns the current level if failed
#  It consumes skill gems on success!
# actor.enough_skill_gems?(Skill_ID)
#  Checks if there are enough items to level up a skill
#  Returns false if there are no additional levels available!

# $game_party.skill_gems_total
#  Returns the total amount of skill gems the player currently owns.

# * Warning *

# In case you don't include any Title scene script in your game project, REMOVE
# the Scene_Title class contents from my script to prevent your game from
# failing to alias an non existing method. You also need to modify your custom
# script by replacing its own definition of $data_skills with the following:

# $data_skills = SKillGem.skills

module SKillGem
  DEBUG = true
  ITEM_ID = 1 # It should be an item found in the Items Database!
  module Improve
    def modifier() @modifier end
    def modifier=(hash) @modifier = hash end
    def level() @modifier[:level] end
    def level=(lvl) @modifier[:level] = lvl end
    def gems_level(level) @modifier[:gems][level] || 0 end
    def sp_cost() @sp_cost + @modifier[:cost] * @modifier[:level] end
    def power() @power + @modifier[:power] * @modifier[:level] end
    def atk_f() @atk_f + @modifier[:atk] * @modifier[:level] end
    def eva_f() @eva_f + @modifier[:eva] * @modifier[:level] end
    def str_f() @str_f + @modifier[:str] * @modifier[:level] end
    def dex_f() @dex_f + @modifier[:dex] * @modifier[:level] end
    def agi_f() @agi_f + @modifier[:agi] * @modifier[:level] end
    def int_f() @int_f + @modifier[:int] * @modifier[:level] end
    def pdef_f() @pdef_f + @modifier[:pdef] * @modifier[:level] end
    def mdef_f() @mdef_f + @modifier[:mdef] * @modifier[:level] end
  end
  def self.add_skill_gem_data
    skills = load_data("Data/Skills.rxdata")
    return if skills[1].instance_variables.include?('@modifier')
    skills[1..-1].each do |s|
      s.extend Improve
      s.modifier = { :power => 0, :cost => 0, :atk => 0, :eva => 0, :str => 0,
        :dex => 0, :agi => 0, :int => 0, :pdef => 0, :mdef => 0,
        :level => 0, :gems => [0] }
    end
    save_data(skills, "Data/SkillsSG.rxdata")
    skills
  end

  def self.parse_modifiers
    lines = File.readlines('skillgem modifiers.txt')
    lines << "\n"
    total = lines.size
    raise("SKillGem is misconfigured!") if total < 13
    modifiers = {}
    (total / 13).times do
      sid = lines.shift.scan(/\d+/)[0].to_i
      modifiers[sid] = mod = {}
      mod[:gems] = lines.shift.scan(/\d+/).map{|d| d.to_i }
      mod[:cost] = lines.shift.scan(/\d+/)[0].to_i
      mod[:power] = lines.shift.scan(/\d+/)[0].to_i
      mod[:atk] = lines.shift.scan(/\d+/)[0].to_i
      mod[:eva] = lines.shift.scan(/\d+/)[0].to_i
      mod[:str] = lines.shift.scan(/\d+/)[0].to_i
      mod[:dex] = lines.shift.scan(/\d+/)[0].to_i
      mod[:agi] = lines.shift.scan(/\d+/)[0].to_i
      mod[:int] = lines.shift.scan(/\d+/)[0].to_i
      mod[:pdef] = lines.shift.scan(/\d+/)[0].to_i
      mod[:mdef] = lines.shift.scan(/\d+/)[0].to_i
      mod[:level] = 0
      lines.shift
    end
    save_data(modifiers, "Data/SKillGem.rxdata")
    modifiers
  end
  def self.modifiers() @modifiers end
  def self.skills() @skills end
  @skills = DEBUG ? add_skill_gem_data : load_data("Data/SkillsSG.rxdata")
  @modifiers = DEBUG ? parse_modifiers : load_data("Data/SKillGem.rxdata")
  @modifiers.default = {
    :cost => 0, :power => 0, :atk => 0, :eva => 0, :str => 0,
    :dex => 0, :agi => 0, :int => 0, :pdef => 0, :mdef => 0,
    :level => 0, :gems => [0]
  }
end

class Game_Battler
  alias :kyon_skill_gem_skill_effect :skill_effect
  def skill_effect(user, skill)
    skill = user.gem_skills[skill.id] if user.class == Game_Actor
    kyon_skill_gem_skill_effect(user, skill)
  end
end

class Game_Actor
  attr_reader :gem_skills
  alias :kyon_skill_gem_gm_actor_setup :setup
  def setup(actor_id)
    @gem_skills = {}
    kyon_skill_gem_gm_actor_setup(actor_id)
    @skills.each{|n| @gem_skills[n] = setup_gem_skill(n) }
  end

  def setup_gem_skill(sid)
    skill = SKillGem.skills[sid].dup
    skill.extend SKillGem::Improve
    skill.modifier = SKillGem.modifiers[sid].dup
    skill
  end

  def learn_skill(skill_id)
    return if skill_id == 0 or skill_learn?(skill_id)
    @gem_skills[skill_id] = setup_gem_skill(skill_id)
    @skills.push(skill_id)
    @skills.sort!
  end

  def forget_skill(skill_id)
    @gem_skills.delete(skill_id)
    @skills.delete(skill_id)
  end

  def enough_skill_gems?(sid)
    skill_lvl = @gem_skills[sid].level + 1
    gems_level = SKillGem.skills[sid].gems_level(skill_lvl)
    return false if gems_level == 0
    return $game_party.skill_gems_total >= gems_level
  end

  def safe_skill_level_up(sid)
    skill_lvl = @gem_skills[sid].level
    gems_level = SKillGem.skills[sid].gems_level(skill_lvl + 1)
    total = $game_party.skill_gems_total
    return skill_lvl if gems_level == 0 or total < gems_level
    $game_party.lose_item(SKillGem::ITEM_ID, gems_level)
    skill_level_up(sid)
  end
  def skill_level_up(sid) @gem_skills[sid].level = @skill_levels[sid] end
  def skill_level(sid) @gem_skills[sid].level end
  def skill_next_level(sid) @gem_skills[sid].level + 1 end
end

class Game_Party
  def skill_gems_total() @items[SKillGem::ITEM_ID] || 0 end
end

# Scene_Title Modification - For games that do include that script only!
class Scene_Title
  alias :kyon_skill_gem_scn_title_main :main
  def main
    kyon_skill_gem_scn_title_main
    $data_skills = SKillGem.skills
  end
end

Plantilla
Código:
Skill ID: 1
Gems per Level: 0, 5
Cost: -5
Power: 5
Attack: 0
Evasion: 0
Strength: 0
Dexterity: 0
Agility: 0
Intelligence: 0
P. Defense: 0
M. Defense: 0

Skill ID: 2
Gems per Level: 0, 7
Cost: -5
Power: 5
Attack: 0
Evasion: 0
Strength: 0
Dexterity: 0
Agility: 0
Intelligence: 0
P. Defense: 0
M. Defense: 0

Skill ID: 3
Gems per Level: 0, 10
Cost: -5
Power: 5
Attack: 0
Evasion: 0
Strength: 0
Dexterity: 0
Agility: 0
Intelligence: 0
P. Defense: 0
M. Defense: 0


Términos de Uso

Deben incluir mi seudónimo y el URL del sitio del que lo copiaron.
Es gratuito para demos y juegos no comerciales.

kyonides
PJ Secundario
PJ Secundario

Masculino
Costa Rica
RPG Maker : Xp
Mensajes : 123
Monedas : 321
Reputación : 3

Volver arriba Ir abajo

Volver arriba


 
Permisos de este foro:
No puedes responder a temas en este foro.