04-25-2024, 01:15 AM
(04-25-2024, 01:04 AM)DerVVulfman Wrote:(04-24-2024, 10:40 PM)Steel Beast 6Beets Wrote: I've ran into a conundrum. I'm currently using Kyonides' KEquipSkills XP script that allows characters to learn new skills via weapons, armors and items. The script uses a check system to know what characters can learn the skill or not and I noticed that items can still be used in unchecked characters even if they won't learn the skill.
The issue is that I know this is caused by an incompatibility with one of the dozen or so scripts featured in my game since it works as intended in a new project. Since I don't want to go back to the script I previously used, guess I stuck with this "known bug". Not big deal all things considered as I'm already dealing with other bugs like Stormtronics CMS crashing if one tries to access the options submenu and Battle BGM Anti-Reset continuing to play the battle themes if one escapes from battle.
Still, it's just a bit of a nuisance.
STEP 1: Make a 'Duplicate/Copy' of your project.
STEP 2: Delete one script connected to Skills or Items within the Duplicate project
STEP 3: Test the duplicate project.
-- IF that Duplicate project now works, go to Step 4. otherwise repeat from Step 2
STEP 4: Create a separate demo that is just the last deleted script and KEquipSkills XP.
STEP 5: Test. If it is solely that script and KEquipSkills XP, you now know scripts need a merger patch to work together. If not, add another script which you had deleted.
Did just that. Ended deleting every script of my project leaving only the default ones and the issue still persisted.
There's the script along with my customization if anybody is interested:
Code:
# * KEquipSkills XP - Full Version * #
# Scripter : Kyonides Arkanthes
# v1.3.0 - 2024-03-06
# - Use Items, Weapons or Armors to learn Skills! - #
# In order to add new skills whenever you equip a new Weapon or Armor or Item,
# You need to configure a couple of CONSTANTS.
# EQUIP_CHECKS_LEARNING lists Actors that will begin with the :checks method.
# ITEM_CHECKS_LEARNING lists Actors that will begin with the :checks method.
# The rest of the Actors will use the :direct method, learning a single skill
# from the Weapon or Armor or Item.
# - If any BEHAVIOR for a given Actor is set to :direct
# DIRECT_WEAPONS[WeaponID] = [SkillID1, etc.]
# DIRECT_ARMORS[ArmorID] = [SkillID1, etc.]
# DIRECT_ITEMS[ItemID] = [SkillID1, etc.]
# The default value is [], an empty Array.
# - If any BEHAVIOR for a given Actor is set to :checks
# CHECK_WEAPONS[WeaponID] = { :skill => [SkillID1, etc.],
# :class => [ClassID1, etc.], :actor => [ActorID1, etc.] }
# CHECK_ARMORS[ArmorID] = { :skill => [SkillID1, etc.],
# :class => [ClassID1, etc.], :actor => [ActorID1, etc.] }
# CHECK_ITEMS[ArmorID] = { :skill => [SkillID1, etc.],
# :class => [ClassID1, etc.], :actor => [ActorID1, etc.] }
# 0 as an ID allows any class or actor to equip the skill!
# - If you prefer to let the player choose a skill
# PICK_SKILL_ITEMS will allow a given hero to learn ONE of them only.
# - Add a special Pick Skill Item - #
# Create New Lines like the following:
# PICK_SKILL_ITEMS[ItemID] = { :have => [SkillID1, etc.],
# :learn => [SkillID10, etc.] }
# * Script Calls * #
# - Change a given Actor's Item or Equip Check Type
# Note: Pick Skill Items won't ever need such a call.
# Available Types: :direct or :checks
# game_actors[ActorID].item_check_type = Type
# game_actors[ActorID].equip_check_type = Type
module KEquipSkills
EQUIP_CHECKS_LEARNING = []
ITEM_CHECKS_LEARNING = [10, 11, 12, 13, 14, 15, 16, 17, 18, 24]
DIRECT_WEAPONS = {}
DIRECT_ARMORS = {}
DIRECT_ITEMS = {}
CHECK_WEAPONS = {}
CHECK_ARMORS = {}
CHECK_ITEMS = {}
PICK_SKILL_ITEMS = {}
# * Beginning of Customization * #
DIRECT_WEAPONS[453] = [482]
DIRECT_WEAPONS[477] = [444]
DIRECT_WEAPONS[478] = [446]
DIRECT_WEAPONS[479] = [443]
DIRECT_WEAPONS[485] = [447]
DIRECT_WEAPONS[997] = [590]
DIRECT_WEAPONS[998] = [591]
DIRECT_WEAPONS[999] = [899]
DIRECT_ARMORS[263] = [305]
DIRECT_ARMORS[270] = [398]
DIRECT_ARMORS[271] = [399]
DIRECT_ARMORS[320] = [885, 886, 887]
DIRECT_ARMORS[372] = [481]
DIRECT_ARMORS[264] = [306]
DIRECT_ARMORS[380] = [486]
DIRECT_ARMORS[382] = [447]
DIRECT_ARMORS[383] = [448]
DIRECT_ARMORS[384] = [449]
CHECK_ITEMS[251] = { :skill => [401], :class => [10, 11, 12, 13, 14, 15, 16, 17, 18, 24] }
CHECK_ITEMS[252] = { :skill => [402], :class => [10, 11, 12, 13, 14, 15, 16, 17, 18, 24] }
DIRECT_ITEMS[253] = [403]
DIRECT_ITEMS[254] = [404]
DIRECT_ITEMS[255] = [405]
DIRECT_ITEMS[256] = [406]
DIRECT_ITEMS[257] = [407]
DIRECT_ITEMS[258] = [408]
DIRECT_ITEMS[259] = [409]
DIRECT_ITEMS[260] = [410]
DIRECT_ITEMS[261] = [411]
DIRECT_ITEMS[266] = [416]
DIRECT_ITEMS[267] = [417]
DIRECT_ITEMS[268] = [418]
DIRECT_ITEMS[269] = [419]
DIRECT_ITEMS[270] = [420]
DIRECT_ITEMS[271] = [421]
DIRECT_ITEMS[272] = [422]
DIRECT_ITEMS[273] = [423]
DIRECT_ITEMS[274] = [424]
# * End of Customization * #
DIRECT_WEAPONS.default = []
DIRECT_ARMORS.default = []
DIRECT_ITEMS.default = []
PICK_SKILL_ITEMS.default = {}
extend self
attr_accessor :pick_index
def equip_check_type(actor_id)
EQUIP_CHECKS_LEARNING.include?(actor_id)? :checks : :direct
end
def item_check_type(actor_id)
ITEM_CHECKS_LEARNING.include?(actor_id)? :checks : :direct
end
def find_group(type)
case type
when :weapon
CHECK_WEAPONS
when :armor
CHECK_ARMORS
when :item
CHECK_ITEMS
end
end
def can_pick_skill?(item_id)
PICK_SKILL_ITEMS.has_key?(item_id)
end
def has_pick_skills?(item_id, skills)
skills.has_any?(PICK_SKILL_ITEMS[item_id][:have])
end
def pick_skills(item_id)
PICK_SKILL_ITEMS[item_id]
end
end
class Array
def has_any?(ary)
return false unless ary
result = self & ary
result.any?
end
end
class RPG::Item
def can_pick_skill?
KEquipSkills.can_pick_skill?(@id)
end
def has_pick_skills?(skills)
KEquipSkills.has_pick_skills?(@id, skills)
end
end
class Game_Battler
alias :kyon_ekuip_skills_gm_btlr_item_fx :item_effect
def item_effect(item)
result = update_item_skills(item) if actor?
effective = kyon_ekuip_skills_gm_btlr_item_fx(item)
result or effective
end
def actor?
@actor_id != nil
end
end
class Game_Actor
alias :kyon_ekuip_skills_gm_actor_init :initialize
alias :kyon_ekuip_skills_gm_actor_sklr? :skill_learn?
alias :kyon_ekuip_skills_gm_actor_skills :skills
alias :kyon_ekuip_skills_gm_actor_equip :equip
def initialize(actor_id)
@equip_skills = []
@equip_check_type = KEquipSkills.equip_check_type(actor_id)
@item_check_type = KEquipSkills.item_check_type(actor_id)
kyon_ekuip_skills_gm_actor_init(actor_id)
update_equip_skills
end
def skill_learn?(skill_id)
return true if self.equip_skills.include?(skill_id)
kyon_ekuip_skills_gm_actor_sklr?(skill_id)
end
def teach_item_skills?(item_id)
return true if KEquipSkills::DIRECT_ITEMS.has_key?(item_id)
item = KEquipSkills.find_group(:item)[item_id] || []
return if item.empty?
return true if [0, @class_id].has_any?(item[:class])
return true if [0, @actor_id].has_any?(item[:actor])
nil
end
def check_equipment_skills(kind, item_id)
item = KEquipSkills.find_group(kind)[item_id] || []
return if item.empty?
return item[:skill] if [0, @class_id].has_any?(item[:class])
return item[:skill] if [0, @actor_id].has_any?(item[:actor])
[]
end
def check_item_skills(item_id)
check_equipment_skills(:item, item_id)
end
def check_weapon_skills(item_id)
check_equipment_skills(:weapon, item_id)
end
def check_armor_skills(item_id)
check_equipment_skills(:armor, item_id)
end
def update_item_skills(item)
item_id = item.id
total = @skills.size
if item.can_pick_skill?
return false unless item.has_pick_skills?(@skills)
data = KEquipSkills::PICK_SKILL_ITEMS[item_id][:learn]
@skills << data[KEquipSkills.pick_index]
elsif @item_check_type == :direct
@skills += KEquipSkills::DIRECT_ITEMS[item_id]
elsif @item_check_type == :checks
@skills += check_item_skills(item_id)
end
@skills = @skills.compact.uniq.sort
@skills.size > total
end
def equip(equip_type, id)
kyon_ekuip_skills_gm_actor_equip(equip_type, id)
update_equip_skills
end
def update_equip_skills
@equip_skills.clear
case @equip_check_type
when :direct
@equip_skills += KEquipSkills::DIRECT_WEAPONS[@weapon_id]
direct_armors = KEquipSkills::DIRECT_ARMORS
@equip_skills += direct_armors[@armor1_id]
@equip_skills += direct_armors[@armor2_id]
@equip_skills += direct_armors[@armor3_id]
@equip_skills += direct_armors[@armor4_id]
when :checks
@equip_skills += check_weapon_skills(@weapon_id)
@equip_skills += check_armor_skills(@armor1_id)
@equip_skills += check_armor_skills(@armor2_id)
@equip_skills += check_armor_skills(@armor3_id)
@equip_skills += check_armor_skills(@armor4_id)
end
@equip_skills = @equip_skills.compact
end
def equip_skills
@equip_skills
end
def skills
kyon_ekuip_skills_gm_actor_skills | equip_skills
end
attr_accessor :item_check_type, :equip_check_type
end
class Game_Party
alias :kyon_equip_skills_item_can_use? :item_can_use?
def teach_item_skills?(item_id)
@actors.each {|actor| return true if actor.teach_item_skills?(item_id) }
end
def item_can_use?(item_id)
return true if teach_item_skills?(item_id)
kyon_equip_skills_item_can_use?(item_id)
end
end