じ☆ve冰风 发表于 2026-7-23 09:48:47

Non Kombatant VX

Non Kombatant VX

by Kyonides​

Introduction

This scriptlet allows you to prevent a certain hero from being present during battles.

This feature can also be disabled at any given time.

There are separate calls for party members and individual heroes. This lets you include or exclude any hero no matter if he has ever joined the party or has recently left it. How convenient that is, don't you agree?


The Script
                Ruby:       
# * Non Kombatant VX * #
#   Scripter : Kyonides Arkanthes
#   v0.3.0 - 2024-12-29

# This scriptlet allows you to prevent a certain hero from being present during
# battles. This feature can also be disabled at any given time.

# There are separate calls for party members and individual heroes. This lets
# you include or exclude any hero no matter if he has ever joined the party or
# has recently left it.

# Warning: Game_Party#members method has been aliased.

# * Script Calls * #
# - Set Party Member as NPC - Disabling him during battles
# $game_party.actor_as_npc(Index)

# - Set Party Single Hero as NPC - Disabling him during battles
# $game_actors.is_npc = true

# - Set Party Member as Combatant - Enabling him during battles
# $game_party.npc_as_actor(Index)

# - Set Hero as Combatant - Enabling him during battles
# $game_actors.is_npc = false

class Game_BattleAction
alias :kyon_non_kombat_gm_bta_dc_rand_tgt :decide_random_target
alias :kyon_non_kombat_gm_bta_dc_last_tgt :decide_last_target
def decide_random_target
    kyon_non_kombat_gm_bta_dc_rand_tgt
    clear unless @target_index
end

def decide_last_target
    kyon_non_kombat_gm_bta_dc_last_tgt
    clear unless @target_index
end
end

class Game_Actor
attr_accessor :is_npc
end

class Game_Party
alias :members_full :members
def npcs
    members.select {|actor| actor.is_npc }
end

def members_without_npcs
    normal_members = @actors.map {|actor_id| $game_actors }
    normal_members.reject {|actor| actor.is_npc }
end

def members
    $game_temp.in_battle ? members_without_npcs : members_full
end

def actor_as_npc(n)
    members_full.is_npc = true
end

def npc_as_actor(n)
    members_full.is_npc = false
end
end


Terms & Conditions

Free for use in non commercial games but you gotta own a legal copy of the engine.

Due credit is mandatory!

That's it!



本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/non-kombatant-vx.171551/
页: [1]
查看完整版本: Non Kombatant VX