How to use a scene object on another object withour taking it into inventory?

  • #1, z AkcayKaraazmakThursday, 08. December 2016, 22:26 hodinky 8 years ago
    Hi guys, I need a solution for a puzzle. There is rock on a scene and want to use it onto another object on same scene. But I dont want to take that rock into inventory. What I need is, when user clicks the rock, the cursor will change into rock icon and then when I click to scene object with the rock icon (rock cursor) then puzzle script will start. Is this possible?

    Cheers smile

    Čestný člen

    440 Posts


  • #2, z ke4Thursday, 08. December 2016, 22:37 hodinky 8 years ago
    I suppose you could create a new cursor that would look like the rock you need and then make a classic left click action on your object that will change your cursor and change some condition from false to true.

    In the second object you would also have a left click action which would check if the condition is false or true. True = you're holding the rock. And then do whatever you want to do.

    Maybe you don't even have to use a condition for that and you could just check via lua what cursor is being used.

    Zabiják klíčů

    810 Posts

  • #3, z afrlmeFriday, 09. December 2016, 03:10 hodinky 8 years ago
    As ke4 says, the simplest solution would be to create the rock as a cursor &/or command with the cursor linked to it inside of the command properties tab.

    I actually sorted something out recently for someone else using the same system (cursor + command) for a mini-game in which a sandwich has to be created by dragging & dropping ingredients onto some bread. I used a mixture of cursors, commands & conditions to hide & show the scene objects as needed.

    Basically what you need to do is...

    1. link a condition to the properies tab of the scene object in question.

    2. create an execute action at destination or immediate command type (whichever is needed) & inside of that set current command to the one you created to represent the object & then change the value of the condition you linked to the scene object.

    3. you should now be carrying the scene object as your cursor & the scene object should now be hidden.

    4. you need to figure out someway of restoring the scene object back to it's original position if desired (player uses it on something they aren't supposed to or right clicks to drop it, etc).

    Alternatively - I'm not sure if it will work as I've not tried, but I believe you can set items (even ones not currently in your inventory) as held / dragged. Worth a try, but less flexible than creating custom cursors & commands.

    Imperátor

    7285 Posts

  • #4, z sebastianFriday, 09. December 2016, 08:27 hodinky 8 years ago
    the easiest way is to use Lees last alternative solution. 
    I dont know what kind of "item dragging"  you use right now? 

    If its
    a) the official dragging from the engine: use "Set item"  action part
    It sets the currently held item to the one you selected.  Also check "Dragged item"  

    use "Item dropped" + your set item  action at the designated object in the scene to trigger your script. 

    (if you still use my old script i sent you this should be working for you) 

    b)  setting the item without any visual change of the cursor (like in monkey island 1&2) : do the same as a, but uncheck the "Dragged item"  

    use "execute command" + your use command + your set item action at the designated object in the scene to trigger your script. 

    c) like method b but also changing the cursor with lua scripting to simulate dragging (most complex but most moddable) : do the same as a, but uncheck the "Dragged item" 

    use "execute command" + your use command + your set item action at the designated object in the scene to trigger your script. 

    d) setting for every item an own command and changing the cursor when the command was set (like in the Little Less Desperation game kickstarter demo)  : ...  ask Lee again grin

    use " Lee"  + " Lee"  to "Lee"  your "Lee"  to the designated "AFRLme" razz

    Kapitán

    2346 Posts

  • #5, z afrlmeFriday, 09. December 2016, 12:59 hodinky 8 years ago
    No, don't ask Lee. He's all questioned out! grin

    Yeah in ALLD I use commands & custom cursors for items. We do have items that get added to the inventory, but they are purely just to show them in inventory for the player to examine, combine or left click (interact with) which sets the current command to the relevant item command. It was a lot more flexible than using dragged items made interaction with characters & scene objects much easier - for me anyway.

    As for actual dragging & dropping & not the single left click to set dragged item you can either use the Lua mouseEvent handler or the mouse holding & mouse released actions inside of the game (cog) tab > mouse properties. I ended up having to use the actions in mouse properties because the left button hold action types in scene object actions list only seems to register left button hold released & not the button holding part. You might still be able to use the left button hold actions in them for checking if x item is currently being held or x command is active to determine if something should be triggered. I personally used mouse properties actions only because he only needed to check if item is dropped on 1 single object & if not then object then reset back to default command & reset item positions if required.

    Imperátor

    7285 Posts

  • #6, z AkcayKaraazmakFriday, 09. December 2016, 13:08 hodinky 8 years ago
    Thank you so much mates! I'll try your solutions and let you know the result smile

    Cheersss

    Čestný člen

    440 Posts