Optional Enemies

Harken_W

Veteran
Veteran
Joined
Oct 13, 2015
Messages
80
Reaction score
22
First Language
English
Primarily Uses
N/A
I'd like a plugin in which I can specify in an enemy notebox if the enemy is an optional kill.


Meaning if that enemy(s) is the last enemy alive at the end of the battle, then the battle counts as a win and is over.


I believe I've seen this kind of thing in games before, perhaps Final Fantasy IX?  Say there's a Chest Enemy in the battle, then you'd want to defeat it or use a skill on it (steal) before you kill the other enemies, if you kill the other 'non optional' enemies first then you miss out on the chance to kill/steal from the chest and gain it's rewards,


Obviously this type of enemy would only work when placed in a troop with at least one other normal enemy, or else it'd be an instant win. 


I hope that made sense, and thanks to anyone who attempts to make this! I'm already amazed at how many plugins there are already for this engine. 
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Does this also mean that any optional enemies left alive at the end of a battle do not give loot?  Only the regular enemies you've killed as well as the optional enemies you've already killed?


What battle plugins are you already using?  Any that change the calculation and/or display of battle rewards?
 
Last edited by a moderator:

Harken_W

Veteran
Veteran
Joined
Oct 13, 2015
Messages
80
Reaction score
22
First Language
English
Primarily Uses
N/A
Does this also mean that any optional enemies left alive at the end of a battle do not give loot?  Only the regular enemies you've killed as well as the optional enemies you've already killed?


Yes that's correct. Left over optional enemies retain their loot.


You will only receive loot from the enemies you have killed be they normal or optional.


At least that's how I think it should work. 
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
What battle plugins are you already using?  Any that change the calculation and/or display of battle rewards?
 

Harken_W

Veteran
Veteran
Joined
Oct 13, 2015
Messages
80
Reaction score
22
First Language
English
Primarily Uses
N/A
Yanfly's Battle Engine Core and Yanfly's Victory Aftermath. 
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
This was easier than I thought it would be - only had to change the battle win conditions, and the loot distribution took care of itself.


Plugin name doesn't matter.  Should work with the plugins you mentioned above.

Code:
//=============================================================================
// OptionalEnemies.js
//=============================================================================

/*:
 * @plugindesc Flag enemies as optional for battle win and loot.
 * @author Shaz
 *
 * @help This plugin does not provide plugin commands.
 *
 * Add <optional> as a tag against an enemy to flag it as an optional enemy.
 *
 * Optional enemies do not need to be killed in order to win a battle.  If
 * you do kill them, you will get loot from them; if you don't kill them,
 * you miss out on the loot.
 */

(function() {

  Game_Troop.prototype.isAllDead = function() {
    return this.aliveMembers().filter(function(member) {
      return !member.enemy().meta.optional;
    }).length === 0;
  };

})();
 

Harken_W

Veteran
Veteran
Joined
Oct 13, 2015
Messages
80
Reaction score
22
First Language
English
Primarily Uses
N/A
Just wow, It works perfectly! Thanks so much, I'll be able to do lots more with my battle system thanks to this.


You're amazing, Thank you! :D  
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,981
Members
137,563
Latest member
cexojow
Top