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,439
Reaction score
6,255
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,439
Reaction score
6,255
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,439
Reaction score
6,255
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,439
Reaction score
6,255
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,439
Reaction score
6,255
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,439
Reaction score
6,255
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: 2)

Latest Threads

Latest Posts

Latest Profile Posts

When you discover great tileset resources that you completely forgot that you had. :kaomad3::kaopride:
Just got a better look at the MZ RTP. I'm very happy with it, especially the sci-fi tiles and sprites. Glad I pre-ordered.
I've just checked the VisuStella Plugins for MZ and there are already 11 plugins. The Yanfly team(perhaps a big one?) really works so effectively and efficiently that some MZ users can likely use tons of Yanfly plugins right after MZ's released (still 13 days from now). I wonder if any other plugin developer(or team) will try to compete with Yanfly this time, no matter how slim the chance to win is :)
Hello! :kaopride:I am new to RPG Maker, though I have been lurking the forums for a while. :kaoswt: Hope to make some friends and learn some stuff here! :kaothx:
And now since I've got the whole game parts working, the *contents* await.

Forum statistics

Threads
100,594
Messages
977,584
Members
132,194
Latest member
linkvaovn88com
Top