Inventory interactions

  • #1, by asherSunday, 11. December 2016, 12:31 7 years ago

    Hi, I have been working on my first game and am nearing completion. I have mostly just used the menu system but in some places have written some script.

    I am having a problem with interactions between some items in the inventory. Say there are 3 items in the inventory, a flag, a dog and a toothbrush. Because the toothbrush can be used by one of the characters I have set it up so that if the toothbrush is clicked in the inventory the cursor changes from the standard pointer to a toothbrush. If the flag or dog are clicked in the inventory the cursor stays as the standard pointer. The items all work fine in the game itself. In the inventory commands I have used 'Item dropped' so that if the flag is dropped on the dog or toobrush the character says 'That won't work', similarly if the dog is dropped on the flag or toothbrush the character says 'That won't work'. This part is all working fine. However, because I have set up the toobrush so that when you click on it, it changes to a toobrush cursor, the toothbrush is not able to be dropped on the dog or flag.

    I think I need to do something like:

    1) If cursor is pointer then if item dropped on another item in inventory, character says 'That won't work'

    2) If cursor is not pointer then if click on item in inventory, character says 'That won't work'

    I am able to get each of these working independently but not concurrently.

    Any suggestions on what approach I should use?

    Thank you for your help

    Newbie

    8 Posts


  • #2, by afrlmeSunday, 11. December 2016, 13:16 7 years ago
    You mean you've set them as a cursor or as dragged items? Dragged items is where it replaces the cursor with the same image as the relevant item in the inventory. If you are using dragged items then just create a dropped item x? (immediate) action.

    Also quick question, what action type are you using for when a player left clicks on an inventory item? If you are using "left click (immediate)" then it will likely cause issues with other action types you try to use on it as any command you execute on it with left mouse button is still registered as left click first & foremost, so I recommend instead that you use command x executed (immediate) type for items.

    Imperator

    7278 Posts

  • #3, by asherMonday, 12. December 2016, 11:38 7 years ago

    The dragged items (eg the dog and the flag) work fine, and as you've suggested I have used a dropped item (immediate action).

    For items that are used on the character (eg the toothbrush) I thought it looked a bit strange when they were dragged and used on the character as they were too big in relation to the character. So what I did was when you click on the toothbrush in the inventory the cursor changes to a toothbrush which is then used by clicking on the character.

    So my inventory has a combinationof items that are dragged and items that when you click on them the cursor changes to that object. Everything in the game works OK, but now that I've come to this problem with interactions in the inventory I am thinking that maybe I should have set things up differently?

    In relation to your question I was trying to keep the game play simple so the only command I have used throughout is left click. But maybe I should look at changing this?

    Newbie

    8 Posts

  • #4, by afrlmeMonday, 12. December 2016, 13:31 7 years ago
    My inventory system involves setting up a command & custom cursor for every possible inventory item. I then link the relevant cursor to the relevant command. Why do I use commands instead of the actual default dragged or regular command + item systems? Simple, because commands are a lot more flexible. I get to use custom cursors & I don't have to bother setting the item & cursor I want to display or have the hassle of it displaying the too large inventory image/animation as the cursor. Also commands let me create if command is x queries in action blocks which is very useful & commands aren't automatically reset back to default (dropped) like items on right click.

    Imperator

    7278 Posts

  • #5, by sebastianMonday, 12. December 2016, 19:47 7 years ago
    The problem here is that you want to drive with two different systems (drag/drop and "oldschool" combine)

    Here i would suggest to rebuild your system and adapt it to a command+change cursor system like AFRLme mentioned.

    By that you can individually define a cursor for your item. It could look the same as the item but also can be smaller (cursor with smaller graphic) or not displayed at all (cursor looks the same as the default cursor).

    Thread Captain

    2346 Posts

  • #6, by asherTuesday, 13. December 2016, 10:48 7 years ago

    Thank you both for your suggestions, I agree it seems that I should use a command and change cursor system. I found an earlier thread originally posted by lyra on 16/2 (I couldn't work out how to add a link in this post) that I think has some instructions on how to do this? Do you know whether one of the example games that can be downloaded uses this approach so that I could see how it is done?

    At the moment I have two interfaces (1) a mouse interface with a left click button and (2) an inventory interface. So to use the command and change cursor system would I need to add a command button for each item to the mouse interface?


    Newbie

    8 Posts

  • #7, by asherTuesday, 13. December 2016, 10:48 7 years ago

    Thank you both for your suggestions, I agree it seems that I should use a command and change cursor system. I found an earlier thread originally posted by lyra on 16/2 (I couldn't work out how to add a link in this post) that I think has some instructions on how to do this? Do you know whether one of the example games that can be downloaded uses this approach so that I could see how it is done?

    At the moment I have two interfaces (1) a mouse interface with a left click button and (2) an inventory interface. So to use the command and change cursor system would I need to add a command button for each item to the mouse interface?


    Newbie

    8 Posts

  • #8, by afrlmeTuesday, 13. December 2016, 13:00 7 years ago
    No, none of them use it to my knowledge, they are all using the default system as far as I know...

    Originally I was also using the default inventory system for A Little Less Desperation, but I eventually got bored of the limitations & decided to come up with something that was a lot more flexible & dynamic.

    https://i.gyazo.com/de8459153bef104d351dcba4777c4b30.png

    https://i.gyazo.com/822f8bf7699d083257d1cdea7a7dac34.png

    https://i.gyazo.com/00f29ebfa63dd883c27022d56fa2c0af.png

    https://i.gyazo.com/6a61e075fb2aab1dab78d96bfda0e831.png

    https://i.gyazo.com/c30f604ab035573be2928d544990dd15.png

    https://i.gyazo.com/c1adeebdf1531f009baf1e5151da0887.png

    https://i.gyazo.com/8e9922347ac9b195a06a90ba00a3e5cc.png

    Imperator

    7278 Posts

  • #9, by asherSaturday, 17. December 2016, 07:11 7 years ago

    Thank you for all that detailed information I was able to follow your instructions to get it working.

    Using this approach what is the best way to deal with incorrect interactions (1) between scene objects and items and (2) between items? For example if there is a scene object a rubbish bin and there is an item a piece of rubbish, and the player is supposed to put the rubbish in the bin, I can follow your example to see that for the rubbish bin object I would use the Execution type 'Executed command on object' with command 'Rubbish'. What though about items that players try to put in the rubbish bin that don't belong there? For example there may be 10 other items that should not be put in the rubbish bin. Using the default system I would have used the Execution type 'Item dropped' '[any item)' to add text to say 'That doesn't belong in the bin'. I couldn't work out what would be the equivalent in the command and change cursor system.

    Newbie

    8 Posts

  • #10, by afrlmeSaturday, 17. December 2016, 12:29 7 years ago
    Inside of the characters section of the editor you can create comment sets for your character to say. These are used to deal with invalid interactions with scene objects, items & characters.

    https://i.gyazo.com/63ecd877200a59b5e696a671ca949572.png

    Personally I didn't use them as I wanted to build my own dynamic system for handling them so that we ended up with a random response either generic or based on the item we are currently holding. I won't go into the details on that as it was a bit of work.

    https://i.gyazo.com/09cb457266052a4610ddf6145bb8d0ca.png

    https://i.gyazo.com/fd2d4b87e0f3ea4ff0c5c62a1d485405.png

    https://i.gyazo.com/342d7097e82d79bcfbf5244df1968e97.png

    Like I said, fair bit of work involved in that system which requires both action parts & Lua script, but if you are just wanting some generic refusals then the comment set in the first screenshot I posted should be more than enough. You can create multiple comments & even change them if you like, so you could run a query inside of each scene object on mouse over if x command change comment set to y, etc. Lua would be better for that though as you could create tables & run a more complex if query inside of a for loop or something to check if an item is x, y z then return a specific comment set. It's nothing I considered at the time I created my system, but it would be a more global way to go about it.

    Imperator

    7278 Posts

  • #11, by asherFriday, 13. January 2017, 04:00 7 years ago
    Thank you for all your advice smile. I've finally had time to make the changes you've suggested and all is working well.

    Newbie

    8 Posts