Death Common Event

Chronosv2

Scripter / Aspiring Game Developer
Member
Joined
Oct 15, 2012
Messages
14
Reaction score
14
First Language
English
Primarily Uses
N/A
Hey there folks. Was just plugging away at MV, up-porting a project from scratch, and I decided my next task was going to be creating a "Common Event on Death" script since, as far as I was aware, none existed yet. A few minutes learning how data is handled, and that plugin is now complete.


The plugin is simple: place this somewhere in your combat plugins batch, and in any Actors, Classes or Enemies that need a common event to call on death, add this Note tag:

Code:
<DeathCommonEvent:ID>
ID = the common event ID you wish to call. For example:
  <DeathCommonEvent:3>
Common Event #3 will run when this character dies.
All it does is make an aliased call to Game_BattlerBase.die that checks if the Battler is an Actor or Enemy. If it is, it checks for the tag in both the Actor or Class, and if it finds one then it runs the common event referenced in the tag. Then it calls the original .die function. Note that because of this, any condition you set to the event will not be checked, same as if you were to use the "Common Event" event action.


If you are utilizing All Ally Dead or All Enemy Dead plugin parameters, you do not need to repeat that event ID in a character's note box. Having a one-member party with the same event as <DeathCommonEvent:ID> will not function -- if you are not using Common Event Queue, only the last common event initialized will be run.


If you are using Hime's Common Event Queue: Place this plugin below Common Event Queue. If you set the 'DCE Fallthrough' parameter to true, if a Class and Actor both have a Death Common Event, then both will run. The same also applies for Any Ally, Any Enemy, All Allies and All Enemy plugin parameters.


If you are not using Hime's Common Event Queue, the furthest Common Event down in the following list will be run:


For Player Characters: [Actor DCE] --> [Class DCE] --> [Any Ally DCE] --> [All Allies DCE (if all allies dead)]


For Enemies: [Enemy DCE] --> [Any Enemy DCE] --> [All Enemies DCE (if all enemies dead)]


Important Note: If you use All Ally Dead DCE, you will need to call Game Over yourself. This is because the Game Over screen would still trigger, even after a revive. I am sorry for the inconvenience. This also leads me to believe that enemies being somehow revived by All Enemy DCE probably won't work. I haven't had time to test this, however.


You can get the latest version of my plugin from my GitHub repository here: https://github.com/chronosv2/Cv2MVPlugins/blob/master/Cv2_DeathCommonEvent.js


Latest Version: 1.2.0 (5:17AM 10/27/2016)


Plugin is free for commercial and non-commercial use. I wrote it for convenience, and the plugin is generic so feel free to use it as you see fit.


Anyway, I hope you find this useful. Have a great day and happy RPG Making!


---


Changelog:


v1.0.0 - Initial version. Death Common Event worked for Actors only.


v1.1.0 - You can now set a Death Common Event to Actors, Enemies or Classes.


v1.1.1 - Added compatibility with Hime's Common Event Queue.


v1.1.2 - No idea why I didn't revert the version number, but I tried to use a filename-less plugin parameter parse and it failed (I clearly did something wrong) so I reverted the code to the old way. I will be revisiting the filename-less parameters system at a later time -- right now rapid development and deployment is a little more important. Sorry for the possible inconvenience.


v1.2.0 - Added 4 new Parameters:

  • All Ally Dead DCE: The Event ID to be run when All Allies are dead. This actually runs before Game Over, so it could be used to check for a condition to revive a party member, for example.
  • All Enemy Dead DCE: The Event ID to be run when All Enemies are dead. This actually runs before Battle Victory. I'm not exactly sure what this could be used for but it could be useful I'm sure.
  • Any Ally Dead DCE: The Event ID to be run when any Ally dies. This will only be run if the actor does not have an Actor or Class DCE. Next version will add the ability for more DCE fallthrough so that "Any" DCE will be run in sequence if Hime's Common Event Queue is loaded and DCE Fallthrough is set to true.
  • Any Enemy Dead DCE: The Event ID to be run when any Enemy dies. See above for information about fallthrough.

Caveats: While the new plugin version should open up options for the entire party being KO'ed (or entire enemy group), if you try to use it for a Dragon Quest-like Game Over you will run into problems at worst (it simply won't work if you try and do the transfer on the Battle Screen), and a glitchy looking system (the Status window reappears for a few frames) at best. If you would like defeat to still technically occur while having something secondary still happen, I suggest Tsukihime's Gameover Events plugin.
 
Last edited by a moderator:

Silent Darkness

Robomage
Veteran
Joined
Nov 28, 2013
Messages
2,284
Reaction score
321
First Language
English
Ahhh nice. That'll be one less plugin that Tsukihime needs to make.....or was it Yami.....or Yanfly... o~o
 

Chronosv2

Scripter / Aspiring Game Developer
Member
Joined
Oct 15, 2012
Messages
14
Reaction score
14
First Language
English
Primarily Uses
N/A
My version is intended to be quick and simplistic -- something to work until one of the better scripters out there makes a more comprehensive version.

I thought "Hey, someone might need this function sooner rather than later, and until Yanfly has their version out maybe others will find this useful."

It was definitely a learning experience, though! Seeing how everything has transitioned from VXA to MV has made my head spin a bit.
 

Elphoenix

Warper
Member
Joined
Jan 20, 2014
Messages
1
Reaction score
0
First Language
English
Primarily Uses
Could you try to make it work with Classes as well?
 

Chronosv2

Scripter / Aspiring Game Developer
Member
Joined
Oct 15, 2012
Messages
14
Reaction score
14
First Language
English
Primarily Uses
N/A
I'll see what I can do!

Edit: Already figured out how to do it, now just doing testing. Should be up in a few minutes.
 
Last edited by a moderator:

Chronosv2

Scripter / Aspiring Game Developer
Member
Joined
Oct 15, 2012
Messages
14
Reaction score
14
First Language
English
Primarily Uses
N/A
Updated to Version 1.1.0, which adds in a Death Common Event for classes, and the promised support for Enemies. Sorry it took so long -- I got caught up in trying to work on some of the more complicated plugins for the project I'm working on.

Do you need the game to handle a character with both an Actor Death Common Event and a Class Death Common Event? Unfortunately I haven't had any luck figuring out how to make that work just yet. It seems like if I try to allow that, the code skips over Class DCE.
 

Chronosv2

Scripter / Aspiring Game Developer
Member
Joined
Oct 15, 2012
Messages
14
Reaction score
14
First Language
English
Primarily Uses
N/A
I would suggest looking into Tsukihime's

Common Event Queue.

http://forums.rpgmakerweb.com/index.php?/topic/47857-common-event-queue/

It could either show you what needs to be done, or you could make it a dependancy for this plugin. This should fix only one common event firing.
Thanks for the tip! I checked the plugin out, and have added Common Event Queue compatibility to my Death Common Event plugin.

So now we're at Version 1.1.1.

As updated in my original post:

If you are using Hime's Common Event Queue: Place this plugin below Common Event Queue. If you set the 'DCE Fallthrough' parameter to true, if a Class and Actor both have a Death Common Event, then both will run.

If you are not using Hime's Common Event Queue and a Class and Actor both have a Death Common Event, then the Class Death Common Event will override the Actor DCE (Actor will not run.)
 
Last edited by a moderator:

DarkSlayerEX

Veteran
Veteran
Joined
Oct 26, 2015
Messages
95
Reaction score
9
First Language
English
Thanks for the tip! I checked the plugin out, and have added Common Event Queue compatibility to my Death Common Event plugin.

So now we're at Version 1.1.1.

As updated in my original post:

If you are using Hime's Common Event Queue: Place this plugin below Common Event Queue. If you set the 'DCE Fallthrough' parameter to true, if a Class and Actor both have a Death Common Event, then both will run.

If you are not using Hime's Common Event Queue and a Class and Actor both have a Death Common Event, the the Class Death Common Event will override the Actor DCE (Actor will not run.)
I'm glad I could help you with your issue. Keep up the good work, this plugin is very useful.
 

Archeia

Level 99 Demi-fiend
Developer
Joined
Mar 1, 2012
Messages
14,709
Reaction score
14,547
First Language
Filipino
Primarily Uses
VNM
Hi there! Is it possible to also have an option that's more of a global common event death (e.g. if everyone dies)?


I have an idea on how to implement it by events but I thought requesting a global one might work out too. :rhappy:
 
Last edited by a moderator:

Chronosv2

Scripter / Aspiring Game Developer
Member
Joined
Oct 15, 2012
Messages
14
Reaction score
14
First Language
English
Primarily Uses
N/A
Hi there! Is it possible to also have an option that's more of a global common event death (e.g. if everyone dies)?


I have an idea on how to implement it by events but I thought requesting a global one might work out too. :rhappy:
That should be doable. My understanding into the RPG Maker internals is still a little bit shallow (I've done some plugins for a project I'm a part of, rather than research into the engine) but it should be doable. I'll get to learn a little more about the RPGMaker processes at the same time.


Getting straight to work on this -- thanks for the feature request!
 

Chronosv2

Scripter / Aspiring Game Developer
Member
Joined
Oct 15, 2012
Messages
14
Reaction score
14
First Language
English
Primarily Uses
N/A
I've pushed out an update to Plugin Version 1.2.0 that I hope successfully fulfills your feature request. I did a little bit of testing and everything appears to work fine. To explain briefly how it works...


When a character dies, the plugin does a quick check to see if everyone else is dead, because I run the aliased Game_BattlerBase.die() function after my DCE code and as a result the character is still reported as Alive by the .isAlive() function (but since we know they're dying we don't really need to check that anyway). If even one member is alive the common event won't run. If everyone is reported dead, though, the Common Event triggers (and if you aren't using Hime's Common Event Queue, supersedes Battler and Class DCEs).


During my testing I decided to goof around and see if a common event with Recover All would revive the entire party, and amusingly it works. How far you can actually take the actions done on .die() I don't know, but I can see how this could be used to do some interesting things. I'm going to try one more thing out (that I'm hypothesizing won't work) and I'll edit this topic with the results -- I want to see if the All Allies Dead DCE can be used to subvert game over and teleport the player somewhere. -Edit: [Turns out that while you can recover the party and abort the battle, the moment the battle ends event execution halts. I tried to do a message, fade-out, recover, abort battle, map transfer, messages + half gold taken, fade-in and the game stopped processing immediately after aborting the battle. I would imagine that this would be possible if you had a switch turned on and a second common event set to run when that switch is active to do the rest, but on its own it fails. ]-


I also added in, because when I glanced at the New Reply notification e-mail from my phone and misread the original request (but thought it should still be implemented anyway) a "global" DCE to be run when any Ally or any Enemy dies, that only runs if the battler/class doesn't already have a DCE.
 
Last edited by a moderator:

Parralax

Warper
Member
Joined
Feb 4, 2016
Messages
4
Reaction score
0
First Language
English
Primarily Uses
Sorry to be a bother, but i can't seem to get this working!


I've put the tag in the note section




And have a common event to run




Maybe i've messed up somewhere or does the battle have to be an Event or can it just be a map encounter? I've been doing map encounters so far and when all allies die (only have 1) then it just runs the Gameover screen and nothing else, thanks for any help in advance!


EDIT: Just read the post above and looks like you can't do what i'm trying to (teleoprt the character out of the map when dead) sorry for this post! I don't think i can delete so if anyone sees this who can then feel free to delete it.
 
Last edited by a moderator:

Chronosv2

Scripter / Aspiring Game Developer
Member
Joined
Oct 15, 2012
Messages
14
Reaction score
14
First Language
English
Primarily Uses
N/A
Hey, no worries. If you want to do something like that, though, have a common event turn on a switch, then abort the battle. Have the switch do the teleport.


For instance:

Party Dead Death Common Event:


Fadeout Screen


Recover All: Entire Party


Control Switch: 8 ON


Abort Battle


On-Map Common Event: Condition = Switch 8 ON, AutoRun


Transfer Player


Display Message


Fadein Screen



This will do what you're looking for, but I think perhaps Hime's GameOver Events might do a better job, and look a whole lot less awkward than my implementation.


EDIT: I'll add the "Doesn't work well for game-over teleport" warning to the initial topic so that others know this without having to read through the entire thread. Sorry for the inconvenience, Parralax!
 
Last edited by a moderator:

Lil Jbm

Warper
Member
Joined
May 10, 2015
Messages
3
Reaction score
0
First Language
English
Primarily Uses
Hello, sorry if my problem is super simple, I'm probably doing something wrong that's very obvious but for the life of me I just can't figure it out. I put your plugin in my plugins folder and turned it on in the plugins manager for my project and then I created a common event and put the notetag <DeathCommonEvent:7> in the actor I want to die's note space. But no matter what I do or try whenever the actor dies in the battle nothing happens, no event is called, and it doesn't give me any implications that it worked at all. I even tried putting the notetag in both the actor's note box and it's class, but still nothing upon death. I even tried creating an entirely new project, had nothing but your plugin active in it, tried the same thing with a much simpler common event (just a text box) and still nothing when the actor dies. This is the common event I am trying to have run during battle when my actor dies:


Common Event.png


This is the actor's page with the notebox having the appropriate notetag:


Notebox.png


This is the plugin screen with your plugin installed and activated:


Plugin.png


And this is nothing happening during battle when the actor dies:


Death.png


As you can clearly see the actor in question is dead, but the first text box that should appear, along with the rest of the event, never happens thus the common event is not being called. Just in case there was a conflict in my game that didn't have to do with your plugin directly I tried creating a new blank project with a very simple common event just to see if the plugin worked at all. And this is what happened:


The Common Event I made:


Common Event2.png


The Actor Notebox:


Notebox2.png


The Plugin Manager:


Plugin2.png


And the game where the actor in question still dies without the event running:


Death2.png


I apologize for all the pictures, but I think they're the best way to convey everything I'm doing in a clear manner. Could you please tell me what I am doing wrong here? I've tried everything I can think of and I must be missing something because it just doesn't seem to be working at all. Any help would be greatly appreciated, so thank you in advance!
 

Chronosv2

Scripter / Aspiring Game Developer
Member
Joined
Oct 15, 2012
Messages
14
Reaction score
14
First Language
English
Primarily Uses
N/A
It took me a few minutes to figure this out myself (and a bit of confusion, as everything looked fine at first), but I figured it out.


I believe you accidentally changed the plugin's name when you saved it.


Try renaming the plugin to


Cv2_DeathCommonEvent.js


re-add it into the plugin manager and see if that works.


I'll update the plugin in the git repository and remove the "tag" until I re-implement non-filename-dependent parameters. I made the attempt a while back and was mortified when the plugin didn't work (because I did something wrong in code at the time). I fixed that particular problem by returning to the default method of filename-based parameters (which is the default way RPG Maker MV handles it), but never removed the filename-less tag. That may have caused undue confusion, and I apologize for the inconvenience if that was the case.
 
Last edited by a moderator:

Lil Jbm

Warper
Member
Joined
May 10, 2015
Messages
3
Reaction score
0
First Language
English
Primarily Uses
It worked! Yeah I rename some of the plugins I have to keep things in my project organized and never thought that might of been a problem, but changing the name fixed it. Thanks a lot for the prompt reply, I was worried that I might have to put off getting this figured out today.
 

Andronius

Apprentice
Veteran
Joined
Mar 29, 2016
Messages
101
Reaction score
111
First Language
English
Primarily Uses
RMMV
I guess this is also a share (for those interested in Shapeshifting/Morph/Transform/Druid Skills) but it's mainly a BIG THANK YOU. Thanks SO MUCH for this plugin. You can't imagine how grateful I am, and I'll tell you why: during a TWO WEEKS 24/7 >:(   I had been trying to set up my Druid exactly as I wanted. I tried everything, but always had problems when he died in his Animal Form... After hours of YouTube tutorials, entire days reading forums, and tons of plugins and miserable scripting attempt failures, I always came up with the same problem: my Druid wouldn't change his animal form upon death, no matter what. Even worse: when resurrected from death with a potion or spell, he would RETAIN his animal image, but would be able to use his human skills (I begged and cried for help everywhere... like here, and here... you can check there how I did my Shapeshifting/Morph/Transformation skill if anyone is interested, and the Code screenshots).


This problem was so terrible that I really ended up with a terrile writer's block and couldn't progress because of this problem.


Had to stop everything else. It was so frustrating!!! ;_;  


BUT THEN ✴ ✴ ✴ ✴ ✴ I FOUND YOUR MAGICAL PLUGIN :rock-left: BD :rock-right:





I was finally able to call a Common Event that would command, like a message from heaven: "dayum Druid!!! Upon death during animal form, you shall return to your damned human form and human skills and human equip. If you are revived after dying in animal form, you'll come back as human!!!!". 


Now balance is restored to the universe, and I can continue racking my brain trying figuring out other things.  :D


THANK YOU


 
 

Chronosv2

Scripter / Aspiring Game Developer
Member
Joined
Oct 15, 2012
Messages
14
Reaction score
14
First Language
English
Primarily Uses
N/A
I'm very glad you found this plugin useful!


On a slightly unrelated note, for anyone trying to use All Ally DCE, lekoder on GitHub posted a small fix that turns off Game Overs in combat when All Ally DCE is on. Given the "threaded" nature of Common Events, I don't know of any other way to fix this, otherwise I would.


So if you happen to need All Ally DCE, you will need to call the Game Over screen yourself if none of your revive conditions apply.


I can only assume I didn't discover this issue because I was triggering combats from an event for testing.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Profile Posts

This community is awesome. They helped me get my eventing processes to work. I love you all.
suspended on twitter for calling an ahole an ahole & appealing the tweet; furious at myself for being even slightly upset with my suspension: oh no, you've been temporarily banned from hell. GET OVER IT, me.
how can you download the tiles from a forum post here? HELP
That moment when you post the wrong download link to your game and wonder why it got so few downloads... :mad:
Trying to make it so my map is cleared of "random" events after the player leaves the map... to little success >.< I think I might need to ask help for this.

Forum statistics

Threads
94,246
Messages
919,372
Members
123,959
Latest member
CecilGP
Top