Dragging items in the inventory

  • #10, by gustySunday, 15. September 2013, 23:30 7 years ago


    if you have a specific cursor to show the character is currently holding an item then you will need to create a condition; something like: "item_held?"... & add a query to the mouse over/out actions for each item.

    if condition "item_held?" is false
    set cursor "whatever_you_want"
    end




    Well I doubt I got it right, but I came up with this setup. It's a quite messy solution and it doesn't work very well. I did screw something up, but I'm not sure what.

    [Btw yes, I have prepared an individual cursor for each item. That cursor is set via immediate action after clicking on the item in the inventory exactly like you suggested in your first post.]


    1) I created a new condition "itemX_held?", defaultly set on False

    2) I added a new entry for action to "itemX" - when "action" is executed (immediate):
    Change condition "itemX_held?" to True

    3) I set action for active object in the scene - when "Cursor enters":

    If condition "itemX_held?" is false
    Set cursor to "look"
    End if

    4) And for "Cursor leaves" I set:

    If condition "itemX_held?" is false
    Set cursor to "walk"
    End if
    Change condition "itemX_held?" to false


    Did you mean something like that or am I completely wrong? smile I'm not sure where exactly (in which place/event) should I change that condition back to False in order to get whole setup right :-/

    Forum Fan

    159 Posts


  • #11, by afrlmeMonday, 16. September 2013, 16:05 7 years ago

    Well I doubt I got it right, but I came up with this setup. It's a quite messy solution and it doesn't work very well. I did screw something up, but I'm not sure what.

    [Btw yes, I have prepared an individual cursor for each item. That cursor is set via immediate action after clicking on the item in the inventory exactly like you suggested in your first post.]


    1) I created a new condition "itemX_held?", defaultly set on False

    2) I added a new entry for action to "itemX" - when "action" is executed (immediate):
    Change condition "itemX_held?" to True

    3) I set action for active object in the scene - when "Cursor enters":

    If condition "itemX_held?" is false
    Set cursor to "look"
    End if

    4) And for "Cursor leaves" I set:

    If condition "itemX_held?" is false
    Set cursor to "walk"
    End if
    Change condition "itemX_held?" to false


    Did you mean something like that or am I completely wrong? smile I'm not sure where exactly (in which place/event) should I change that condition back to False in order to get whole setup right :-/


    hmm... the condition should be set back to false after you are no longer holding the item... in other words if you use an item on an object or character & then the item is removed from inventory or when current item is set back to empty, then you should include the "set condition 'item_held?' to false action part.


    If condition "itemX_held?" is false
    Set cursor to "walk"
    End if
    Change condition "itemX_held?" to false


    what you have written above for example is incorrect because it will always set the condition to false after it has performed the if query - remove the change condition part from this.

    I will look over your previous post later on - I'm a bit busy at the minute.

    Imperator

    6846 Posts

  • #12, by gustyTuesday, 24. September 2013, 04:17 7 years ago
    So I made a decision. I will stick with the original dragging system because I think this "manually dragging" solution seems unnecessarilly complicated. I want my game to be clean, simple and efficient in matter of scripting and code so I think this other solution isn't worth it. But thank you very very much AFRLme for your effort and time you spend here, I really appreciated it!! Anyway you helped me with that global "if query" when clicking on the floor with selected item, so thanks for this solution again man!

    There is a last thing I would love to implement into my dragging system. It concerns the action box where object's labels (names) shows up. Well, I would like to have the item's label text displayed when item is held (dragged) in the action box too. There is interesting thing - when I allow dragging in the Game Properties then item's label text is displayed in the action box ONLY IF I hover cursor over it. But if I click it and drag it (=item is held), then item's label isn't displayed in the action box anymore. And now when I disable dragging in Game Properties then action box displays item's label correctly whole time when it's held -- but obviously dragging isn't working because it is not allowed.

    So I would like to have this kind of behaviour:

    I click in the inventory on the "key" item. Item si held. Now I want action text in the bottom says "key". And when I hover with this item on the door object in the scene I want action box diplays "key door". Would you AFRLme have any idea how to achieve this?

    Forum Fan

    159 Posts

Write post