Thornton

Villager
Member
Joined
Jul 17, 2015
Messages
7
Reaction score
1
First Language
English
Primarily Uses
RMMV
Hi all, I hope this is the correct forum for this question.

1) I'm trying to make a damage ability that has its damage decreased by 10% for every alive enemy.

I saw this code that can probably help achieve the effect:
$gameTroop.aliveMembers().length

But I'm not sure how to use this in the damage formula to achieve what I'm looking for (if it's even the correct code to use).

2) How could I achieve the same effect as above, but for allies?

Thanks.
 

Palin

Veteran
Veteran
Joined
Mar 17, 2016
Messages
80
Reaction score
36
First Language
English
Primarily Uses
N/A
The code you listed will return the number of alive enemies. You can use it directly in a damage formula. For instance, if all you had in the damage formula was: $gameTroop.aliveMembers().length - then you'd be doing damage equal to the number of enemies (before defense, etc..)

For actors you'd use $gameParty.aliveMembers().length
 

Thornton

Villager
Member
Joined
Jul 17, 2015
Messages
7
Reaction score
1
First Language
English
Primarily Uses
RMMV
The code you listed will return the number of alive enemies. You can use it directly in a damage formula. For instance, if all you had in the damage formula was: $gameTroop.aliveMembers().length - then you'd be doing damage equal to the number of enemies (before defense, etc..)

For actors you'd use $gameParty.aliveMembers().length

Thanks for confirming and providing the allied version. Glad to hear there's no magic math behind the scenes.

For anyone interested, I managed to figure out how to achieve the effect I wanted in the original post:
(<damage formula>) - (((<damage formula>) * ($gameTroop.aliveMembers().length - 1)) * 0.1)
The "0.1" (10%) represents the penalty. At 8 enemies, there is a 70% reduction to the ability's effectiveness (if it's an AoE, the total net damage would still be higher than hitting a single enemy, however).
If you want the first enemy to be taken into account also for the penalty (for whatever reason), you would simply use:
(<damage formula>) - (((<damage formula>) * ($gameTroop.aliveMembers().length)) * 0.1)
*If you calculate your defense formulas inside the skill formula box, you may need to put it at the end of the above formulas.

And lastly, if you want to use this for healing effects, it would be this:
(<healing formula>) + (((<healing formula>) * ($gameParty.aliveMembers().length - 1)) * 0.1)
This would increase the healing by 10% per alive ally that is (technically) not the user.

Hopefully the formulas gives someone an idea or two on some new abilities.
Anywho, this is solved!
 
Last edited:

Latest Threads

Latest Profile Posts

BCj
Working on Escalia again, feels good. Have this overwhelming urge to map as well, but need to get some extra tiles commissioned first :D
Lee Sang wrote on Bandito's profile.
Hi, I've just tried your plugin "Game is Active" and when I tested it on Android, it gave me an error, something about "Cannot read property 'underfined' of underfined.
With my project, I want the player to have access to all the tools they need to get from New Game to Credits as soon as possible; I want the player's progress to only be impeded by the player not knowing how to use the tools the game provides.
Just a little close up shot...
w2xZocX.jpg
finally drew the last member of "team outcast" for my game. since my game has a lot fighting game elements in it, there's bosses in teams of three like King of Fighters.

Forum statistics

Threads
113,857
Messages
1,077,984
Members
147,949
Latest member
paravn9
Top