Deals damage to all enemies and applies states to all allies

Hi guys,

I want to ask you about the way of making a skill which deals damage to all enemies while adding a certain state to all allies. Is it possible to do that via writting the damage formula in skill database?

If it can be, how do i write it?

If it cannot be, how can i make a skill like this?
There is a topic about what you can do in the damage formula, with dozens of examples - you might check there.

Basically you can do anything there that can be expressed in RGSS-code. For example

a.add_state(1);100000will kill the skill user (add state death as death is state #1) and damage the target for 100000 points.Adding a state to all allies will be a bit more complex than adding the state to the skill user only, you'll probably either need a lot of single add commands or a loop or something like that.
Using the damage formula, you'd iterate all members of $game_party (or it's battle members) and $game_troop and add state, then put the damage and set the skill to hit all enemies.

You could also put it on a script in case it would be too long for the damage formula...

module Damage  def self.skilla    $game_party.battle_members.each {|a| a.add_state(STATE_ID)}    $game_troop.members.each {|a| a.add_state(STATE_ID)}  endend
then on your damage formula:

Code:
Damage.skilla;damage_formula
I took a look at the topic about damage formula but couldn't find a solution for my example  ;_;

So i created this one and Engr. Adiktuzmiko has solved my problem. Thank you all for your helps  😀
One more question please: How can i check if the target is an ally or an enemy before dealing damage in the damage formula box?
Ryanpzo9, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

You don't need to check that, because the skill's scope can only be set to either, not both. So if you set the skill to work on enemy, then you'll know that the target will be enemies.

There are target manager scripts that allow you different scopes, but in that case you usually have that scripts options to decide what side the target belongs to.

There are ways to check that by ruby in the damage formula, but those require more advanced commands and are usually not used for above reasons. If you tell us what exactly you're planning, then we might be able to point you to a solution.

Original thread: https://forums.rpgmakerweb.com/threads/deals-damage-to-all-enemies-and-applies-states-to-all-allies.40114/