Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 KBareHands
#1
KBareHands XP
v1.0.2

by Kyonides Arkanthes


Introduction

This scriptlet lets you add base attack, physical and magical defense to any hero. It could be especially useful for barehanded martial artists.
Those stats might also get increased per every level the hero gains. They can be increased or decreased by using script calls.

If you ever consider that to be pretty boring, then let me tell you that you got an alternative, namely the "Preferred Stat" option!
It will add the totals of all 3 stats to the preferred one while the others get no boost at all. This can be altered in game at any given time.

There are also the Base Stat and Stat Increase Lottos!

A given stat might get an increase or decrease depending on your luck.

Take into consideration that you need to configure several Constants found in the module below or you could just set the generic default values there and take care of the rest in game via calling the script...

You can also seal and unlock an hero's preferred stat.

There is no screenshot for obvious reasons.  Tongue sticking out

You can also find a demo if you visit the KBareHandsLotto XP thread. Winking

The Script

Code:
# * KBareHands XP
#   Scripter : Kyonides Arkanthes
#   2021-09-02 - v1.0.2
#   Not a Plug & Play Script!

# This scriptlet lets you add base attack, physical and magical defense to any
# hero. It could be especially useful for barehanded martial artists.
# Those stats might also get increased per every level the hero gains.
# They can be increased or decreased by using script calls.

# If you ever consider that to be pretty boring, then let me tell you that you
# got an alternative, namely the "Preferred Stat" option!
# It will add the totals of all 3 stats to the preferred one while the others
# get no boost at all. This can be altered in game at any given time.

# There are also the Base Stat and Stat Increase Lottos!
# A given stat might get an increase or decrease depending on your luck.

# Take into consideration that you need to configure several Constants found in
# the module below or you could just set the generic default values there and
# take care of the rest in game via calling the script...

# * Aliased Methods * #
# Game_Actor#base_atk
# Game_Actor#base_pdef
# Game_Actor#base_mdef

# Stat stands for either :atk or :pdef or :mdef
# PreferredStat stands for either nil or :atk or :pdef or :mdef

# * Script Calls * #

# Set Bare Hands Preferred Stat In Game
# $game_actors[ActorID].prefer_stat = PreferredStat

# Seal or Unseal Bare Hands Preferred Stat In Game
# $game_actors[ActorID].seal_stat = true or false

# Set Bare Hands Stat In Game
# $game_actors[ActorID].hands_stat[Stat] = Number
# $game_actors[ActorID].hands_atk = Number
# $game_actors[ActorID].hands_pdef = Number
# $game_actors[ActorID].hands_mdef = Number

# Set Bare Hands Increase In Game
# $game_actors[ActorID].hands_step[Stat] = Number
# $game_actors[ActorID].step_atk = Number
# $game_actors[ActorID].step_pdef = Number
# $game_actors[ActorID].step_mdef = Number

# Bare Hands Stat Lotto ( Between -50% and +50% )
# $game_actors[ActorID].hands_stat_lotto(Stat)

# Bare Hands Increase Lotto ( Between -50% and +50% )
# $game_actors[ActorID].hands_step_lotto(Stat)

module KBareHands
  # Better leave the following 4 lines alone!
  PREFERRED_STAT = {}
  BASE_ATTACK = {}
  BASE_PDEF = {}
  BASE_MDEF = {}
  # Base Stat and Increase per Level for Actors not listed below
  PREFERRED_STAT.default = nil # Options: nil, :atk, :pdef, :mdef
  BASE_ATTACK.default = [5, 2]
  BASE_PDEF.default = [5, 2]
  BASE_MDEF.default = [5, 2]
  # [ActorID] = nil or :atk or :pdef or :mdef
  PREFERRED_STAT[1] = :pdef
  # [ActorID] = [Base Attack, Increase]
  BASE_ATTACK[1] = [6, 3]
  # [ActorID] = [Base PDEF, Increase]
  BASE_PDEF[1] = [6, 3]
  # [ActorID] = [Base MDEF, Increase]
  BASE_MDEF[1] = [6, 3]
end

class Game_Actor
  alias :kyon_hands_gm_actor_setup :setup
  alias :kyon_hands_gm_actor_base_atk :base_atk
  alias :kyon_hands_gm_actor_base_pdef :base_pdef
  alias :kyon_hands_gm_actor_base_mdef :base_mdef
  def setup(actor_id)
    kyon_hands_gm_actor_setup(actor_id)
    bsatk, incr = KBareHands::BASE_ATTACK[actor_id]
    bpdef, pinc = KBareHands::BASE_PDEF[actor_id]
    bmdef, minc = KBareHands::BASE_MDEF[actor_id]
    @hands_stats = { :atk => bsatk, :pdef => bpdef, :mdef => bmdef }
    @hands_step = { :atk => incr, :pdef => pinc, :mdef => minc }
    @prefer_stat = KBareHands::PREFERRED_STAT[actor_id]
  end
  
  def hands_stat_lotto(key)
    stat = @hands_stats[key]
    @hands_stats[key] = stat / 2 + rand(stat + 1)
  end
  
  def hands_step_lotto(key)
    stat = @hands_step[key]
    @hands_step[key] = stat / 2 + rand(stat + 1)
  end

  def bare_calc(stat)
    if @prefer_stat == stat
      st = @hands_stats.values.inject{|a,b| a + b }
      st + @level * @hands_step.values.inject{|a,b| a + b }
    elsif @prefer_stat == nil
      @hands_stats[stat] + @hands_step[stat] * @level
    else
      0
    end
  end

  def base_atk
    kyon_hands_gm_actor_base_atk + barehands_calc(:atk)
  end

  def base_pdef
    kyon_hands_gm_actor_base_pdef + barehands_calc(:pdef)
  end

  def base_mdef
    kyon_hands_gm_actor_base_mdef + barehands_calc(:mdef)
  end
  def prefer_stat=(stat) @prefer_stat = @seal_stat ? @prefer_stat : stat  end
  def hands_atk() @hands_stats[:atk] end
  def hands_pdef() @hands_stats[:pdef] end
  def hands_mdef() @hands_stats[:mdef] end
  def hands_atk=(n) @hands_stats[:atk] = n end
  def hands_pdef=(n) @hands_stats[:pdef] = n end
  def hands_mdef=(n) @hands_stats[:mdef] = n end
  def step_atk() @hands_step[:atk] end
  def step_pdef() @hands_step[:pdef] end
  def step_mdef() @hands_step[:mdef] end
  def step_atk=(n) @hands_step[:atk] = n end
  def step_pdef=(n) @hands_step[:pdef] = n end
  def step_mdef=(n) @hands_step[:mdef] = n end
  attr_reader :hands_stats, :hands_step, :prefer_stat
  attr_accessor :seal_stat
end

class Game_Actors
  def initialize
    $data_weapons[0] = RPG::Weapon.new
    $data_armors[0] = RPG::Armor.new
    @data = []
  end
end


Terms & Conditions

Feel free to use it anywhere but not as a punch bag. [Image: confused.gif]
Include me in your game credits! [Image: wink.gif]
Do not repost this script! [Image: laughingtongue.gif]
"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 }


Messages In This Thread
KBareHands - by kyonides - 08-31-2021, 09:29 AM
RE: KBareHands - by Steel Beast 6Beets - 08-31-2021, 02:15 PM
RE: KBareHands - by kyonides - 09-02-2021, 11:14 PM



Users browsing this thread: