[XP] Untargetable Enemies?

Started by Makoto77, November 25, 2020, 09:02:46 pm

Previous topic - Next topic

Makoto77

How can I make an enemy untargetable? I'm trying to make temporary party members in Earthbound's style; you can't see their stats (as they are actually enemies), but they do follow you around and help with battles. Of course, neither allies nor enemies can target them.

KK20

If you want to treat "untargetable" as "not existing", then this script add-on should suffice:
class Game_Battler
  attr_accessor :untargetable
 
  alias init_for_untargetable_state initialize
  def initialize
    init_for_untargetable_state
    @untargetable = false
  end
 
  alias standard_exist_method_call exist?
  def exist?
    standard_exist_method_call && !@untargetable
  end
 
end
Now it's a matter of just figuring out how you want to use it. Various example script calls would be:
$game_actors[1].untargetable = true
$game_party.actors[0].untargetable = true
$game_troop.enemies[0].untargetable = true
And turning it off is as simple as replacing true with false. You might need the interpreter fix for that:
https://forum.chaos-project.com/index.php/topic,938.0.html

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Makoto77

January 07, 2021, 04:10:03 pm #2 Last Edit: January 08, 2021, 12:54:06 am by KK20
Thank you. I'll try this now.

EDIT: Works perfectly when applied to enemies, but party members are still visible and can't do anything when applied to them.

KK20

Can you explain more by what you mean? It looks functional to me.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!