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

ashm

Veteran
Veteran
Joined
Sep 20, 2015
Messages
30
Reaction score
16
First Language
Indonesia
Primarily Uses
Can someone help me :kaoswt2:
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 ?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,437
Reaction score
6,248
First Language
Indonesian
Primarily Uses
RMVXA
Code:
[0,1,2,3,4,5,6,7,8, etc ...].collect{|id| actor.param_max(id)}.max
 

ashm

Veteran
Veteran
Joined
Sep 20, 2015
Messages
30
Reaction score
16
First Language
Indonesia
Primarily Uses
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 ;)
 

Egerunt

Villager
Member
Joined
Jan 5, 2019
Messages
29
Reaction score
0
First Language
English
Primarily Uses
RMVXA
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.
 

ashm

Veteran
Veteran
Joined
Sep 20, 2015
Messages
30
Reaction score
16
First Language
Indonesia
Primarily Uses
\
Code:
if target.result.evaded
like those ?
I found at Game_ActionResult
 

Egerunt

Villager
Member
Joined
Jan 5, 2019
Messages
29
Reaction score
0
First Language
English
Primarily Uses
RMVXA
\
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

Villager
Member
Joined
Jan 5, 2019
Messages
29
Reaction score
0
First Language
English
Primarily Uses
RMVXA
@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.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,437
Reaction score
6,248
First Language
Indonesian
Primarily Uses
RMVXA
@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

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,437
Reaction score
6,248
First Language
Indonesian
Primarily Uses
RMVXA
@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"
 

Egerunt

Villager
Member
Joined
Jan 5, 2019
Messages
29
Reaction score
0
First Language
English
Primarily Uses
RMVXA
@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.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,437
Reaction score
6,248
First Language
Indonesian
Primarily Uses
RMVXA
{spoiler}{code}{/code}{/spoiler}
you know what to replace
 

Egerunt

Villager
Member
Joined
Jan 5, 2019
Messages
29
Reaction score
0
First Language
English
Primarily Uses
RMVXA
@TheoAllen Thank you, I've changed it now, it should be displaying the script correctly.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,437
Reaction score
6,248
First Language
Indonesian
Primarily Uses
RMVXA
@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 = (!@result.missed && 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.
 

Egerunt

Villager
Member
Joined
Jan 5, 2019
Messages
29
Reaction score
0
First Language
English
Primarily Uses
RMVXA
@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.
 

Chucksaints

Veteran
Veteran
Joined
Dec 8, 2016
Messages
34
Reaction score
1
First Language
Portuguese
Primarily Uses
RMVXA
Hi all, can you help me please?
how to show next_actor face?
Is it possible?

thank youu
flynnartesjpgyz.jpg
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,402
Reaction score
499
First Language
English
Primarily Uses
RMVXA
out of curiosity ... what is that game?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,437
Reaction score
6,248
First Language
Indonesian
Primarily Uses
RMVXA
Can you just use
Code:
$game_party.members.each {|m| <draw face method>}
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,136
Reaction score
811
First Language
Hungarian
Primarily Uses
RMVXA
@Roninator2
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).
 

Users Who Are Viewing This Thread (Users: 0, Guests: 3)

Latest Threads

Latest Profile Posts

Small rant: While using SRD Hud maker for a battle hud, I typed in the wrong script call and got an error, but then forgot to delete the piece that caused the error before closed the Hud maker and hit F5 to restart the game. Now everytime I engage in a battle my game crashes...
:kaolivid:
Would Jump into Javascript be best off continuing to break down the MV core files, or would people prefer a quick detour to cover everything that's changed in the core from MV to MZ?
Not going to lie... PIXI Particles make fantastic graphics... But predicting the hitbox of something with a "fixed size" but whose graphics can stick out past that, is quite challenging. :kaoswt:
Would you like a glass of spiders?

Forum statistics

Threads
100,530
Messages
976,894
Members
132,081
Latest member
Kaezyelnatz
Top