Two problems with custom enemy attacks

Hello.

So, this is sort of a weird problem. Two problems, actually.

FIRST PROBLEM:

I want to create an attack that does damage to another battler, but then self-inflicts an effect upon the user. More generally, I would like to create a move that targets both the opposition and the user with different affects for each target. My current method of doing this is, when an attack is executed, calling on a Common Event to set off a switch that determines that battler's next move as affecting itself. But this spans two turns, not one. Besides, there is probably a much more efficient way to do it with scripting.

SECOND PROBLEM:

I want to create a "consumption" move for enemies that eat each other to regain HP. Implementing it is pretty easy, except that when there is only one enemy left, the enemy eats itself and restores its own HP. I know, counterproductive, right? I realize that you can set attack requirements for each battler (i.e. only use this attack if party contains more than 1 battler), but here's the catch: I need to set TWO requirements for this attack. Specifically, the user needs to be afflicted by a certain status condition AND there needs to be more than one battler in their party in order for this attack to work properly.  Common events sound like they would be a pain for something like this. Any ideas on how to do it with scripts?

I know it's a lot. But I don't necessarily need answers: suggestions of action are helpful as well.
Use the damage formula to damage the user

like

Code:
a.hp -= self_damage;damage_to_enemy
as for the second one, try Yanfly's Cost Manager so that you can set custom requirements
Use the damage formula to damage the user

like

a.hp -= self_damage;damage_to_enemyas for the second one, try Yanfly's Cost Manager so that you can set custom requirements
Hrm... Where exactly would I put that line of code? In the comments?

a.hp -= self_damage;damage_to_enemyI'm not too sure.

As for Yanfly's Cost Manager, it worked out great: I added a little script to create a list of live enemies in the Game_Troop class and created a custom cost for the move specifying that it's length had to be greater than 1. Thanks!   🙂
On the damage formula of course...

As for Yanfly's Cost Manager, it worked out great: I added a little script to create a list of live enemies in the Game_Troop class and created a custom cost for the move specifying that it's length had to be greater than 1. Thanks!
nice... 🙂
Hrm... Where exactly would I put that line of code? In the comments?
No, the line for the damage formula of a skill is editable, just place that line into that part of the skill definition top right.
Ah, okay, I see! Very nice. Now, is there a way that I could change this so that it inflicts a status ailment upon the user instead? I don't think the damage formula has a parameter for statuses...
@Maximus - there is a thread here where you can find lots of examples and discussions on what you can do with the damage formula. You can actually make the damage formula do anything that RGSS3 will allow you to call
@Maximus - there is a thread here where you can find lots of examples and discussions on what you can do with the damage formula. You can actually make the damage formula do anything that RGSS3 will allow you to call
Okay, so I found a script be Hime Works that allows one to set additional formulae executed on attacks that may use virtually any scripts, like you mentioned. I simply set a new effect that adds a state to the user.

With that, it looks like both of my problems have been solved. Thank you very much Adiktuzmiko, Andar, and Hime Works!
You can even do that without Hime's script you know... assuming it should only be applied if the skill hits, it can be done via the damage formula itself... now if it's applied even if the skill misses, then yes you'd need Hime's script (or my new one for Skill/Item Apply)
Oh... Well, I guess I DO need to experiment with the damage formula a little more before I start jumping into scripts I don't understand...

However, using Hime's script is quite easy. When I type the code:

a.add_state(7)It works fine. But when I paste this into the damage formula,, nothing happens in the battle...

I think I'll go and find some topics on using the damage formula on the forum.
Eh? that's weird... I use that quite a number of times and it works fine...
Ah, interesting. You are totally right: I looked up a tutorial on the damage formula and managed to place a lot of my effects into the formula using proper notation and semicolons. For example, the a.add_state(7) worked fine. I must not have been doing it correctly before.

In which case, Hime's script is not the only way to customize enemy attacks. Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/two-problems-with-custom-enemy-attacks.24512/