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

  • #1, by fabian-schurgersWednesday, 27. October, 09:19 A month 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

    104 Posts


  • #2, by PanSWednesday, 27. October, 10:11 A month 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, 13:37 A month 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

    104 Posts

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

    Great Poster

    439 Posts

  • #5, by PanSWednesday, 27. October, 13:48 A month 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
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30

    Newbie

    73 Posts

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

    Forum Fan

    104 Posts

Write post