Broken Sword Inventory Behaviour

  • #1, by andrea_visFriday, 28. October 2022, 00:41 A year ago
    I would like to have an inventory working as in Broken Sword 2. The inventory of Broken Sword 2 requires drag-and-drop to use an item. In other words, you should drag an item of the inventory to use it (i.e., press-and-pan with the mouse) and then release the mouse button when you want to use it with another object.

    In addition, if the object is dropped on an non-interactive area of the screen, it goes back to the inventory. The same happens (but with a "it doesn't work" message) if the object is dropped on a wrong one.

    How can I replicate those characteristic behavious?
    Please note that I followed the inventory tutorial (https://wiki.visionaire-tracker.net/images/9/93/Manual_05_in...) and the inventory behaviours are different from those of Broken Sword 2:
    1) to pick up an item, I have to left-click it.
    2) to put the item again in the inventory, I have to right click.

    Thank you in advance,
    Andrea

    Newbie

    11 Posts


  • #2, by esmeraldaThursday, 03. November 2022, 12:50 A year ago
    Not that easy...

    What you could do:

    - turn off the dragging in the games properties and in the command you used for dragging
    - in the setting for the mouse properties, add an action for "left mouse button hold (button pressed)" with an execute script action. 
       add this  script inside the action:
    if not game.CurrentObject:isEmpty() and game.CurrentObject.IsItem then -- check if there is an object beneath the cursor and this object is an item
    game.UsedItem = game.CurrentObject -- set this item as used
    game.UsedItemPicked = true -- set this item as dragged so it will appear as cursor
    end

    - add an action for the "left mouse button hold (button released) and add the actions like in the image.
    - Set the holding time to your liking (the default 600 ms might be a bit long).

    this might do what you want...

    As action for using the item on an object, use the "drop item" action type, like when using the build-in drag&drop.

    Key Killer

    513 Posts

  • #3, by andrea_visTuesday, 08. November 2022, 12:13 A year ago
    Many thanks for your help and kindness Esmeralda! I will try it!
    This kind of drag-and-drop behaviour is in my personal wishlist for the next version of Visionaire smile

    Jokes apart, I find that users expect such drag-and-drop (Broken Sword type) behaviour since... this is the way most OS work. In addition, users find it in many modern point-and-click adventures, i.e., the Case of the Golden Idol and the Darkside Detective.

    Again, thanks!     
     

    Newbie

    11 Posts

  • #4, by esmeraldaTuesday, 08. November 2022, 15:32 A year ago
    That's where our mileage seems to differ.^^

    I played the original Broken Sword games, and they don't have this sort of dragging. That was introduced to the remastered versions, I guess. 
    And this dragging is ideal for touchscreens, but (in my opinion) annoying when playing on pc with a mouse. ;-)

    Key Killer

    513 Posts