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

Discussion in 'RGSSx Script Support' started by Mr. Bubble, Mar 14, 2012.

  1. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,436
    Likes Received:
    5,028
    Location:
    Riftverse
    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.
     
    ZirconStorms likes this.
  2. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,731
    Likes Received:
    381
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    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.
     
  3. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,436
    Likes Received:
    5,028
    Location:
    Riftverse
    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.
     
  4. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,731
    Likes Received:
    381
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    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.
     
  5. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,436
    Likes Received:
    5,028
    Location:
    Riftverse
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    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.
    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.
     
  6. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,731
    Likes Received:
    381
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    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.
     
  7. Chucksaints

    Chucksaints Veteran Veteran

    Messages:
    32
    Likes Received:
    1
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
  8. ekhartpl

    ekhartpl Veteran Veteran

    Messages:
    60
    Likes Received:
    24
    Location:
    ROI
    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: Aug 23, 2019
  9. DumbPomelo

    DumbPomelo Villager Member

    Messages:
    20
    Likes Received:
    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: Aug 26, 2019
  10. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    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.
     
  11. DumbPomelo

    DumbPomelo Villager Member

    Messages:
    20
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMVXA
    Thank you

    Does it return anything if player is there?
     
  12. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    No, it only checks for events, just like you wanted.
     
  13. Solr

    Solr Nameless Veteran

    Messages:
    40
    Likes Received:
    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).
     
  14. Tevi

    Tevi Fierce Demon Woof Veteran

    Messages:
    33
    Likes Received:
    5
    Location:
    The United Kingdom
    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.
     
    Solr and Engr. Adiktuzmiko like this.
  15. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    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...
     
    Solr and Tevi like this.
  16. Solr

    Solr Nameless Veteran

    Messages:
    40
    Likes Received:
    7
    First Language:
    English
    Primarily Uses:
    RMVXA
    @Tevi
    Thank you, it works perfectly. Thank you for helping me out :)
    @Engr. Adiktuzmiko
    Thank's for reminding me. I'll be sure make this change a separate script.
     
    Engr. Adiktuzmiko likes this.
  17. Time Master

    Time Master Villager Member

    Messages:
    11
    Likes Received:
    12
    First Language:
    Vietnamese
    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.
     
  18. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,436
    Likes Received:
    5,028
    Location:
    Riftverse
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    For more visibility, it deserves its own thread.
     
    Engr. Adiktuzmiko likes this.
  19. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    If its about looking for a script or especially if about a specific script, it deserves its own thread. :)
     
  20. Tevi

    Tevi Fierce Demon Woof Veteran

    Messages:
    33
    Likes Received:
    5
    Location:
    The United Kingdom
    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.
     
    Solr likes this.

Share This Page