Inventory

  • #1, by dramaminiMonday, 29. September 2014, 16:20 11 years ago
    Hi!
    I have an inventory which holds 5 items.
    How can I highlight the specific item that user clicks on it? (I' ve made an active image in photoshop)
    Additionaly how can I remove the highlighted mask, when user clicks anywhere at scene with the dragged item?

    Thank you!

    Newbie

    44 Posts


  • #2, by afrlmeMonday, 29. September 2014, 16:59 11 years ago
    Are you talking about the item itself or the inventory slot?

    If you are talking about the item itself then you want to create the image for the item as an animation & then control the animation frames of the item with lua script.

    I have mentioned to the devs before that it would be more beneficial to change the current item image/animation system so that it has an active & inactive animation system same as the mouse cursor system. Hopefully it will get sorted at some point as it will make it much simpler to define active & inactive state of items.

    Imperator

    7285 Posts

  • #3, by dramaminiMonday, 29. September 2014, 17:40 11 years ago
    Hmm.. First I tried with item itself but I couldn't highlight it. (thanks for LUA tip).

    So, I'm now using a highlight image, same for all inventory slots.
    When I click an item in the inventory, the specific inventory slot is being highlighted with the active image I've made.

    How can I remove this active image when user clicks anywhere at the scene with the dragged item?

    Newbie

    44 Posts

  • #4, by dramaminiMonday, 29. September 2014, 17:46 11 years ago
    Good idea... it would be very felpful, indeed.

    Newbie

    44 Posts

  • #5, by afrlmeMonday, 29. September 2014, 18:57 11 years ago
    it's not a slot per say that you are highlighting, it's just an action area.

    I would either create a table with all the names of the slots & use a for loop to reset all of them back to inactive image, or check which has active image & reset back to inactive or set a value when clicking item in a slot so you know which one to set inactive after. Does the dragged item not disappear after left clicking or right clicking anywhere on the scene?

    The best solution would be to include in left & right click actions (mouse properties) a query to see if an item is currently being held & if so set the inactive image of the inventory slot.

    P.S: it's Lua not LUA. smile

    P.P.S It seems that there is no ButtonActive table in the data structure. You may need to create a called by other action which you create a "set button inactive" action part for each of the buttons being used as inventory place holders.

    In mouse settings I mentioned earlier, add an execute a script action containing something along the lines of...
    if game:getLink(VGameUsedItem) ~= nil then
     startAction("Actions[name_of_called_by_other_action_you_created_earlier]")
    end
    

    ..the code & methods I have mentioned are theoretical!

    Imperator

    7285 Posts