Inventory Action Text

  • #1, z nate-ingraciaThursday, 03. November 2022, 05:28 hodinky 2 years ago
    Can someone show me how to make an alternative action text system for scanning over inventory items? I see in the inventory properties it allows for its own action text, but I can't figure out how to replace the standard action text, and I can't figure out how to set the rectangle.

    Bažant

    13 Posts


  • #2, z esmeraldaThursday, 03. November 2022, 11:53 hodinky 2 years ago
    The action text for the Interface does not seem to be completely independent from the normal action text.

    For what I can see, you can set the rectangle for the inventory action text only by Lua:

    Interfaces["Name_of_Inventory"].ActionTextRect = {x=200, y=200, width=100, height=100}

    (adjust x, y, width and height to your needs and replace the name of the inventory with the name of yours)
    And add this line of code as "execute script" action part in the start action for the game.

    But this will not only draw the action text when hovering over items in the inventory, but for all objects. So you need to turn it on and off.
    You need to do this by using Lua again.

    Add to the line above a second line:
    Interfaces["Name_of_Inventory"].DrawActionText = false


    And in the action that shows your inventory the line
    Interfaces["Name_of_Inventory"].DrawActionText = true

    to turn off the normal action text, add the line:
    game.DrawActionText = 0


    To reverse this add in the action that hides the interface:
    Interfaces["Name_of_Inventory"].DrawActionText = false
    game.DrawActionText = 1


    0 means - no action text
    1 = action text at cursor
    2 = action text in rectangle

    Set the font for the action text in the properties of the inventory and then turn off the action text for the inventory. 

    There might be a better/easier way to do it, but it's the only one I saw just now.



    Zabiják klíčů

    525 Posts