MZ Return to Inn/Designated Area After Death Plugin (Event Solution Created)

Good evening all. I'm looking to set up Inns/Rest areas in my game.

Ideally if the party loses a battle, rather than simply a "Game Over" i'd like to have the active party transfer to the last Inn used or to a predetermined map location.

Anyone know of any plugins that exist for this?


In the Meantime I've Common Event and Switched a Solution using VisuStella Battle Core MZ as a foundation


Here's what I did in case someone else comes along and finds this:

As @caethyril stated, Defeat Event is the go to for setting up the Common Event to run after a defeat. Adding an event here seems to completely dodge the Game Over Screen.

Set up 3 Variables, 2 Common Events, and 2 Switches (for my project I set up 6 switches since I have extra story points, but I made a a simple sample for anyone to use below)

Spoiler: VARIABLES AND SWITCH
VARIABLES
  1. Last In Visited ID
  2. Last In Visited X
  3. Last In Visited Y

SWITCHES:
  1. Return to Inn (This Switch Should be OFF by Default for you project, else there are no coordinated stored to transfer to when you party is defeated). ON should be added to each Inn/Rest Area
  2. Event Battle (Optional) ON Added at the beginning of Event Battles that involve If Lose conditions. OFF should be run at the end of the Defeat Event

Spoiler: COMMON EVENTS
COMMON EVENTS:
  1. Inn Visited: runs at the End of Every Inn Interaction:

    View attachment 242962


  2. Defeat Event: run by Battle Core on Party Defeat:
    View attachment 243011
If the party has not yet visited an Inn, the ELSE defines where the party will be transferred to by default. This is to avoid the game breaking and why I noted that the "Return to Inn" switch should be OFF by default. (Alternatively you can have the coordinates designated at the games opening using an Autorun event)

Spoiler: INN EVENTS


It is your decision whether to have the common event run anytime the conversation occurs, upon entry to the Inn (Pokémon center style) or only if you choose to rest there. For my purposes having the conversation is enough for now.

UPDATE:
This event will run even for non-random/event based battles. So if you have a "If Lose condition that involves a transfer that will occur and then the "Defeat Event" will still run. To avoid this, create an additional Switch called "Event Battle" Updated Images above ^



I hope this is helpful to someone in the future and aids the community to avoid similar questions coming up! Open to feedback from anyone that can think of any tweaks to streamline this and/or if there is just generally a plugin that exists to solve for this. However the less plugins the better sometimes!



Thanks all



Going to update the thread title to make this more searchable
Ideally if the party loses a battle, rather than simply a "Game Over" i'd like to have the active party transfer to the last Inn used or to a predetermined map location.
I also want to know if there is a plugin that can do it. For now I just create a common event and put it on every battle event.
I also want to know if there is a plugin that can do it. For now I just create a common event and put it on every battle event.
Definitely a solution, however I have random encounters and want that to be an auto function as well.

In the same vein as Pokemon Centers being where you load back to when your party gets wiped
Definitely a solution, however I have random encounters and want that to be an auto function as well.

In the same vein as Pokemon Centers being where you load back to when your party gets wiped
I found something that maybe you can use :

you can look for noGameOver2.JS for RMMZ if I'm not mistaken.

or


Sorry I can't test it myself since I can't touch my computer right now. 😔
For now I just create a common event and put it on every battle event.
If the plugin doesn't work out for you or if you want to do more than this specific thing on certain battles ends, there is a simple eventing solution which would save you having a common event in every troop.

It is easiest if you have VisuStella's Battle Core as you can put a switch in Base Troop and it will automatically run for every troop. If you have not got battle core, you will need to put the switch on every troop and turn it ON at turn zero.

  • Switch (name it, e.g. Battle Start) ON at turn zero. Does nothing else.
  • Common Event, parallel process, conditioned by Battle Start switch. Parallel processes don't run during battle, so you needn't worry about performance etc.
  • Put everything there that you want to happen after the battle ends. I have a range of battle bonus calculations and notifications, remarks the party makes after certain skill usages, etc. etc.
  • The last command must be switch OFF.
If the plugin doesn't work out for you or if you want to do more than this specific thing on certain battles ends, there is a simple eventing solution which would save you having a common event in every troop.

It is easiest if you have VisuStella's Battle Core as you can put a switch in Base Troop and it will automatically run for every troop. If you have not got battle core, you will need to put the switch on every troop and turn it ON at turn zero.
This?

1666099642818.png


Answered my own question.


For the "Defeat Event" how would I save the location from an inn or such to make sure the party returns there for that Common Event?
If you're using VisuStella Battle Core, it looks like the Common Events (on Map) -> Defeat Event parameter would be ideal here. From the plugin's help:

- If the "Defeat Event" has a common event attached to it, then random encounters will be changed to allow defeat without being sent to the Game Over scene. Instead, the game will send the player to the map scene where the Defeat Event will run.
If you're using VisuStella Battle Core, it looks like the Common Events (on Map) -> Defeat Event parameter would be ideal here. From the plugin's help:
Answered my own question previously and editted before I realized you responded so I'll ask again,


For the "Defeat Event" how would I save the location from an inn such to make sure the party returns there for that Common Event?
One way of doing it if you want to stick to using a common event is to set a variable to the inn location, for example Inn in Town A = 5, Inn in Town B = 10 etc. so that entering an Inn sets the variable to that particular inn.

In your common event check what the variable is (a series of conditionals) and do a transfer player based on that.
Would you want it to automatically record a place as an "inn" any time you used a recover all event command, or would you rather have a plugin command to set the respawn point manually?
After semi-intense tinkering that I knew I could've figured out on my own last night but was too tired to try, I think I have this exactly where I want it.

Here's what I did in case someone else comes along and finds this:

As @caethyril stated, Defeat Event is the go to for setting up the Common Event to run after a defeat. Adding an event here seems to completely dodge the Game Over Screen.

Set up 3 Variables, 2 Common Events, and 2 Switches (for my project I set up 6 switches since I have extra story points, but I made a a simple sample for anyone to use below)

Spoiler: VARIABLES AND SWITCH
VARIABLES
  1. Last In Visited ID
  2. Last In Visited X
  3. Last In Visited Y

SWITCHES:
  1. Return to Inn (This Switch Should be OFF by Default for you project, else there are no coordinated stored to transfer to when you party is defeated). ON should be added to each Inn/Rest Area
  2. Event Battle (Optional) ON Added at the beginning of Event Battles that involve If Lose conditions. OFF should be run at the end of the Defeat Event

Spoiler: COMMON EVENTS
COMMON EVENTS:
  1. Inn Visited: runs at the End of Every Inn Interaction:

    1666107951104.png



  2. Defeat Event: run by Battle Core on Party Defeat:
    1666192410588.png
If the party has not yet visited an Inn, the ELSE defines where the party will be transferred to by default. This is to avoid the game breaking and why I noted that the "Return to Inn" switch should be OFF by default. (Alternatively you can have the coordinates designated at the games opening using an Autorun event)

Spoiler: INN EVENTS
INN EVENTS:
1666108325067.png


It is your decision whether to have the common event run anytime the conversation occurs, upon entry to the Inn (Pokémon center style) or only if you choose to rest there. For my purposes having the conversation is enough for now.

UPDATE:
This event will run even for non-random/event based battles. So if you have a "If Lose condition that involves a transfer that will occur and then the "Defeat Event" will still run. To avoid this, create an additional Switch called "Event Battle" Updated Images above ^



I hope this is helpful to someone in the future and aids the community to avoid similar questions coming up! Open to feedback from anyone that can think of any tweaks to streamline this and/or if there is just generally a plugin that exists to solve for this. However the less plugins the better sometimes!



Thanks all



Going to update the thread title to make this more searchable
After semi-intense tinkering that I knew I could've figured out on my own last night but was too tired to try, I think I have this exactly where I want it.

Here's what I did in case someone else comes along and finds this:

As @caethyril stated, Defeat Event is the go to for setting up the Common Event to run after a defeat. Adding an event here seems to completely dodge the Game Over Screen.

Set up 3 Variables, 2 Common Events, and 1 Switch (for my project I set up 5 switches since I have extra story points, but I made a a simple sample for anyone to use below)

Spoiler: VARIABLES AND SWITCH
VARIABLES
  1. Last In Visited ID
  2. Last In Visited X
  3. Last In Visited Y

SWITCH:
  1. Return to Inn (This Switch Should be OFF by Default for you project, else there are no coordinated stored to transfer to when you party is defeated)

Spoiler: COMMON EVENTS
COMMON EVENTS:
  1. Inn Visited: runs at the End of Every Inn Interaction:

    View attachment 242962


  2. Defeat Event: run by Battle Core when needed:

    View attachment 242961
If the party has not yet visited an Inn, the ELSE defines where the party will be transferred to by default. This is to avoid the game breaking and why I noted that the "Return to Inn" switch should be OFF by default. (Alternatively you can have the coordinates designated at the games opening using an Autorun event)

Spoiler: INN EVENT
Spoiler: INN EVENT
It is your decision whether to have the common event run anytime the conversation occurs, upon entry to the Inn (Pokémon center style) or only if you choose to rest there. For my purposes having the conversation is enough for now.



I hope this is helpful to someone in the future and aids the community to avoid similar questions coming up! Open to feedback from anyone that can think of any tweaks to streamline this and/or if there is just generally a plugin that exists to solve for this. However the less plugins the better sometimes!



Thanks all



Going to update the thread title to make this more searchable
I'm still going to write this as a plugin if that's cool with you. Were you originally planning for it to record inns automatically by some criteria, or do be a manually-triggered thing via plugin command like your common event does?
I'm still going to write this as a plugin if that's cool with you. Were you originally planning for it to record inns automatically by some criteria, or do be a manually-triggered thing via plugin command like your common event does?
By all means, not everyone has the extra (too many) hours spent to build out common events like I did lol.


You raise a great question. I think the easiest implementation would be by manually triggering by plugin command within an "Inn" event. Granted having this purely parameters based would be much better QoL wise for folks that don't want to accidentally forget to add the command anytime they build a new Inn.

What are some criteria you have in mind to track when an Inn occurs to put that location?
By all means, not everyone has the extra (too many) hours spent to build out common events like I did lol.


You raise a great question. I think the easiest implementation would be by manually triggering by plugin command within an "Inn" event. Granted having this purely parameters based would be much better QoL wise for folks that don't want to accidentally forget to add the command anytime they build a new Inn.

What are some criteria you have in mind to track when an Inn occurs to put that location?
My initial thought was to have an optional <inn> notetag you can add to the event which will cause "recover all" commands inside it to record the location as an inn visit.
My initial thought was to have an optional <inn> notetag you can add to the event which will cause "recover all" commands inside it to record the location as an inn visit.
I like that a lot mate. I'd request to include the option to track the Player Location at the beginning OR end of the event. This will determine if the party respawns outside of the building (Pokemon Center style) or inside of the Inn.
I like that a lot mate. I'd request to include the option to track the Player Location at the beginning or end of the event. This will determine if the party respawns outside of the building (Pokemon Center style) or inside of the Inn.
That would only work in games where the inn door functions as the event that executes it, otherwise how would you know which building to respawn outside of?
That would only work in games where the inn door functions as the event that executes it, otherwise how would you know which building to respawn outside of?
That's why I'm saying to include it as an option. If folks would rather the inn event to run when they're talking to an NPC then Before or After wouldn't matter unless there's another transfer involved.

Scenarios: The first line is where <inn> would be added to the event notetag

Ex 1:

Player Enters Inn Door
Beginning : Player Respawns outside of building
After: Player Respawns Inside of Inn

Ex 2

Player Talks to Innkeeper to stay, Gets Transferred to Bed at the Inn
Beginning: Player Respawns at counter of Inn
After: Player Respawns in the bed of the Inn


It gives the game dev a bit more control about how they want their Inns and Respawns to work.
That's why I'm saying to include it as an option. If folks would rather the inn event to run when they're talking to an NPC then Before or After wouldn't matter unless there's another transfer involved.

Scenarios: The first line is where <inn> would be added to the event notetag

Ex 1:

Player Enters Inn Door
Beginning : Player Respawns outside of building
After: Player Respawns Inside of Inn

Ex 2

Player Talks to Innkeeper to stay, Gets Transferred to Bed at the Inn
Beginning: Player Respawns at counter of Inn
After: Player Respawns in the bed of the Inn


It gives the game dev a bit more control about how they want their Inns and Respawns to work.
I don't think I'm conveying my point effectively. If you do it with <inn> notetags looking for Recover All commands to make it record positions automatically, it would only be capable of recording the position you're in when you interact with the innkeeper event, because outside of that there is no connection between that event and the map the *outside* of the inn resides on. It could be any map, at any coordinates. There's no data linking them that the plugin could reference.

The notebox is neither at the beginning nor the end of an event, the note is separate from the contents. Or were you thinking *comment* rather than notetag?

Or are you imagining that it would just record your position when you interact with any event with an <inn> tag regardless of whether you stay there or not? Because then you'd end up respawning at inns you've only visited but not stayed at, which I didn't think was the goal.

This should hopefully make things clearer:

Without <inn> notetag: in inn event, place a "record respawn position" plugin command. Set the map, X and Y to wherever you want the player to spawn if they die, be it outside the inn, at the counter or in bed

With <inn> notetag: this is done automatically for you, but you're limited to the inn counter as a respawn point.
Ahhh I gotcha now. So it would always be "Beginning" since its the notetag on the event.



In that regard then I'd say a comment or plugin command in the events contents might be better.

Or at the very least make it so a dev can choose Notetag OR Comment (via plugin parameter perhaps) for some flexibility/customization. Could also have just Notetags take priority over comments/commands if a dev accidentally adds both to an event?


Hows that sound?
Ahhh I gotcha now. So it would always be "Beginning" since its the notetag on the event.



In that regard then I'd say a comment or plugin command in the events contents might be better.

Or at the very least make it so a dev can choose Notetag OR Comment (via plugin parameter perhaps) for some flexibility/customization. Could also have just Notetags take priority over comments/commands if a dev accidentally adds both to an event?


Hows that sound?
I mean...if they wanted to choose plugin command, they could just not put the notetag in. It's already optional by the nature of its design.

Original thread: https://forums.rpgmakerweb.com/threads/return-to-inn-designated-area-after-death-plugin-event-solution-created.152045/