EKuipSwitch XP
#1
EKuipSwitch XP

by Kyonides


Introduction

Are you in desperate need to turn on a switch whenever a hero equips a specific weapon or armor and vice versa?
Well, now you can do it! Grinning

RMXP's Setup

Either set the key value pairs of the WEAPON_IDS or ARMOR_IDS constants like this:

Code:
ARMOR_IDS = { 33 => 10 }

Where 33 stands for the Armor ID and 10 is the Switch ID.


Terms & Conditions

Free as in Beer beer.
Include my nickname in your game credits! Winking
Do not repost it anywhere! Happy with a sweat
"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 }
#2
Your Usual Update Announcement

Just keep in mind guys that this script has been ported to RMXP and RMVX as well! Grinning

VX's version works the same way as VX Ace's, but the XP port needs to use 2 CONSTANTS to achieve the same effect on its own terms. Winking If you have worked with Hashes before, it will be a piece of cake.
"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 }
#3
Official Add-On for EkuipSwitch XP

Available Now!

Due to a strange help request thread I had read some time ago, I came up with this add-on to allow the game developers predefine the game variables that will be used by your game any time a hero equips or unequips any weapon or piece of armor.

I hope this will help anyone already using my EkuipSwitch XP script a lot. Winking 

Code:
# * EkuipVar XP -- EkuipSwitch XP Add-On * #
#   Scripter : Kyonides Arkanthes
#   2023-04-26

# This script works pretty much the same way EkuipSwitch XP script does.
# The only difference is that you must assign some unique Game Variable ID
# for every Equip Slot currently available in your game project.
# Setup the VARS_4_EQUIP_IDS Constant accordingly.
# 1st Slot stands for the weapon, the 2nd Slot for the 1st piece of armor, etc.

#   ACTOR_EQUIP_VARS = { ActorID1 => [Slot1Var, etc.], etc. }

# If you equip or unequip a weapon or armor included in one of the constants:
#   VAR_WEAPON_VALUES = { WeaponID1 => Value, etc. }
#   VAR_ARMOR_VALUES  = { ArmorID1 => Value, etc. }

module EKuipSwitch
  ACTOR_EQUIP_VARS = { 1 => [1, 2, 3, 4, 5] }
  VARS_4_EQUIP_IDS.default = [0, 0, 0, 0, 0]
  VAR_WEAPON_VALUES = {}
  VAR_ARMOR_VALUES = {}
  def self.var_value(type, item_id, equipped)
    return 0 unless equipped
    type == 0 ? VAR_WEAPON_VALUES[item_id] : VAR_ARMOR_VALUES[item_id]
  end
end

class Game_Actor
  def turn_equip_var(equip_type, equip_id, in_use)
    var = EKuipSwitch::ACTOR_EQUIP_VARS[@actor_id][type]
    $game_variables[var] = EKuipSwitch.var_value(equip_type, equip_id, in_use)
  end

  def update_equip_switches(equip_type, old_id, new_id)
    return if @is_temp_actor or old_id == new_id
    equip_type = 0 if equip_type == 1 and @dual_wield
    turn_equip_switch(equip_type, old_id, false)
    turn_equip_switch(equip_type, new_id, true)
    turn_equip_var(equip_type, old_id, false)
    turn_equip_var(equip_type, new_id, true)
    true
  end
end
"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: 4 Guest(s)