Apply state to all alive allies in damage formula box?

Hi,

Inside the damage formula box of a skill, I'd like to apply a state to all allies who are alive. How do I do this?

This is my current formula. Which only applies state to user of the skill (10% of the time).

if (Math.random() < 0.10) {a.addState(53);} (a.mat * 1.5)
@J0M0 Try the following out :

Code:
if (Math.random() < 0.10) { if (a.isAlive()) a.addState(53); } (a.mat * 1.5)

EDIT: Oop, that only applies to the user. One moment ...

For all members it would be something along the lines of this :

Code:
$gameParty.aliveMembers().forEach(function(member) { member.addState(53); });
Interesting I'll try it out. Thanks so much.
By "allies" do you only mean Actors or if an Enemy did the skill then the other Enemies should get it too?

Code:
a.friendsUnit().aliveMembers().forEach(member => member.addState(53))
By "allies" do you only mean Actors or if an Enemy did the skill then the other Enemies should get it too?

Code:
a.friendsUnit().aliveMembers().forEach(member => member.addState(53))
Good point. I would probably want both scenarios covered. So your snippet will cover both?
Try it and find out 🙂

Spoiler
yes, it will

Original thread: https://forums.rpgmakerweb.com/threads/apply-state-to-all-alive-allies-in-damage-formula-box.113851/