Internal Variable Names?

Discussion in 'RGSSx Script Support' started by Sketchward, Jul 30, 2019.

  1. Sketchward

    Sketchward Veteran Veteran

    Messages:
    55
    Likes Received:
    3
    Location:
    Canada
    First Language:
    English
    Having trouble finding the internal name in the script for:

    Equipped Weapon
    Equipped Shield
    Equipped Helmet
    Equipped Armor
    Equipped Accessory

    As well as how to display them on a menu.

    Since my game only has one character and not 4, I've been revamping the game's menu system to display the stats screen on the main menu rather than a Status sub-menu. But I'm having trouble porting over the Draw Equipment functions. It's always missing an item number, or an item icon definition, and I can't seem to find any of the internal variable names.

    I managed to get the stats/parameters to port over with no problem, but still can't get equipment to work. I'm going to start with my menu draw function, and what I'm trying to do, and then I'll link how the game drew it in the Status menu and maybe someone can tell me where I'm making a mistake in porting it over. The problem is with the very last line.

    My function:
    Code:
      def draw_actor_simple_status(actor, dx, dy)
        dy -= line_height / 2
        dw = contents.width - dx - 124
        draw_actor_name(actor, dx, dy)
        draw_actor_nickname(actor, dx, dy + line_height * 1)
        draw_actor_class(actor, dx + 200, dy, dw)
        draw_actor_level(actor, dx, dy + line_height * 2)
        draw_actor_hp(actor, dx, dy + line_height * 3, dw)
        draw_actor_param(actor, dx, dy + line_height * 5, 2)
        draw_actor_param(actor, dx, dy + line_height * 6, 4)
        draw_actor_param(actor, dx, dy + line_height * 7, 3)
        draw_actor_param(actor, dx, dy + line_height * 8, 5)
        draw_actor_param(actor, dx, dy + line_height * 9, 6)
        draw_actor_param(actor, dx, dy + line_height * 10, 7)
        draw_item_name(actor, dx + 204, dy + line_height * 5, enabled = true, width = 172)
    Now how I came to this solution was by following the draw functions backwards until I reached this.

    Windows_Status defines "Draw Block 3" as:
    Code:
      def draw_block3(y)
        draw_parameters(32, y)
        draw_equipments(288, y)
      end
    ...which then is defined in draw_equipments as:
    Code:
      def draw_equipments(x, y)
        @actor.equips.each_with_index do |item, i|
          draw_item_name(item, x, y + line_height * i)
        end
      end
    ...which is then defined in another class (Windows_Base) as draw_item_name:
    Code:
      def draw_item_name(item, x, y, enabled = true, width = 172)
        return unless item
        draw_icon(item.icon_index, x, y, enabled)
        change_color(normal_color, enabled)
        draw_text(x + 24, y, 172, line_height, item.name)
      end

    The error I receive when trying to use this call is:

    NoMethodError occurred.
    undefined method "icon_index" for 1:Fixnum
     
    Last edited: Jul 31, 2019
    #1
  2. Engr. Adiktuzmiko

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

    Messages:
    14,461
    Likes Received:
    2,851
    Location:
    Philippines
    First Language:
    Tagalog
    The method takes an item but your code gives it an actor, of course it wont work...

    draw_item_name(item,etc)
    vs
    draw_item_name(actor,etc)

    You should probably change draw_item_name to draw_equipments or make your own item array and enumerate it to use in draw_item_name
     
    #2
  3. Sketchward

    Sketchward Veteran Veteran

    Messages:
    55
    Likes Received:
    3
    Location:
    Canada
    First Language:
    English
    Okay but I'm asking what the internal item variable name would be to plug in, for example what is the item called in your weapon slot, or shield, or helmet... I've also tried using the draw equipment command as posted from Windows_Status but it spits out other errors.
     
    #3
  4. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,405
    Likes Received:
    10,415
    First Language:
    English
    Primarily Uses:
    RMVXA

    I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.

     
    #4
  5. Sketchward

    Sketchward Veteran Veteran

    Messages:
    55
    Likes Received:
    3
    Location:
    Canada
    First Language:
    English
    So does anyone know the internal name for:

    Equipped Weapon
    Equipped Shield
    Equipped Helmet
    Equipped Armor
    Equipped Accessory

    As well as how to display them on a menu?
     
    #5
  6. Sixth

    Sixth Veteran Veteran

    Messages:
    2,122
    Likes Received:
    792
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    You don't want their "internal name", you need the equipment objects of the actors for the method you used (draw_item_name).

    Code:
    actor_object.equips[slot_id]
    The actor_object must be a valid Game_Actor object.
    The slot_id must be a valid... well, slot ID. 0 is first slot (weapon by default), 1 is 2nd slot (shield / 2nd weapon by default), and so on.

    Just note that if there is nothing equipped on the specified slot, it will be nil, and if it is, nothing will be drawn, at least not with the default draw_item_name method.
     
    #6
  7. Sketchward

    Sketchward Veteran Veteran

    Messages:
    55
    Likes Received:
    3
    Location:
    Canada
    First Language:
    English
    Thanks much.

    Point of interest, I'm using a script that modifies the number of equipment slots available. Right now it's [0,1,2,3,4,4] for single weapons, [0,0,2,3,4,4] for dual-wield. With 4 being the accessory slot. If I equipped two different accessories, which one would be drawn?
     
    #7

Share This Page