Changing the image of the inventory item when it comes over a scene object?

  • #1, von AkcayKaraazmakDonnerstag, 20. August 2015, 16:41 Uhr vor 9 Jahren
    Hi there,

    How I can change the image of the selected item when it comes over a scene object? For example, I click the item "key" from inventory and move it over the door object in the scene. And when the cursor (item key) on the door object, I want to change the image of the item key, so user can understand key can be used on the door.

    Thank you smile

    Experte

    440 Posts


  • #2, von ke4Donnerstag, 20. August 2015, 18:00 Uhr vor 9 Jahren
    I'm not sure if you can change the item image, atleast i didn't find how.

    Tastenjunkie

    810 Posts

  • #3, von AkcayKaraazmakDonnerstag, 20. August 2015, 18:03 Uhr vor 9 Jahren
    So mate, what u do for this situation? You take the item and how u make it understandable that, it can be used on that object?

    Experte

    440 Posts

  • #4, von sebastianDonnerstag, 20. August 2015, 18:11 Uhr vor 9 Jahren
    normally via the actiontext you can tell the player thatvthere is an Object.
    Nevertheless it would be cool to have a colored border (image) around that item when it hovers interactable objects or other items.
    I think that could be done in 2 ways:
    1. Make 2 items for each item and change the item when it hovers an object to the other and the other way around. I think this is a solution even if it is very hard to implement.
    2. Changing the Items sprite Image via Lua when it hovers objects and thr other way around.
    3. Use an animation for each item and try to switch it to a second one when hovering an object. Maybe also doablenwith lua

    Thread König

    2346 Posts

  • #5, von ke4Donnerstag, 20. August 2015, 18:11 Uhr vor 9 Jahren
    Well i don't do anything in that case... grin
    You can detect if some item is held and if so then check the item name.
    So i guess the workaround would be to have 2 versions for each item active & not active and on the hover you would set the active item as held and on the cursor leaves the normal again.
    But it's so much additional work.. but maybe some function could handle that.

    This is what i tried but it doesn't do anything

    local itm = game.GameUsedItem:getName()
    
    if itm ~= "" then
    local obj = getObject("Objects[" .. itm .. "]")
    obj.ObjectSprite.SpriteSprite = {"path", "0", "0", {"0", "0"}}
    end
    

    Tastenjunkie

    810 Posts

  • #6, von sebastianDonnerstag, 20. August 2015, 18:25 Uhr vor 9 Jahren
    the image sprite is a field in the objecttable of an item, so i think it can be changed. Its worth a try.

    Thread König

    2346 Posts

  • #7, von AkcayKaraazmakDonnerstag, 20. August 2015, 20:12 Uhr vor 9 Jahren
    Thank you so much mate!! I'l try your ideas, hope I'll make it worksmile

    Experte

    440 Posts

  • #8, von sebastianDonnerstag, 20. August 2015, 20:19 Uhr vor 9 Jahren
    im not at home right now but i found this with the mobile version of the forum:
    http://www.visionaire-studio.net/mobile/#forum/thread/25374/1/

    Thread König

    2346 Posts

  • #9, von sebastianDonnerstag, 20. August 2015, 20:20 Uhr vor 9 Jahren
    why does the forum trim doen the mobile links so they doesnt work anymore xD?

    @AkcayKaraazmak Search for " item highlight " in the forum.

    Thread König

    2346 Posts

  • #10, von AkcayKaraazmakDonnerstag, 20. August 2015, 20:38 Uhr vor 9 Jahren
    Thhank you bro! I cant see anything on that page something related with item highlight :\ Isnt the page is http://www.visionaire-studio.net/mobile ?

    Experte

    440 Posts

  • #11, von sebastianDonnerstag, 20. August 2015, 21:06 Uhr vor 9 Jahren

    Thread König

    2346 Posts