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 - Stable Version
Ruby:
# * 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 复制代码
Warning for Newcomers:
If you only need to make a single call to learn a type, then do this:
Ruby:
$game_actors[10].learn_weapon_type(2) 复制代码
Terms & Conditions
Free for use in any game.
Include my name in your game credits.
That's it!
本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/ekuipfeatures-ace.157392/