KActionSpeed XP
#1
KActionSpeed XP

by Kyonides Arkanthes

Introduction

Continuing the battle add-ons production line, I present you with a scriptlet that will alter a hero's or a monster's action speed. An action can either be attacking the opponent with a sword swing or casting a spell or even consuming an item. This can now be alter via script!

Did you ever want to make a battler the fastest guy out there? Confused Now you can get him or her a good chance to strike first! Shocked
Or you can make him or her the slowest scum that has ever existed! Laughing
Or you might prefer to let luck guide them... Confused

Script
Code:
# * KActionSpeed XP
#   Scripter : Kyonides Arkanthes
#   2019-10-31

# This scriptlet allows you to modify a battler's action speed by multiplying
# it by a predefined percent. It can also slow it down or give the battler a
# good chance to get the first strike for himself alone. Speed will depend on a
# State or some Item the party might have collected sofar.
# Since monsters have no bag full of items, they solely depend on a state to get
# the speed boost.
# You can also define items or states that randomly alter anyone's speed.

module KActionSpeed
 FAST_ITEMID = 1
 SLOW_ITEMID = 2
 RANDOM_ITEMID_MAX = [3, 1000] # ItemID, SpeedMax
 FAST_STATEID = 2
 SLOW_STATEID = 3
 RANDOM_STATEID_MAX = [4, 1000] # StateID, SpeedMax
 # { ID => Percent, etc. }
 ITEMS = { 4 => 5, 5 => 10, 6 => 15 }
 STATES = { 5 => 5, 6 => 9 }
end

class Game_Battler
 alias :kyon_action_speed_gmb_mas :make_action_speed
 def make_action_speed
   speed = kyon_action_speed_gmb_mas
   action = @current_action
   if self.is_a?(Game_Actor)
     return action.speed *= 100 if KActionSpeed::FAST_ITEMID
     return action.speed = 0 if KActionSpeed::SLOW_ITEMID
     keys = $game_party.item_keys
     iid, imax = KActionSpeed::RANDOM_ITEMID_MAX
     return action.speed = rand(imax + 1) if keys.include?(iid)
     keys &= KActionSpeed::ITEMS.keys
     keys.each{|key| action.speed += speed * KActionSpeed::ITEMS[key] / 100 }
   end
   return action.speed *= 100 if @states.include?(KActionSpeed::FAST_STATEID)
   return action.speed = 0 if @states.include?(KActionSpeed::SLOW_STATEID)
   rid, rmax = KActionSpeed::RANDOM_STATEID_MAX
   return action.speed = rand(rmax + 1) if @states.include?(rid)
   keys = @states & KActionSpeed::STATES.keys
   keys.each{|key| action.speed += speed * KActionSpeed::STATES[key] / 100 }
 end
end

class Game_Party
 def item_keys() @items.keys end
end

Terms & Conditions

You must include my nickname and the current website's URL in your game credits.
Free for non commercial games.
Give me a free copy of your completed game if you include at least 2 of my scripts! Laughing + Tongue sticking out
"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
KActionSpeed XP - by kyonides - 10-31-2019, 08:05 AM



Users browsing this thread: 2 Guest(s)