NikoPalad

Veteran
Veteran
Joined
Nov 29, 2020
Messages
101
Reaction score
49
First Language
English
Primarily Uses
RMMZ
Hey guys!
I have two questions concerning battles:
1. The CanLose attribute is present in map events. Does that work in the database as well?
2. With the CanLose condition enabled, how can I make my characters return to a place (i.e. a church) once they got defeated?
 

SGHarlekin

Orc Jester
Veteran
Joined
Jun 29, 2020
Messages
555
Reaction score
479
First Language
German
Primarily Uses
RMMV
If you have "Can lose" enabled, the game will just return to the screen. You return your player by using a transfer command inside the "if lose" branch.

I'm going to assume you're talking about random encounters when referring to "in the database". Random encounters don't act like a regular event, so there's no "Can lose" option. But I'm sure you can get around that with a troop event or common event.
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
6,303
Reaction score
2,462
First Language
Dutch
Primarily Uses
RMMV
the best way is to have a troop event (if random encounters),
and check for each player < 0% hp.

if so, transfer the player where you want to go.

for onMap encounter, SGHarlekin told you the answer for condition branch
in the "can lose" option.

however you approach that is up to you.

I would recommend to create a commom event for it, so you dont
need to alter every event if you make a mistake.
 

TheAM-Dol

Randomly Generated User Name
Veteran
Joined
Feb 26, 2022
Messages
241
Reaction score
242
First Language
English
Primarily Uses
RMMV
2. With the CanLose condition enabled, how can I make my characters return to a place (i.e. a church) once they got defeated?
Yes, quite easily. Actually, this is how my own game handles death; players are sent back to the town (and a small fee is leveraged from them).
After the "Can Lose" condition, you can set up what happens next, such as "Transfer Player". You can simply set the Transfer Player destination according to where they should respawn - though that only works if you only have 1 town or 1 respawn location. I'll come back to this in a moment if you have more than 1 possible location.

Ideally, if you are linking this lose condition to every single fight in the game, it's going to save you a lot of time copy-pasting or even rebuilding all of the same logic over and over again if you just build it into a common event and then call the common event whenever the lose condition is met. Run any necessary checks, reset any necessary values or switches, then transfer the player to the location. In my case (I don't know if this is the most efficient way of handling this), I have a "PlayerDied" switch. When the lose condition is met (the player dies), this switch gets turned on through the Death common event. After the player respawns at the town, the "PlayerDied" switch activates a parallel event at the town which just handles some flavor dialogue so the player character can make a remark about "dying". (after the remark, it turns the "PlayerDied" switch off)

Now, if you are using the "Death" common event method but have multiple possible respawn locations, you could assign the respawn location based on either map ID or variable map location X/Y (or both) since "Transfer Player" allows for assigning these values.
Basically, when the player enters a town for the first time, an event should run that updates the assigned variables in the "Transfer Player" command from your "Death" common event. And each time your player goes to a new town, a new version of this event should run to update the values accordingly. If the player always respawns inside a church, and all the churches look identical, then the only value you would need to change is the map ID.
 

NikoPalad

Veteran
Veteran
Joined
Nov 29, 2020
Messages
101
Reaction score
49
First Language
English
Primarily Uses
RMMZ
I would recommend to create a commom event for it, so you dont
need to alter every event if you make a mistake.
This looks promising, but that would mean I can only do that for specific troops, right? How can I do it for all of them?
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
6,303
Reaction score
2,462
First Language
Dutch
Primarily Uses
RMMV
for MZ, not sure, there is YEP_BaseTroop that handle 1 ID and count
for all of them.

alternatively, if you dont want a game over, you can overwrite how
GameOver handles, instead of Game Over screen, it transfer the player.

I dont own MZ to make this happen, but if you leave out GameOver,
this is maybe the better way for you.

if you want a GameOver, you can overwrite it with a switch attached
to it for GameOver or Transfer (depending on what switch you use).

I can look into the MZ core plugins, but it handles things differently,
but should be around the same, or someone else make this change
for you :)
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
5,523
Reaction score
3,591
First Language
English
Primarily Uses
RMMV
You reference the common event in all of your troops.

You can also check if FOSSIL supports Yanfly's Base Troop Events.

You can also Google "RPG Maker MZ death event" and find this plugin:
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
6,303
Reaction score
2,462
First Language
Dutch
Primarily Uses
RMMV
could work, but you need a plugin for the battle part, similair like
ATT_Turan has linked, there might be others, but you need to
alter the GameOver scene or check parties HP below 0 (death)
in order what happend.
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
6,303
Reaction score
2,462
First Language
Dutch
Primarily Uses
RMMV
probably not so, GameOver plugin, visustella lunatic code if it
supports common events, and that event on MAP if running on
parallel process which should check if party on HP < 0, but it
doesn't work inside battles, so you need a plugin for that part.
 

Latest Threads

Latest Posts

Latest Profile Posts

I've never felt prouder of my little game!! *o*
DamageEvil_2.png added!
index.php

Forum statistics

Threads
125,672
Messages
1,172,710
Members
164,799
Latest member
PurpleClouds
Top