Script text

How can i see the result of this in a text in game or anywhere?

$gameParty.aliveMembers().length
Store it in a variable using the default event command, or the script command:

Code:
$gameVariables.setValue(varId, $gameParty.aliveMembers().length)

Ex. $gameVariables.setValue(1, $gameParty.aliveMembers().length)

And then in the Show Text command, you can use the shortcut to call the content of the variable you used for storing the data:
Code:
\v[varId]

Ex. This is the alive members value: \v[1]
Store it in a variable using the default event command, or the script command:

Code:
$gameVariables.setValue(varId, $gameParty.aliveMembers().length)

Ex. $gameVariables.setValue(1, $gameParty.aliveMembers().length)

And then in the Show Text command, you can use the shortcut to call the content of the variable you used for storing the data:
Code:
\v[varId]

Ex. This is the alive members value: \v[1]

ah thank you that work great 😀 and now i know what is my probleme... this script is suposed to find how many caracter is affected be state 102. But this number stay to 0 when all group is affected. Can you help me with this to?

$gameParty.aliveMembers().every(function(member) { return member.isStateAffected(102) })
The "every" method is like the "some" method and It's used for checking if all the components of an array respect the condition of the callback.
So, using every or some, you're result is not an integer, but a boolean, meaning that the expression up there will return "true" or "false".

If I understood correctly what you have to do, you should proceed this way:

Code:
var members = $gameParty.aliveMembers().filter(function(member) { return member.isStateAffected(102) })

members.length

The "filter" method is an array prototype that creates a new array filtering the original one, choosing the components that respect the condition made in callback function.
This means that storing in a variable the result and then checking its length, you can return the number of the members affected by the state.
The "every" method is like the "some" method and It's used for checking if all the components of an array respect the condition of the callback.
So, using every or some, you're result is not an integer, but a boolean, meaning that the expression up there will return "true" or "false".

If I understood correctly what you have to do, you should proceed this way:

Code:
var members = $gameParty.aliveMembers().filter(function(member) { return member.isStateAffected(102) })

members.length

The "filter" method is an array prototype that creates a new array filtering the original one, choosing the components that respect the condition made in callback function.
This means that storing in a variable the result and then checking its length, you can return the number of the members affected by the state.

Wow thank you so much! that perfect for my skill 🙂
'Tech Support' is for when you are having problems getting the engine itself to run. "How do I...? (implementation) questions go in the appropriate support forum for the engine you are using.

Moved to: RPGMaker MV
If your query has been fully answered, please Report your opening post and ask for the thread to be closed.
Thanks.

Original thread: https://forums.rpgmakerweb.com/threads/script-text.93046/