Skill to add different states to all actors and all enemies (using the formula)

Hello!

I'm trying to create a skill for a wolf enemy, a howl, that applies a debuff to the party and a buff to all enemies when used. I've got very little clue about how to properly use the formula box for this, though. How would I go about it? I'm using Symphony battle system, if that makes a difference.

My idea was to have the skill call a common event, which then applies the debuff state to all actors and the buff state to the troop, but that's where my knowledge runs out. I did find this script call for applying a state to the whole party:

$game_party.members.each { |actor|

already_dead = actor.dead?

actor.add_state(31)

actor.perform_collapse_effect if actor.dead? and !already_dead

}

$game_party.clear_results

 

But I've got no idea how to edit that to apply to the troop, or even if that's the right script call to be using. Any tips?
You can add/remove states by putting them in the damage formula.

For example I have a skill with that:

a.remove_state(36); a.add_state(37); a.atk * 20

It's an ultimate skill that requires overcharge state. When cast, it deals huge damage, removes overcharge state and adds tired state.

Try replacing a with b to apply states on enemies.

Hope I didn't misunderstand anything. 😛
@Rikifive

That won't work in this instance as the OP wants the buff to be applied to all allies, and the debuff to all enemies, and your skill doesn't do either of those.

You don't need a common event.  This can be done one of two ways.

Simple way is this formula 

 $game_party.battle_members.each {|a| a.add_buff(x)}; b.add_debuff(y)

where x is the buff id and y is the debuff id.  Scope set to all enemies.

If that doesn't work then it would have to be the 2-step snippet version.  for the sake of this example, I will call it HowlSkill

class Game_Battler < Game_BattlerBase def HowlSkill(a, b, v) $game_party.battle_members.each {|a| a.add_buff(x)} $game_troop.members.each {|a| a.add_debuff(y)} endend
In the formula box you put 

HowlSkill(a, b, v)

EDIT

Actually, although that is the usual structure for def and for the formula box, I think in this instance it might have to be different.

module Damage def self.HowlSkill $game_party.battle_members.each {|a| a.add_buff(x)} $game_troop.members.each {|a| a.add_debuff(y)} endendAnd then in the formula box you would put

Damage.HowlSkill;damage_formula
The Ultimate Quote of Pure Awesomeness:

$game_party.battle_members.each {|a| a.add_buff(x)}; b.add_debuff(y)

TIL. I'll write down that formula. It may come in handy, thanks! =)
Awesome, thanks! You're a hero, dude. 😀
In case anyone else is reading this at some time in order to do something similar, which option worked for you?
Actually, I spoke too soon - haven't managed to get any of them to work. At the moment, I have

Damage.HowlSkill;damage_formula

in the formula box, and the state set to call a common event with the script call:

module Damage def self.HowlSkill $game_party.battle_members.each {|a| a.add_buff(31)} $game_troop.members.each {|a| a.add_debuff(32)} endendThe skill is set to All Enemies scope.

The wolf is howling, and I'm getting a return of "Null" on the party members, and no effect at all on the wolves. Not sure why.
Because you're doing this as a common event, and I said you didn't need one, but then assumed that you'd know what to do with the snippet.

Snippets like these go into the script editor part.  If you haven't done this before, open Script Editor and scroll down the left hand side.  You come to a line called 'Materials'

Insert a line underneath it.

Put your cursor into the large empty area on the right and paste the snippet there.

Name the script in the box at the bottom left.

All scripts go below 'Materials' and above 'Main'.
Oh. I actually did know that, I just had common event in my head. Lemme try that. Haha

EDIT: Still getting the same effect. I've put the snippet in the script editor, under Materials, named HowlSkill. Got rid of the common event, as well. Still getting "Null" on the party members and no effect at all on the wolves..
Do you want to apply states or buffs/debuffs?

I tried with poison putting this:

$game_party.battle_members.each {|a| a.add_state(3)}; a.atk * 20

this formula applies state with ID of 3 to all actors and deals damage

for debuffing enemies with poison I simply did that in the 'effects'.
That's a good point, Rikifive - to be clear, I'm trying to apply states, not buffs/debuffs. Sorry if that resulted in confusion. In case that was the problem, I changed

module Damage def self.HowlSkill $game_party.battle_members.each {|a| a.add_buff(31)} $game_troop.members.each {|a| a.add_debuff(32)} endendto

module Damage def self.HowlSkill $game_party.battle_members.each {|a| a.add_state(31)} $game_troop.members.each {|a| a.add_state(32)} endendBut that didn't change anything, still same old "Null"
There is no damage because you didn't ask for any.  Your OP said you wanted to apply 

a howl, that applies a debuff to the party and a buff to all enemies when used
which when I looked at it I thought was a bit weird that you wanted to apply a debuff to the player and buff up the enemies - can't see a player picking that skill, so assumed you'd made a typo.  so I gave you buff to the party and debuff to the enemies.

If you want a state, then yes, it would be add_state

However, nowhere did you mention that you wanted to apply HP damage as well.  That needs further coding.  So what damage do you want to apply?  The usual a.atk * 4 - b.def * 2?
I'm not looking to add damage - usually when I apply a state to a target, I get a popup saying "Poisoned" or something over their heads (using Symphony), same as numbers when they take damage. 

Just tried it again, without changing anything, and now I'm getting the states applied and the popups and everything is kosher, except one thing - I'm still getting "Null". So, a wolf uses the skill, "state A" pops up over the wolves (and is applied), "state B" appears over the players and is applied - that's perfect - but I'm also getting "Null" popping up under "state B". Is it trying to damage the players, too, but giving a Null result because I haven't put in any damage formula?
It's not because of not applying damage, or at least not directly.

Did you try the one-step version (amended for states, not buffs/debuffs) i.e.

$game_party.battle_members.each {|a| a.add_state(x)}; b.add_state(y)

with the scope set to all enemies?  I'm surprised that you went for the snippet route if this one works, as it is much more straightforward.  What happens when you use this?
That applies both the states to the party, none to the wolves, and still gives me the "Null" message as well. 
Back to the drawing board

$game_party.battle_members.each.add_state(x); b.add_state(y)

again scope set to all enemies.
Nope. That's not applying any states at all, and still getting a Null result. So far the closest was the 2-step solution with the snippet.
Okay, I've now had chance to open up Ace (I've been doing all this by memory)

The reason you're getting NULL is because in order to use the damage formula box, something must be chosen from the drop down menu above it.  I assume that you've been using HP damage.  Because of that, it's looking for HP damage, not finding any and so it's giving the NULL message.

If you are getting NULL and not "x takes no damage" does that mean that you are using Yanfly's Battle Engine?
Yessir! I've got both Yanfly's Battle Engine and Symphony going on.
Then if you never want NULL to show up, or are not bothered if it doesn't show up, what you could do is try this (I don't know if this will work because I've done something else with my NULL command)

Go to line 301 of Yanfly's Battle Engine.  In case we are dealing with slightly different versions, it's this line

:nulled     => "NULL",   # Text display for nulled attack.

Try deleting the word NULL, but leave in the quote marks.  That should remove any display of NULL in the game.  But you would need to test it to be sure.

Original thread: https://forums.rpgmakerweb.com/threads/skill-to-add-different-states-to-all-actors-and-all-enemies-using-the-formula.41567/