Inventory

  • #1, by irinaThursday, 04. August 2022, 21:00 A year ago
    Hello! 

    I would like to use two images for the inventory. One shows the closed inventory and one the opened.

    A left click on the closed inventory should activate the image for the open inventory. 

    How can I do that? Probably with LUA. I don't know where in Visionaire I have to put the code. 

    I found following  in the forum

                                                  Interfaces["inventar off"].Visible = false

    But I don't know what I have to do with it and if it's the right code. 

    Thank you for any help!

    Irina


    Newbie

    14 Posts


  • #2, by afrlmeThursday, 04. August 2022, 23:16 A year ago
    Is it just an image over the top of the inventory or is the inventory supposed to change position?

    If it's just an image then you can create a condition in the conditions tab for the interface & then link it to the condition bit in the button properties tab & you can then toggle the image on & off by changing the condition between true & false.

    Imperator

    7278 Posts

  • #3, by irinaFriday, 05. August 2022, 20:47 A year ago
    Is it just an image over the top of the inventory or is the inventory supposed to change position?

    If it's just an image then you can create a condition in the conditions tab for the interface & then link it to the condition bit in the button properties tab & you can then toggle the image on & off by changing the condition between true & false.
    Thank you for your answer.  Unfortunately I couldn't solve the problem. I made this for now. The images are placeholder. Not the final images ;-)  

    Newbie

    14 Posts

  • #4, by irinaFriday, 05. August 2022, 20:49 A year ago
    P.S.
    The images should not change position  but the open inventory is bigger than the closed. 

    Newbie

    14 Posts

  • #5, by afrlmeFriday, 05. August 2022, 22:50 A year ago
    OK, I didn't realize it was 2 interfaces & one was a button used to open & close the inventory.

    You need to assign both of those interfaces to the playable character via the interfaces tab in the character section of the editor. You will also need to hide the inventory open interface. You already shared the correct code for that in your initial post. Inside of the main project settings area of the editor there's a section where you can create actions that should happen when the game is launched. Open up that section & create an execute a script action part & add this line of code into it...
    Interfaces["inventory open"].Visible = false -- replace inventory open with whatever you called the interface. names are case sensitive.

    Next create & draw an object area polygon for your inventory closed/toggle button & then in the actions for it create a left click action & inside of that create another execute a script action part & inside of that add this code - remember to replace names with what you called them...
    local inv = Interfaces["inventory open"]
    
    
    
    if inv.Visible then
    
     inv.Visible = false -- hide inventory interface
    
    else
    
     inv.Visible = true -- show inventory interface
    
    end

    & that should be about it. You may also need to draw the interface area around your inventory interfaces if you haven't already. Also command type buttons should only be created in your main command interface & only for buttons that are meant to be used as commands. all other buttons should be set as action area type, or relevant inventory type for inventory interfaces.

    Imperator

    7278 Posts

  • #6, by esmeraldaSunday, 07. August 2022, 17:49 A year ago
    you can do what AFRLme said with action parts "show/hide interface". This will show/hide not an individual interface, but an interfaceclass.
    So set you closed inventory as "secondary interface" or whatever category is still available (it is possible to create new categories with the exploer ctrl+e) and your open inventory as "inventory".
    Assign both interfaces to your character.

    On the closed inventory add an action area. Add an action to this action area, either when clicking or entering the area (whatever you like best) and execute the action part "show interface", select the open inventory. And "hide interface" and select the closed inventory.

    The opened inventory needs to have an interface area and then add an action on leaving that area (found in the properties tab of the interface) where you hide the open inventory and show the closed one.

    And of course you would need to hide the opened inventory at the start of the game. So add the "hide inventory" action part (with the opened inventory selected) in the start action (game properties)

    Key Killer

    508 Posts

  • #7, by irinaMonday, 08. August 2022, 15:54 A year ago
    Thank you guys! That was very helpful! :-)

    Newbie

    14 Posts