SkillUpgrade
#1
SkillUpgrade
XP
version 0.2.0

by Kyonides

Introduction

This script allows you to quickly setup a specific list of skills that can be upgraded by the heroes during gameplay. The more they use their skills the faster the upgrades can take place.

It is supposed to be as simple as possible. This might mean bad news for you for I could easily reject any of your future feature requests, guys. Tongue sticking out

No GUI is included! Tongue sticking out 

It requires the creation of a template file, basically a TXT file.
You can find the default one right below the script.

The Script - Alpha Stage

Code:
# * SkillUpgrade XP * #
#  Scripter : Kyonides Arkanthes
#  v0.2.0 - 2023-10-24

# This script allows you to quickly setup a specific list of skills that can be
# upgraded by the heroes during gameplay. The more they use their skills the
# faster the upgrades can take place.

# Create a new text file. It should have the same name as the value of the
# TEMPLATE_NAME constant you can find below.
# That file will be used as a template.
# Optionally, you could use and carefully edit the default template instead.

module SkillUp
  TEMPLATE_NAME = "skill_upgrades.txt"

  class Require
    def initialize(*args)
      @uses = args[0] || 0
      @target_id = args[1] || 0
      @keep = args[2]
    end

    def setup(hash)
      @target_id = hash[:target] || 0
      @keep = hash[:keep]
    end

    def ignore?
      @target_id == 0
    end
    attr_accessor :uses, :target_id, :keep
  end

  COMMENT_SYM = "#"
  BASE_UPGRADES = {}
  extend self
  def set(skill_id)
    data = BASE_UPGRADES[skill_id] || {}
    req = Require.new
    req.setup(data)
    req
  end
end

class String
  def scan_int
    scan(/\d+/).map{|n| n.to_i }
  end
end

module SkillUp
  def parse
    if File.exist?(TEMPLATE_NAME)
      lines = File.readlines(TEMPLATE_NAME)
    else
      lines = []
    end
    list = BASE_UPGRADES
    lines.delete_if {|line| line[0] == COMMENT_SYM }
    lines.each do |line|
      next if line.chomp.empty?
      skill_id, total, target = line.scan_int
      keep = line[/keep/i] != nil
      list[skill_id] = { :use_max => total, :target => target, :keep => keep }
    end
  end
  parse
end

class RPG::Skill
  def use_max
    @requirement ||= SkillUp::BASE_UPGRADES[@id] || { :use_max => 0 }
    @requirement[:use_max]
  end
end

class Game_Actor
  alias :kyon_skill_up_gm_act_init :initialize
  def initialize(actor_id)
    kyon_skill_up_gm_act_init(actor_id)
    @skill_up = {}
    @skills.each {|sid| set_skill_upgrade(sid) }
  end

  def set_skill_upgrade(skill_id)
    @skill_up[skill_id] = SkillUp.set(skill_id)
  end

  def skill_upgrade(skill_id)
    @skill_up[skill_id]
  end
  attr_reader :skill_up
end

The Template

This file should always have a blank line at the very end. Never ever forget this! Serious

Code:
# How to Use?
# Skill Number: uses Number, learn ID, delete
# Skill Number: uses Number, learn ID, keep

Skill 1:   uses 25, learn 2, delete
Skill 2:   uses 50, learn 3, delete
Skill 3:   uses 75, learn 4, keep
Skill 57:  uses 30, learn 58, delete
Skill 58:  uses 60, learn 59, delete
Skill 59:  uses 30, learn 60, delete
Skill 60:  uses 60, learn 61, keep
Skill 65:  uses 70, learn 66, delete
Skill 70:  uses 100, learn 71, keep

FAQ

Q: Will the script be ported to X engine?
A: I don't know for sure. Who Knows?

Terms & Conditions

I haven't defined any specific conditions for this script as of today because it's still in alpha stage. Happy with a sweat
To be continued... or updated. Laughing
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }




Users browsing this thread: 2 Guest(s)