Script Call Support Boards

@A-Moonless-Night That works as well, and it seems a much neater/cleaner solution than my attempt.
Thank you.
I'm currently using the following to check if any enemies have below 50% HP.
$game_troop.members.any? { |m| m.hp_rate < 0.5 }

Would there be a way to edit this to instead check if the enemy average HP is below 50%?
I haven't tested it, but I presume you could do something like:
Code:
($game_troop.members.inject(0.0) {|r,m| r += m.hp_rate} / $game_troop.members.size) <= 0.5
Thank you! Happy to say that the command seems to work great. Although, I ran into an oversight on my part.

I didn't realize this until testing the new command, but turns out both commands actually factor in dead (and hidden, although I don't know if that would be an easy fix) enemies too. Would it be easy to make the commands only factor in alive enemies?

I tried doing this myself with my original command with the following:
$game_troop.members.alive? { |m| m.hp_rate < 0.5 }
It seems to always give a false-positive, though.
You could do something like:
Code:
$game_troop.alive_members.any? { |m| m.hp_rate < 0.5 }
Code:
($game_troop.alive_members.inject(0.0) {|r,m| r += m.hp_rate} / $game_troop.alive_members.size) <= 0.5
Seems to be working great! Thanks again!
Ok, im not sure if i can ask this, since in the very beginning someone mentiones this thread is for event scripts only,

But I have an Problem with Yanflys convert damage script. It converts hp perfectely fine, but convert mp notetags simply doesnt work. At least with Armor, i need to try the others.

And if I cant ask the question above, i have another one: How can i include random Numbers in an Event. Like for example after attack, common event: choose randomly one of three actions and do it?
@Thorgaaz please make a new thread in RGSSx Scrip Support for the query about the Yanfly script. As you rightly observe, this thread is explicitly not about how to implement any particular script, but is for script calls with events.

For your second query, that is also not a script call, but a variable followed by a conditional check. Please post a thread in RPGMaker VX Ace support.
Alright, opened a new thread. Thank you.
Is there an elegant script call to check if any variables from a batch of 10-20 (non-consecutive) are equal to a value (or other variable)?
@Vis_Mage If they are consecutive, you can do:
Code:
(10..20).to_a.map{|v|$game_variables[v]}.any?{|v| v == value}

If they are non-consecutive, you can try:
Code:
[1,4,6,20,21,100].map{|v|$game_variables[v]}.any?{|v| v == value}
@Vis_Mage If they are consecutive, you can do:
Code:
(10..20).to_a.map{|v|$game_variables[v]}.any?{|v| v == value}

If they are non-consecutive, you can try:
Code:
[1,4,6,20,21,100].map{|v|$game_variables[v]}.any?{|v| v == value}

Works like a charm, thank you!
Anyone mind explaining what's wrong with this script call?
Code:
$game_player.region_id if == 1
I'm attempting to use it as a conditional branch to determine the player's RegionID.
I got this Script suggestion from a youtube video from 2014, so I'm not sure how much the program has changed since, but if there's any other way to call for which region the player's standing in, I'm all ears.
@Zelfore
if you just want to check the player's region id through script calls in the conditional branch, you just need to remove "if". Unless you want something else.
Okay yep, that did it! Thanks!
With the event command 'Gather Followers', the action is more or less instant.
Is there a script call which separates out the followers so that I could do
Gather follower 1
Wait #n frames
Gather follower 2
Wait #n frames
etc.

Thanks.
I have a script call which can identify if the party leader is actor 3. It is
$game_party.leader() == $game_actors[3]

How would I adapt that to find out if one of the followers is actor 3? I assume it would be something using
$game_player.followers
but I can't work out how to specify a particular follower.

Can anyone help?
Thanks.
@Kes can you just use party members instead of followers? or does it has to be a follower? Because you can just do this and it is pretty much the same
Code:
$game_party.members.any? {|m| m == $game_actors[3]}
Or if you want the battle member
Code:
$game_party.battle_members.any? {|m| m == $game_actors[3]}
@TheoAllen As far as I can see from a quick test, $game_party.members.any just seems to test if actor 3 is in the party, which isn't what I want.
The situation where I am using this is:
NPC is walking down the line of the party (all followers are shown) and says something to each one. When she gets to actor 3, I want her to say something very specific. However, I cannot know what order the player has put the actors in the caterpillar (no one is locked into position), so I need to be able to tell if the follower is actor 3 or not.
I think you would do your conditional branch before each party member check that the npc is facing.
$game_party.battle_members[0] == $game_actors[3]
$game_party.battle_members[1] == $game_actors[3]
$game_party.battle_members[2] == $game_actors[3]
$game_party.battle_members[3] == $game_actors[3]

Original thread: https://forums.rpgmakerweb.com/threads/script-call-support-boards.25767/