Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Makoto77 on November 25, 2020, 09:02:46 pm

Title: [XP] Untargetable Enemies?
Post by: Makoto77 on November 25, 2020, 09:02:46 pm
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.
Title: Re: [XP] Untargetable Enemies?
Post by: KK20 on November 26, 2020, 01:17:29 am
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
Title: Re: [XP] Untargetable Enemies?
Post by: Makoto77 on January 07, 2021, 04:10:03 pm
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.
Title: Re: [XP] Untargetable Enemies?
Post by: KK20 on January 08, 2021, 01:06:50 am
Can you explain more by what you mean? It looks functional to me.
Title: Re: [XP] Untargetable Enemies?
Post by: Makoto77 on January 28, 2021, 05:51:28 pm
When applied to actors, they are still visible but can do nothing.
I applied it to enemies because it allows for random attacks (with frequency values)
Title: Re: [XP] Untargetable Enemies?
Post by: KK20 on January 28, 2021, 10:36:51 pm
Can you instead just give me a screenshot of what you expect it to look like. You literally just said the exact same thing again.
Title: Re: [XP] Untargetable Enemies?
Post by: Makoto77 on January 29, 2021, 01:48:42 am
There's literally nothing else I can say.
What I intended is for the actors to be completely invisible.
My problem has been fixed though; untargetable enemies that help the player fulfill the same role.