While I'm currently using this method (party would normally have 2 actors at this point), it throws an error if there's no second actor. What's the better way to do this?
Buffing/debuffing entire party with a script call?
RPG Maker MV SupportWhile I'm currently using this method (party would normally have 2 actors at this point), it throws an error if there's no second actor. What's the better way to do this?
Code:
$gameParty.members().forEach(actor => actor.addBuff(2, 99));
$gameParty.members().forEach(actor => actor.addBuff(4, 99));
Works like a charm, thank you very much.
A slight fix:
$gameParty.members() - full party, even dead members
$gameParty.aliveMembers() - returns all members in party that are not dead
Code:
$gameParty.aliveMembers().forEach(actor => actor.addBuff(2, 99));
$gameParty.aliveMembers().forEach(actor => actor.addBuff(4, 99));
$gameParty.members() - full party, even dead members
$gameParty.aliveMembers() - returns all members in party that are not dead
It's true, but it's not like trying to buff the dead members will have any effect 😉
The literal first line of code inside of addBuff() is checking whether the target is alive.
@ATT_Turan True, but I thought Its worth to mention there is such function
Minor point of interest: forEach is a horrendously inefficient loop method, and it would be better to do
but that's literally just an informational thing as the overhead is so small as to be irrelevant and the originally-suggested solution is absolutely fine.
JavaScript:
for (const member of $gameParty.members()) { member.addBuff(2, 99); member.addBuff(4, 99); }
but that's literally just an informational thing as the overhead is so small as to be irrelevant and the originally-suggested solution is absolutely fine.
Original thread: https://forums.rpgmakerweb.com/threads/buffing-debuffing-entire-party-with-a-script-call.162448/