Ruby/RGSSx questions that don't deserve their own thread

Can someone help me 😅
Suppose i want to create bar for basic parameter (atk, def) but the bar filled based rate of the parameter / highest parameter.
for example, i copy a code from this
Code:
param_rate = actor.param(2) / actor.param_max(2).to_f
and what i want is
Code:
param_rate = actor.param(2) / whichever highest parameter (among 6)
how to write it on Ruby ?
Code:
[0,1,2,3,4,5,6,7,8, etc ...].collect{|id| actor.param_max(id)}.max
A different result compared to what I have in my mind.
but a small edit
Code:
([2,3,4,5,6,7].collect{|id| actor.param(id)}.max).to_f
the result is correct.
Thanks Theo 😉
Can anyone tell me how I could write an if or else if statement in the VX Ace script for evades and misses? I want to write something along the lines of, "if enemy evades then change the battler picture for them" Same for misses, I've only been able to manage to make it work for when they take no damage, which of course only works when their defence is too high to break through.
\
Code:
if target.result.evaded
like those ?
I found at Game_ActionResult
\
Code:
if target.result.evaded
like those ?
I found at Game_ActionResult
Thank you for replying. I've tried using that now, but it doesn't seem to do anything for some reason, this is an example of it.
upload_2019-1-31_10-7-19.png

The part with evading is what I added and it doesn't seem to work, but the bits before that, work just fine. I've also already tried putting the "@" before target to mimic the previous lines but it still didn't seem to work. Do you happen to see something wrong within the bit I added?
@Egerunt have you tried:
Code:
@result.evaded
@result.missed
@A-Moonless-Night
Sadly I have, but it still hasn't worked. I guess I have to be missing something, be it obvious or not.
@Egerunt how about u put more context? Because that method wasn't a part of default script. And maybe the method will only be executed if the skill/item is hit.
@TheoAllen If that's the case then more context can be found in this forum.
https://forums.rpgmakerweb.com/index.php?threads/moghunters-battler-poses-script-help-needed.105001/
@Egerunt you posted the script horribly. In the future please use code tag. So the format will not get messed up. It might be also the reason why nobody gives a look at the question.

But back to the actual question, looks like I was right, the method is only executed when the item is hit.
Maybe you can try to modify from "def item_apply" from default script instead of "execute_battle_pose"
@TheoAllen Thank you for informing me, I remembered reading a forum that said to put scripts in spoilers to avoid clogging the thread, I didn't know it would cause problems. May I know how to implement the code tag to make it appear properly? Then I can edit the original post for you and everyone else.
{spoiler}{code}{/code}{/spoiler}
you know what to replace
@TheoAllen Thank you, I've changed it now, it should be displaying the script correctly.
@Egerunt however, I did answer your question in case you oversight it.
This is the default script
Code:
  def item_apply(user, item)
    @result.clear
    @result.used = item_test(user, item)
    @result.missed = (@result.used && rand >= item_hit(user, item))
    @result.evaded = ([email protected] && rand < item_eva(user, item))
    if @result.hit?
      unless item.damage.none?
        @result.critical = (rand < item_cri(user, item))
        make_damage_value(user, item)
        execute_damage(user)
      end
      item.effects.each {|effect| item_effect_apply(user, item, effect) }
      item_user_effect(user, item)
    end
  end
And this is the piece of mog's code
Code:
  #--------------------------------------------------------------------------
  # ● Execute Damage
  #--------------------------------------------------------------------------
  alias mog_battler_pose_execute_damage execute_damage
  def execute_damage(user)
     mog_battler_pose_execute_damage(user)
     execute_battler_pose_damage(user)
  end

  #--------------------------------------------------------------------------
  # ● Execute Battler Pose Damage
  #--------------------------------------------------------------------------
  def execute_battler_pose_damage(user)
     if @result.hp_damage > 0
        self.battler_pose[2] = 3
        self.battler_pose[1] = 50
     elsif @result.hp_damage < 0
        self.battler_pose[2] = 1
        self.battler_pose[1] = 50   
     end
  end
And if you look at this part
Code:
  if @result.hit?
      unless item.damage.none?
        @result.critical = (rand < item_cri(user, item))
        make_damage_value(user, item)
        execute_damage(user) # <-- Mog's code is applied here, means it will ONLY executed when the item hits
      end
      item.effects.each {|effect| item_effect_apply(user, item, effect) }
      item_user_effect(user, item)
    end
  end
I don't want to guess what's mog is trying to do, but that's the hint I can give it to you at the moment.
@TheoAllen Thank you for all the help. I'm trying to make it work, using your suggestion, though currently I can't seem to implement it correctly.
Hi all, can you help me please?
how to show next_actor face?
Is it possible?

thank youu
flynnartesjpgyz.jpg
out of curiosity ... what is that game?
Can you just use
Code:
$game_party.members.each {|m| <draw face method>}
@Roninator2
Spoiler
Tales of Vesperia. PC version came out not long ago (with terrible optimization - even Berseria runs way better than this one).
Clunky combat, sometimes unresponsive even... No idea why fans like(d) it so much. It's like a downgraded Tales of the Abyss as far as combat goes.
I only played it a little, but so far that's my impression of it.

As for the face question...
It's not really the "next face", those face images include all party members, and the selected one is highlighted.
Theo's answer is correct, but you will need to make an exception for the currently selected face to show it differently than the other ones. This means that if you change the selected actor, you will have to redraw the previous/next (depending on which direction you change it) and the newly selected actor's face at the very least, or use sprites instead and play with sprite effects on them (position change, flash effect, etc).

Original thread: https://forums.rpgmakerweb.com/threads/ruby-rgssx-questions-that-dont-deserve-their-own-thread.150/