XAS Heroes No Enemy Re-spawn

Hello everyone of HBGames, I'm working on a game using the script XAS Heroes.

I've been working on this project for some time and haven't had any troubles so far. However I've stumbled on a problem that I can't get my head around.

Basically once I've killed a certain enemy in the game I want it to stay dead, so when a player returns to the previous map he isn't faced with the same enemies again. I've notice that the script already locates the event and uses an equivalent of the "erase event" event command, if that helps.

I don't want to use the 'Script Editor' -> 'BATTLER' -> 'DEFEAT_SWITCH_IDS' because they aren't bosses and I have hundreds of them around the map. Is there a way to perhaps turn on a self switch for certain enemies in regards to the same way a defeat_switch_id works?

Something like how the Defeat Switch IDs work as in example below

Content Hidden Spoiler
DEFEAT_SWITCH_IDS = {
7=>57,
18=>116,
26=>106,
27=>114,
31=>131,
35=>135,
39=>139,
42=>144,
40=>205,
45=>202,
46=>203
}


But turning on Self Switch instead depending on the enemy as in example below...

Content Hidden Spoiler
DEFEAT_SELF_SWITCH_IDS = {
7=>A,
18=>B ,
26=>B,
27=>B,
31=>B
}


I wouldn't like this for all monsters just certain ones I add to the list (similar to how DEFEAT_SWITCH_IDS work)

If anyone has any suggestions or know of a solution that I would have over looked I would greatly appreciate it.

Your friend rpg-dutch
Hi, I don't have the script at hand nor am I familiar with it, however you might want to do Ctrl+F and type "game_switches" and try and find where the switch is set on or off, and paste it here. That would give us something to work with. It should be possible, there will be something like this:

# if defeat
$game_switches[DEFEAT_SWITCH_IDS[enemy_id] == true

Instead you'd want to replace with something like:

# if defeat
$game_self_switches[map_id, event_id, DEFEAT_SELF_SWITCH_IDS[enemy_id]] == true
Ahh, I had the exact same thoughts-- and here's the perfect solution for you (similar to como's example).

Under the "Battler" script, find "DEFEAT_SWITCH_IDS" and underneath add a new section called "DEFEAT_SELFSWITCH_IDS". Use the same format as before, except instead of the ID of the switch state the letter in quotations. (example below)
  1. DEFEAT_SELFSWITCH_IDS = {
  2.   1=>"A",
  3.   2=>"C"
  4. }
Expand to see the code.


Now under "System" find "XAS_BA_ENEMY::DEFEAT_SWITCH_IDS" (it should be around line 2100, tho it depends on the version). Under the "if switch_id != nil" chunk (after "end"), add the following code:
  1. selfswitch_id = XAS_BA_ENEMY::DEFEAT_SELFSWITCH_IDS[self.enemy_id]
  2. if selfswitch_id != nil
  3.   $game_self_switches[[$game_map.map_id, self.id, selfswitch_id]] = true
  4.   $game_map.refresh
  5. end
Expand to see the code.


And that should do the trick.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=70953