05-10-2023, 04:21 AM
(This post was last modified: 05-10-2023, 06:23 AM by kyonides.
Edit Reason: Bug Fix 20230510
)
EkuipFeatures ACE
by Kyonides
Introduction
This simple scriptlet will allow you to add or remove Equip Types to any given Actor during gameplay at will.
Warning: It uses a couple of script calls to accomplish that.
The Script - Updated!
Code:
# * EkuipFeatures ACE * #
# Scripter : Kyonides Arkanthes
# 2023-05-10
# This scriptlet will allow you to add or remove Equip Types to
# any given Actor during gameplay at will.
# * Script Calls * #
# - Find an Actor - 2 Methods:
# actor = $game_party.members[Index]
# actor = $game_actors[ActorID]
# - Learn a New Equip Type
# actor.learn_weapon_type(EquipTypeIndex)
# actor.learn_armor_type(EquipTypeIndex)
# - Forget a given Equip Type
# actor.forget_weapon_type(EquipTypeIndex)
# actor.forget_armor_type(EquipTypeIndex)
module Ekuip
class FeaturesContainer
attr_reader :features
def initialize
@features = []
end
def add(type_code, type_id)
@features << RPG::BaseItem::Feature.new(type_code, type_id)
@features = @features.uniq{|f| f.data_id }
end
def remove(type_code, type_id)
@features.delete_if{|f| f.same_data?(type_code, type_id) }
end
end
end
class RPG::BaseItem::Feature
def same_data?(type_code, type_id)
@code == type_code and @data_id == type_id
end
end
class Game_Actor
alias :kyon_learn_ekuip_types_gm_act_init :initialize
alias :kyon_learn_ekuip_types_gm_act_feat_obj :feature_objects
def initialize(actor_id)
@weapon_features = Ekuip::FeaturesContainer.new
@armor_features = Ekuip::FeaturesContainer.new
kyon_learn_ekuip_types_gm_act_init(actor_id)
end
def equip_features
[@weapon_features] + [@armor_features]
end
def feature_objects
kyon_learn_ekuip_types_gm_act_feat_obj + equip_features
end
def learn_weapon_type(type_id)
@weapon_features.add(FEATURE_EQUIP_WTYPE, type_id)
end
def learn_armor_type(type_id)
@armor_features.add(FEATURE_EQUIP_ATYPE, type_id)
end
def forget_weapon_type(type_id)
@weapon_features.remove(FEATURE_EQUIP_WTYPE, type_id)
end
def forget_armor_type(type_id)
@armor_features.remove(FEATURE_EQUIP_ATYPE, type_id)
end
end
Terms & Conditions
Free for use in any game.
Include my name in your game credits.
That's it!
"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.
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!
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
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
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!
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