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

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Grab all items by using $game_party.all_items
Check those items using ".any?" function to check if the item in the said category exist
And if you're using a custom category, it largely depends on how it's done as the default code has no category except if it's being a weapon, armor (which it's an entirely different object), standard item, or key item. So if they're using a custom categorization, you have to make it based on what script they're using.

Also, you probably need a custom refresh function so that it also dynamically change the col_max based on how many categories will be shown. I think this will be the hardest part though.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
change the col_max based on how many categories will be shown
That is the easiest part actually. The script does it itself. It's a matter of finding a way to filter categories.
Seiryuki - Categorize item scene.
The make command is
Code:
 alias icat_make_command_list make_command_list
   def make_command_list
  ICAT::VISIBLE_CATEGORY_INDEX.each { |symbol, label|
    add_command(label, symbol)
  }
 end
and I've been trying to figure out a way to adjust that to filter out the category when there are no items for the category.

I tried $game_party.all_items but was unsure of how to specify the category.
Everything I found was for the id or feature or scope. Since items is one group, weapons another and armor another.
Unless I do the check three times for each group, but I also need to figure out checking for custom categories within those three groups
So I'll try $game_party.all_items.any? but it still needs to be checked against the symbol. :item, :weapon, :armor, :Key_item, etc
yes? or is that wrong?

I'm not putting much effort into it, unless it would be easy. I'll continue to work with the problem on and off until I, maybe, figure it out or someone else does.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
I don't know the script you mentioned, but let me try to shoot in the dark. Since you've mentioned changing col_max is easy for you, then let's omit that particular part. This particular code, you can try this
Code:
   alias icat_make_command_list make_command_list
   def make_command_list
     ICAT::VISIBLE_CATEGORY_INDEX.each { |symbol, label|
       add_command(label, symbol) if CategoryConditions[:symbol].call
     }
   end
Then you can "hardcode" the condition for each category symbol by using this
Code:
CategoryConditions = {
  :weapon => lambda { !$game_party.weapons.empty? }
  :armor => lambda { !$game_party.armors.empty? }
  # continue yourself
}
The pros of using this, you can even lock/hide a category even by using an entirely separate condition like game switches or variables.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
The pros of using this, you can even lock/hide a category even by using an entirely separate condition like game switches or variables.
What other conditions can be used?
I'm trying a combination of things and I can't seem to get anything but the $game_party.... part to work

I used
:key_item => lambda { !$game_party.items.empty? && @item.is_a?(RPG::Item) && @item.key_item? },
but the category does not show up.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
I used
:key_item => lambda { !$game_party.items.empty? && @item.is_a?(RPG::Item) && @item.key_item? },
but the category does not show up.
You didn't seem to understand scoping. Adding @ item won't do anything as it does not recognize what @ item is.
In Window_ItemCategory does not even have variable item. And the code block inside lambda does not recognize any local variable within the Window_ItemCategory either.

This seems to be your original intent.
The effect is to hide item screen categories if there are no items for that category.
So you don't check @ item, or whatever the thing you're hoping for. Instead, check the items inside the game party
Code:
$game_party.items.any? {|item| ............... }
So as long as there is at least one item, the category should be shown.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
You didn't seem to understand scoping.
Yes, there is much I still haven't grasped yet. Haven't really spent time learning ruby, just tried to learn rpg maker.
So that makes the default categories work Now I just need to figure out the custom ones.

Thanks for the info.
 

ekhartpl

Veteran
Veteran
Joined
Apr 18, 2015
Messages
71
Reaction score
37
First Language
Polish
Primarily Uses
RMVXA
//Edit: Managed to find a way to do it on my own. It's not pretty, but it works!

(I'm sorry in advance for a longish post, I'm trying to explain everything! Question is bolded, and posted twice just to make sure it's easy to find!)

I'm using (among others) two scripts: Ace Equip Engine and Weapon Attack Replace (both by Yanfly). I use Weapon Attack Replace to create scaling for weapons (basically, weapon hit for <Weapon.attack + (Actor.attack * MOD)> (Mod depends on "scaling", different for various attack skills). There is 0 variance - weapon always does the same damage.

Is there any way to change how Equip Engine displays attack, so it takes into account the formula of the weapons' skill, instead of the basic Actor.attack + Weapon.attack? If possible, have it as a separate listing (ie. AR) in equip menu?

The way it is currently may be slightly confusing for the player, for example, if we have two weapons:
(Player's attack is at 100)
Weapon A has attack of 120, but poor scaling at only 33% of player's attack.
Weapon B has attack of 75, but godlike scaling at 120% of player's attack.

When equipping, player notices that weapon A puts his attack at 220, while weapon B put it at 175. Well, obviously weapon A is better then, right?
But after taking scaling into account, weapon A will deal ~153 damage, while weapon B deals 195 damage. But, unless player will read about it outside the game, they won't even realize it. So again...

Is there any way to change how Equip Engine displays attack, so it takes into account the formula of the weapons' skill, instead of the basic Actor.attack + Weapon.attack? If possible, have it as a separate listing (ie. AR) in equip menu?


Huge thanks for anyone who might help me with that


//Edit: Managed to find a way to do it on my own. It's not pretty, but it works!
 
Last edited:

DumbPomelo

Villager
Member
Joined
Jun 2, 2019
Messages
20
Reaction score
1
First Language
English
Primarily Uses
RMVXA
I need a way to check if there's an event at location x y
Excluding the player

Or alternatively, get the ID of an event at location x y
Something like that.
 
Last edited:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Code:
class Game_Map

  #--------------------------------------------------------------------------
  # * Get Array of Events at Designated Coordinates
  #--------------------------------------------------------------------------
  def events_xy(x, y)
    @events.values.select {|event| event.pos?(x, y) }
  end
  #--------------------------------------------------------------------------
  # * Get Array of Events at Designated Coordinates (Except Pass-Through)
  #--------------------------------------------------------------------------
  def events_xy_nt(x, y)
    @events.values.select {|event| event.pos_nt?(x, y) }
  end
  #--------------------------------------------------------------------------
  # * Get Array of Tile-Handling Events at Designated Coordinates
  #   (Except Pass-Through)
  #--------------------------------------------------------------------------
  def tile_events_xy(x, y)
    @tile_events.select {|event| event.pos_nt?(x, y) }
  end
  #--------------------------------------------------------------------------
  # * Get ID of Events at Designated Coordinates (One Only)
  #--------------------------------------------------------------------------
  def event_id_xy(x, y)
    list = events_xy(x, y)
    list.empty? ? 0 : list[0].id
  end

end

You don't have to insert this code anywhere, it is already included in the default scripts.
If you just need the ID of the event on co-ord XY, you can use:
Code:
$game_map.event_id_xy(x, y)
This returns 0 if there is no event on the specified co-ordinates, and returns the ID of the event if there is.

The other methods I quoted above return array values with events as elements, in case you need the whole event object.
 

DumbPomelo

Villager
Member
Joined
Jun 2, 2019
Messages
20
Reaction score
1
First Language
English
Primarily Uses
RMVXA
Thank you

Does it return anything if player is there?
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
No, it only checks for events, just like you wanted.
 

Solr

Living Weapon
Veteran
Joined
Apr 20, 2019
Messages
46
Reaction score
7
First Language
English
Primarily Uses
RMVXA
(I hope this is the appropriate place to post this)
How would I go about making it so that when an actor is successfully hit by an enemy, tp is reduced instead of gained? (There is a reason I can't accomplish this using states).
 

Tevi

Fierce Demon Woof
Veteran
Joined
Mar 10, 2019
Messages
33
Reaction score
5
First Language
English
Primarily Uses
RMVXA
If you go to line 742 in Game_Battler and change the += to a -= it should take TP off depending on damage suffered.
Quick Edit: I did try this, and it does work.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I would suggest doing the edit in a new script slot though (so practically overwriting the original), its just safer in case you ever forgot that you edited the base scripts...
 

Time Master

Villager
Member
Joined
Aug 25, 2013
Messages
12
Reaction score
12
First Language
Vietnamese
Primarily Uses
Well I think this question doesn't need a whole thread.

I tried to find a zoom out script for RMVXA, I found one, someone said that it's in French (it's MGC Zoom Script, I guess so), I clicked to the link but it's seem died (seem likes a whole forum is died). So if someone have a copy of the script here, please help me ._.

Thanks very much.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
If its about looking for a script or especially if about a specific script, it deserves its own thread. :)
 

Tevi

Fierce Demon Woof
Veteran
Joined
Mar 10, 2019
Messages
33
Reaction score
5
First Language
English
Primarily Uses
RMVXA
Okay so I have a thing I need help with now-
In my game, the ATK buffs do literally nothing. How would I go about altering them to give more attack? It's probably really simple and I just can't find it in the Game Objects, hence why it's here.
Edit because I forgot to add somehting: No problem Solr, I love helping when I can.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,090
Members
137,587
Latest member
Usagiis
Top