'I can't use that item there' system trouble.

  • #1, by fabian-schurgersWednesday, 27. October 2021, 09:19 2 years ago
    Hi there,

    First, I would like to thank you guys for all the help you've given me! It's really appreciated!

    Now, I'm trying to get a system working that will give the 'I can't use that item there' message when you drop an item on an object that it can't interact with.

    I was thinking I could give objects a seperate entry for all items in the game, so for every item an 'if item dropped' command. But that would be a mountain of work.

    So I was thinking, is there a LUA line that says, "if any other item than this item is dropped on this object, the 'can't use it here' message appears?''

    A kind of 'catch all' thing, that would be great!

    Anyway, thanks!


    Forum Fan

    128 Posts


  • #2, by PanSWednesday, 27. October 2021, 10:11 2 years ago
    Edit: Oh, I think you already mean what I did down here and you explicitly don't want that.

    You could create a script under the "left mouse" button checking first, if the "combine" command is set then if theres an object under the cursor. If yes, then link to the line "Cant do that". But there is the problem that you need a lot exceptions in this script, if the item should be combinable with the object under the cursor. For dropping item on another I have no approach.


    ----
    You could create an "combine" with "everything" action on all items (and objects) linked to an action which hold the line "Cant do that."

    Yes, you need (to copy ) this "combine" action entry on every game object / item / character which should be interacteable, but its a very simple solution in my eyes and you can link to other more specific item actions. E.g. Use every item on the item slimy rope: "That won't stick to the slippery rope."

    Maybe I have a missunderstanding what you want to do, but here is the way I do that (sry, my VS interface is in german):

    Newbie

    73 Posts

  • #3, by fabian-schurgersWednesday, 27. October 2021, 13:37 2 years ago
    Edit: Oh, I think you already mean what I did down here and you explicitly don't want that.

    You could create a script under the "left mouse" button checking first, if the "combine" command is set then if theres an object under the cursor. If yes, then link to the line "Cant do that". But there is the problem that you need a lot exceptions in this script, if the item should be combinable with the object under the cursor. For dropping item on another I have no approach.


    ----
    You could create an "combine" with "everything" action on all items (and objects) linked to an action which hold the line "Cant do that."

    Yes, you need (to copy ) this "combine" action entry on every game object / item / character which should be interacteable, but its a very simple solution in my eyes and you can link to other more specific item actions. E.g. Use every item on the item slimy rope: "That won't stick to the slippery rope."

    Maybe I have a missunderstanding what you want to do, but here is the way I do that (sry, my VS interface is in german):


    Thanks for the help! It is a bit of a difficult thing indeed smile
    I don't know if it is possible, but I thought I'd give it a try.

    Forum Fan

    128 Posts

  • #4, by esmeraldaWednesday, 27. October 2021, 13:42 2 years ago
    Why not use the comment sets?

    Key Killer

    513 Posts

  • #5, by PanSWednesday, 27. October 2021, 13:48 2 years ago
    Maybe thats what you want. See it more as a approach not a working solution. Its very simple and there are no special exceptions at the moment. And you have to find a way to call this function (for example by clickling left mouse button or a key):

    function combineObjs()
      local combinable = false
    
      if game.ActiveCommand == Interfaces.int_interactions.Buttons.act_combine then  --check if the combine command (act_combine) is active 
    
        if not game.CurrentObject:isEmpty() and not game.UsedItem:isEmpty() then     --check if there is an object under the cursor and if there is an item selected
      
          for i=0, #game.CurrentObject.Actions do                                    --search the actions of the object under the cursor
            local tStr = tostring(game.CurrentObject.Actions[i])
      
            if string.find(tStr, "act_combine") then                                 --checks if the action contains the combine command
    
              if string.find(tStr, game.UsedItem:getName()) then                     --checks if the action contains the selected item
                combinable = true
                break
              end
    
            end
    
          end
    
          if combinable == true then
            print("I can combine that!")                                             -- output if the item can combined with the object
          else
            print("I can't use that item there")                                     -- output if there item cant combine with the object OR there is no combine action 
          end
    
        end
      end 
    end

    Newbie

    73 Posts

  • #6, by fabian-schurgersWednesday, 27. October 2021, 17:23 2 years ago
    Thanks guys, will try that!

    Forum Fan

    128 Posts