How to make an enemy disappear in-battle without impacting names?

There's a boss battle I'm making where enemies appear, then disappear.


So, Enemy A appears. Couple turns later, Enemy A disappears. Couple turns later, Enemy B appears. Couple turns later, Enemy B disappears. Couple turns later, Enemy C appears, couple turns later, Enemy C disappears.


This part works just fine. However, the issue is that Enemy A is just called Enemy. Then, Enemy B is suddenly.. Enemy B. And then, Enemy C is Enemy C. At first, I thought it may have something to do with the fact that you're having multiple enemies appear, through the "Enemy Appear" command. The first one won't be given a suffix because it's the only instance of it, but subsequent ones are given a suffix. So, I used this snippet:


$game_troop.members[1].hide




As far as I know, this is the OPPOSITE of the "enemy appear" command. The proper enemy disappears. However, Enemy B still has that damned B suffix, and Enemy C the C suffix.


I DON'T want to remove the suffix entirely from all fights, I want to remove it on merely THIS ONE fight, that's it.


It's also worth noting that I attempted to write an incredibly ugly snippet for this, as well.


class Game_Enemy
if $game_switches[500] == true
def name
@original_name + (@plural ? letter : "")
end
else
def name
@original_name
end
end
end


However, I'm suspecting that this won't work for a multitude of reasons. Obviously, it doesn't work at the moment or I wouldn't be posting. But I don't suspect it will ever work, either, simply because the Game_Enemy class is loaded before the switch would be turned on.


Perhaps there's a way to force the @plural boolean to off, instead? I don't know. At this point, I'm looking for anything.
What are you trying to accomplish?  It sounds like you want the enemy to change into different enemies throughout the battle.  In that case, use the Enemy Transform command instead so you only have one enemy.
The enemy, Glimpse, appears. It disappears when killed, or other prerequisites are met. Then, it reappears elsewhere. However, on the engine side, it's actually 3 separate enemies.
Code:
class Game_Troop < Game_Unit
  def setup(troop_id)
    clear
    @troop_id = troop_id
    @enemies = []
    troop.members.each do |member|
      next unless $data_enemies[member.enemy_id]
      enemy = Game_Enemy.new(@enemies.size, member.enemy_id)
      enemy.hide if member.hidden
      enemy.screen_x = member.x
      enemy.screen_y = member.y
      @enemies.push(enemy)
    end
    init_screen_tone
    make_unique_names unless $game_switches[500]
  end
end

Turn switch 500 ON prior to entering this battle, and off again afterwards.
Doesn't seem to work.


nopechucktesta.png


Tried it with and without the snippet to hide enemy A. Enemy A is dead by the time Enemy B appears. I've tried it in engine, on a new save file, above combat scripts and below them. Perhaps I mis-worded myself; it isn't three separate enemies in the enemies database. Rather, it's three separate instances of one enemy. If it's meant for three separate enemies in the database, however, I can work with that.


Hell, if there was a reasonable way to change a pictures location on the Z axis, this wouldn't be an issue, either. All I want is an image between the battlebacks and enemies. Or a way to swap out the battleback. Right now, I overlaid the image and deleted the HUD details, all the meanwhile changing which pictures are up in order to achieve that effect.
Did you save it first?  Are you doing a battle test, or testing the actual game?  Add the script, save it, then play the game (not battle test).  And did you turn switch 500 on before this battle?  It needs to be done in the event prior to the Battle Processing call, not within an event on the troop tab - it's too late by then.


If you're sure you've done everything correctly, please post a screenshot of your event that shows where you set everything up and call the battle.
Testing the actual game. I hadn't tried saving the game, and this is what I did event-wise:


nopechucktesta2.png


But, don't worry about it. After your script mentioned "make_unique_names" I got a dumb idea. I created two more enemies in the DB, and named them "Glimpse," " Glimpse," and "  Glimpse." One has one space before it, the second has two. Turns out that was enough to get the B and C suffixes to disappear.


Thank you very much for your help today, Shaz. Without you, it never would've gotten solved 🙂
I did wonder about using different enemies that just had the same name, but figured if it goes by name instead of enemy id it'd do the same thing anyway.  Good thinking about putting in the spaces 😉   I suspect you could also have put them at the end and it would have worked too.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-an-enemy-disappear-in-battle-without-impacting-names.69572/