Enemy Revives After 3 Turns

Dacuna

Veteran
Veteran
Joined
Feb 19, 2013
Messages
143
Reaction score
10
First Language
English
Primarily Uses
Hello everyone,


I'm trying to create a certain type of plant boss that has a weird trick.


There's three of the same plant enemy that starts off the battle, but once one of the plants die, it revives with full health after 3 turns.


This means the player will have to kill all three of them before they can revive.


How would I accomplish this exactly?


I'm not sure if it's possible without scripts, so if anyone knows one I could use, could you direct me to it?


Thanks.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Tricky but doable without scripts. Will require 3 variables. Here's how I'd do it, all in troop events.


Page 1: On turn 0 (start of battle) add the state immortal to all the enemies. If you don't have that state, create one, and in it make it such that whomever has the state has state resist: KO. Set no conditions for when it removes, as we will only remove this state manually.


Page 2: Run if enemy 1 is <= 0% HP. If so, remove the state immortal, store the number 3 in a variable (note which variable, call it plant 1 revive timer or something), and add the state KO to the first enemy.


Page 3: Same thing as page 2, but for plant 2. Use a different variable than in page 2.


Page 4: Same thing as page 2, but for plant 3. Use a different variable than in page 2 and 3 (so you should have 3 variables total, one for each plant).


Page 5: Set this one to run at the start of every turn (turn 1 + 1 * X will do it). Have it subtract one from each of the variables you used in pages 2 - 4, then run a condition check in the page. If plant 1 revive == 0, revive the plant, and add the state immortal back to the plant. Then, below that run a conditional branch to check if plant 2 revive == 0, then another one for plant 3 revive.


Should work as stated here. The important step is adding the state immortal to the enemies, because without it, the condition check if enemy 1 HP is <= 0% will never return true, as enemy 1 will cease to exist before the troop event gets a chance to run.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Definitely possible using Troop eventing.  Not easy, but not terribly difficult.  No plugins needed.  Create a separate variable for each enemy and call it something like "Turns after KO: First Plant".  For each enemy, have a troop event page (with scope 'Turn') that runs at the end of each turn if that enemy's HP is 0% (or less).  In the event body, increase the "Turns after KO" variable for that plant by 1, and then have a Conditional Branch check its value to see whether it's greater than or equal to 4 (not 3 because we are incrementing the variable even on the turn that the Plant gets KO'ed).  If it is >= 4, then set the variable back to 0 and do a Recover All on that plant.  Make similar troop event pages for all 3 plants, keeping in mind that they all need to use separate variables.


(Once you do the Recover All, the troop page condition is no longer met, so further event processing on that page might not run until the plant is KO'ed again - not sure about how this works.  Anyhow, that's why I did the Recover All as the last thing on the page.  If you want to show animations, messages, etc. when the plant respawns, you might need to make that a separate page with a "Switch" condition triggered by a Switch that is set before the Recover All.)


By the way, this is actually a really cool gimmick.  I'd have fun with it, so long as I had a reasonable way to figure out when each enemy is close to be being KO'ed.
 

Dacuna

Veteran
Veteran
Joined
Feb 19, 2013
Messages
143
Reaction score
10
First Language
English
Primarily Uses
I tried bgillisp's approach first because it looked legitimate, but it didn't seem to work, even after following his instructions perfectly (I think?)


Wavelength's instructions worked out well though, and the plants are reviving themselves.


Thanks for the answers!
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
I'd have to check what you did, because there is no reason it shouldn't have ran, unless you don't have an immortal state. But glad one of them worked out!
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
@bgillisp I believe that "When HP is 0% or less" will still run even if the enemy is KO'ed.  I use it a lot in timeblazer to check whether an enemy has been KO'ed, although there it's usually for "Moment" troop pages not "Turn" so it's possible there's a difference there (though my instinct is that it works the same way).  As far as your solution goes, it looks solid to me at first blush - maybe there was a miscommunication about page scopes (Turn vs. Moment vs. Battle) or how to 'revive' an enemy.


Glad you've got this working, @Dacuna - keep making creative boss battles! :)  
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
@Wavelength: If so, I'm honestly surprised, as I once tried a if enemy HP <= 0%, KO all enemies (so that defeating this enemy instant ended the fight), and it never ran until I added the immortal state. Though that could be a quirk of Yanfly Battle engine and not the default.


Yeah, all I can think of is the page priority could be off, as I used something like this to set up a similar fight with flames that are revived once you KO 4 of them (but not the boss). Oh, well, what matters is one of the methods worked, right?
 

Dad3353

Veteran
Veteran
Joined
Mar 9, 2016
Messages
421
Reaction score
110
First Language
English
Primarily Uses
Definitely possible using Troop eventing...


This works a treat; I've 'adopted' this as a new Troop combat in my new Desert Map. Thanks for the very clear description; you've been added to the Credits for this inspiration. Good stuff; cheers.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
This works a treat; I've 'adopted' this as a new Troop combat in my new Desert Map. Thanks for the very clear description; you've been added to the Credits for this inspiration. Good stuff; cheers.


You are very welcome!!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top