How do I...make a cutscene happen no matter how your HP drops to 0?

Joined
Jul 12, 2020
Messages
192
Reaction score
41
First Language
English
Primarily Uses
RMMV
This one's a bit lengthy, so I apologize in advanced.
So in this screenshot, I am showing you the Knockout State in my game that triggers the custom effect when being applied in the Notetags. The top notetag calls common event #151.
Screen Shot 2021-06-18 at 12.36.54 PM.png


Anyway, in my game, there are some obstacles that try to make your HP drop to 0 in the overworld. And no matter how that HP reaches 0, I want it to trigger this coding in the screenshot through the common event.
Common Eveny 151.png

As you can see, this common event (#151) is triggered (on Autorun) through a Switch #0062. So I figured I could try and use it this way...here's an example of an obstacle that can deal 26 HP of damage, and allows the KO. If the player touches the moving obstacle, all these lines of code execute:
Screen Shot 2021-06-18 at 1.14.38 PM.png

The weird thing is...it doesn't happen. I thought that conditional branch would allow the cutscene to work, but the game just awkwardly cuts to the game over screen which I don't want.

What's strange to me is that the cutscene gimmick works just fine with another obstacle I have that inflicts poison damage:
Screen Shot 2021-06-18 at 12.42.51 PM.png
Whenever the actor loses HP from being inflicted with the poison damage, or directly touching this -1 HP obstacle, the cutscene works just fine.

I'm not really sure why I can't get certain scripted damaging events to work while others don't. Could it be that I am not executing the code correctly? It's kind of confusing for me, and I'm hoping someone can help me figure this out.
 

Attachments

  • Screen Shot 2021-06-18 at 12.35.54 PM.png
    Screen Shot 2021-06-18 at 12.35.54 PM.png
    91.6 KB · Views: 12
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,325
Reaction score
8,383
First Language
German
Primarily Uses
RMMV
have you cropped away several control variable commands at the beginning?
if not, you're missing at least 3 times control variable to update the other three variables.

if yes, please do not do that - it is very difficult to help if people crop away important information from their screenshots.
 
Joined
Jul 12, 2020
Messages
192
Reaction score
41
First Language
English
Primarily Uses
RMMV
Ahh, in that 3rd screenshot with the -26HP obstacle, those cropped variables are to simply check the player's X,Y position through Map X and Map Y, and uses conditional branches to see if it matches the Map X and Map Y of the moving obstacle's X,Y position. I didn't think it would be that relevant, but I'll go ahead and edit it in.
 

Htlaets

Veteran
Veteran
Joined
Feb 1, 2017
Messages
243
Reaction score
121
First Language
English
Primarily Uses
If you have the state trigger the common event, you don't need conditions on the common event. Give it a "none" trigger and don't have a switch condition.

Also sounds like you need to make it so that knockout of entire party on map != game over.
 
Last edited:
Joined
Jul 12, 2020
Messages
192
Reaction score
41
First Language
English
Primarily Uses
RMMV
If you have the state trigger the common event, you don't need conditions on the common event. Give it a "none" trigger and don't have a switch condition.
Yeah that's the weird thing, I have tested it out as such. It still doesn't work...during the -26HP obstacle, the game still awkwardly goes to the game over screen without the cutscene trigger. But it still works with the poison obstacles.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,302
Reaction score
693
First Language
English
Primarily Uses
RMMV
I think Htlaets has it on the nose - you're going at it oddly. You're both trying to have the event on an autorun from a switch and trying to call it through the Custom Apply - which, if the event is an autorun, won't do anything. You can, as far as I know, only make an autorun event happen by fulfilling its trigger, not by calling it manually.

However, the other trick is, I don't know if this will work the way you want. Knockout has several behaviors hard-coded into the engine, and it's very possible that Yanfly's Custom Apply can't make anything happen before the game over screen.

The second approach, damaging the party then checking the HP and setting the switch, definitely won't work - the game over screen will come up before the event gets to that line.

I would suggest that you test it by only damaging one actor, not the entire party - knock out one actor through your on-map event, see if the Custom Apply ever happens from Knockout getting applied.

You may need to just write a plugin of the function that shows the game over screen.
 
Joined
Jul 12, 2020
Messages
192
Reaction score
41
First Language
English
Primarily Uses
RMMV
I think Htlaets has it on the nose - you're going at it oddly. You're both trying to have the event on an autorun from a switch and trying to call it through the Custom Apply - which, if the event is an autorun, won't do anything. You can, as far as I know, only make an autorun event happen by fulfilling its trigger, not by calling it manually.

However, the other trick is, I don't know if this will work the way you want. Knockout has several behaviors hard-coded into the engine, and it's very possible that Yanfly's Custom Apply can't make anything happen before the game over screen.

The second approach, damaging the party then checking the HP and setting the switch, definitely won't work - the game over screen will come up before the event gets to that line.

I would suggest that you test it by only damaging one actor, not the entire party - knock out one actor through your on-map event, see if the Custom Apply ever happens from Knockout getting applied.

You may need to just write a plugin of the function that shows the game over screen.

Ahh, this is what I was afraid of. I think it just might have to do with the plugin. I just tested your 2nd approach method, and it didn't work either.
What's strange to me is that it's working fine for the poison obstacles, but not for any other obstacles I try to create through scripted damage events. So to me, this implies there's some way to pull it off, but I can't seem to recreate it.

For instance, unrelated, there is a "trap" you can trigger by picking a wrong option, and the cutscene won't work there when the damage is dealt. (I am assuming it's because as you said, the Game Over screen comes before any of the other lines of code are executed). It's a little bonkers.

Also, for the last part, I don't know how to write plugins. Perhaps there is a different approach to triggering this cutscene?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,302
Reaction score
693
First Language
English
Primarily Uses
RMMV
Have you tried a search to see if anyone's already written a plugin to insert events on a Game Over?

Here:
 
Last edited:
Joined
Jul 12, 2020
Messages
192
Reaction score
41
First Language
English
Primarily Uses
RMMV
Have you tried a search to see if anyone's already written a plugin to insert events on a Game Over?

Here:

Ahh, yeah. This one seems promising:

I'm just trying to figure out how to convert it to a .js file so I can test it out.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,325
Reaction score
8,383
First Language
German
Primarily Uses
RMMV
I didn't think it would be that relevant, but I'll go ahead and edit it in.
the three control variables were not that relevant, but it left open whether or not more important information was cut away - and indeed there was, because I assumed that was a common event and not a map event, and map events behave slightly different than common events.

Thatsaid, your conditional branch checking for the knockout state should be change to check for HP=0, because there is a very important difference between the two.

yes, the engine tries to give the knockout state to any actor or enemy that reaches HP=0. The important part here is TRIES - it doesn't always do so. If an actor or enemy has resistance to knockout state, it can be active with HP=0 and does not receive the knockout.
In fact, that is used for several tricks in battle, because battle ends automatically (before troop events are processed) as soon as all battlers of one side have the knockout state. By giving them an immortal state and have the troop events at HP=0 remove that state, you can have the troop events do other things before the battle ends.

And this might be a solution for you here as well, by stopping the engine from reacting to full knockout and having your events be called then to prepare for anything else to happen.
 
Joined
Jul 12, 2020
Messages
192
Reaction score
41
First Language
English
Primarily Uses
RMMV
Copy the text, paste it into Notepad. Save it as Kath_GameOver.js.
Oh, I forgot to mention, I am using a Mac. TextEdit is like the notepad of Windows. So it's not exactly that easy without being forced to save it as ".rtf".
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,302
Reaction score
693
First Language
English
Primarily Uses
RMMV
You can't just...rename a file on your Mac? o_O Download Atom? I dunno, someone else will have to offer you computer support.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,325
Reaction score
8,383
First Language
German
Primarily Uses
RMMV
doesn't matter - you can change the extension by editing the name in both systems the same way.

EDIT: however it should be saved as txt, not as rtf, because RTF has format information that would cause problems for javascript
 
Joined
Jul 12, 2020
Messages
192
Reaction score
41
First Language
English
Primarily Uses
RMMV
Ahaha, yes!! The plugin I tried is working perfectly : D
Thank you all that made suggestions and offered help. Really appreciate y'all.
 

Latest Threads

Latest Posts

Latest Profile Posts

Sometimes a mechanic that is meant to add challenge is just annoying. Even the Final Fantasy games did not completely escape this pitfall of design. (FF8 draw system I'm looking at you - grrrr)
starting working on the sprites for one of my games major antagonists finally. here's the first frame of his chanting motion in battle.
Have spent too much time hammering out with a friend just how to make a reoccurring enemy that permanently learns skills you use against her.
I know what I want in a loose sense. Maybe I should just make a post asking for opinions and suggestions.
Shoot Enemy Off-Screen, Run RPG Maker Game as a Web Server, & Thai Keyboard | RPG Maker News #109

Forum statistics

Threads
113,734
Messages
1,077,036
Members
147,762
Latest member
Bad_At_Scripting
Top