Announcement

Collapse
No announcement yet.

Blueprint Runtime Error!!!!!!!!!!!!! When trying to create an interactions system.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Blueprint Runtime Error!!!!!!!!!!!!! When trying to create an interactions system.

    I accidentally posting this in the wrong area.

    I'm currently trying to create an interactions system in Unreal Engine 4.19. I'm getting an error and I'm not sure on how to fix it. Any help will be much appreciated.


    #2
    Are you attempting to find the closest interactible object with those blueprints? If so I can see a couple of problems
    My Game Frontier Devblog HERE

    Comment


      #3
      Originally posted by Orkney View Post
      Are you attempting to find the closest interactible object with those blueprints? If so I can see a couple of problems
      Yes indeed! I'm just not 100% sure how to set that up correctly. Any help will be much appreciated! =D

      Comment


        #4
        Originally posted by Uju Comics View Post

        Yes indeed! I'm just not 100% sure how to set that up correctly. Any help will be much appreciated! =D
        You are close with what you have, basically what you want to do is add all of the objects around the player (maybe inside a collision overlap sphere) to an array. Then in your For Loop, get the players pawn location and subtract that from the location of the array object, get the vector length of this. This vector length is the distance to that particular array object. Compare that to the current lowest distance. If it is lower, set it as the distance. Once the For Loop has completed the lowest distance is the cloest object. One sec ill make a quick demo graph.

        Click image for larger version  Name:	Graph.jpg Views:	1 Size:	225.9 KB ID:	1460750

        Key things to take away from this is vector length, if you subtract one location vector from another, the resulting vector is... the best way to think of it is if I was standing at Vector A and wanted to get to vector B, I would move that resulting vector. However we measure distance using a scalar value, whereas a location vector like here is 3 values (x,y and z), therefore if we get the length of this vector that is the distance you would travel.

        If your unsure what any of these nodes do, or what a loop is or anything dont be afraid to ask!

        This link shows the graph
        https://blueprintue.com/blueprint/_di9t104/
        Last edited by Orkney; 04-14-2018, 02:08 PM.
        My Game Frontier Devblog HERE

        Comment


          #5
          Originally posted by Orkney View Post

          You are close with what you have, basically what you want to do is add all of the objects around the player (maybe inside a collision overlap sphere) to an array. Then in your For Loop, get the players pawn location and subtract that from the location of the array object, get the vector length of this. This vector length is the distance to that particular array object. Compare that to the current lowest distance. If it is lower, set it as the distance. Once the For Loop has completed the lowest distance is the cloest object. One sec ill make a quick demo graph.

          Click image for larger version  Name:	Graph.jpg Views:	1 Size:	225.9 KB ID:	1460750

          Key things to take away from this is vector length, if you subtract one location vector from another, the resulting vector is... the best way to think of it is if I was standing at Vector A and wanted to get to vector B, I would move that resulting vector. However we measure distance using a scalar value, whereas a location vector like here is 3 values (x,y and z), therefore if we get the length of this vector that is the distance you would travel.

          If your unsure what any of these nodes do, or what a loop is or anything dont be afraid to ask!

          This link shows the graph
          https://blueprintue.com/blueprint/_di9t104/

          I setup the blueprint very similar to what you have in your sample to test it out and I get the same error. The print string does work. So I decided to reattach my function and do the print string at the end and it prints as well but with the same error. Could this mean that the root of this problem is located somewhere else in the blueprint? For example, I did a print string at the end of set interactable function and I did not see anything. Meaning it isn't highlighting in the game when I'm playing it and I'm also unable to pick up the item to store in my inventory because of that. Thanks for the information you provided because I'm very new to blueprints and I'm learning lots of new ways of doing things. I didn't know you could set it up the way you showed me. Much is appreciated! =D

          Comment


            #6
            In that case I would guess that your array is empty. When you start previewing the game press shift and f1 then go to your blueprint graph, at the top where it says 'No debug object selected' open the drop down and select the option in the list (Im not sure what this will be as I dont know where you are putting this graph logic, in the pawn?) once you have done that mouse over the interactables array and see if it has anything in it or if it is empty.
            My Game Frontier Devblog HERE

            Comment


              #7
              Originally posted by Orkney View Post
              In that case I would guess that your array is empty. When you start previewing the game press shift and f1 then go to your blueprint graph, at the top where it says 'No debug object selected' open the drop down and select the option in the list (Im not sure what this will be as I dont know where you are putting this graph logic, in the pawn?) once you have done that mouse over the interactables array and see if it has anything in it or if it is empty.
              It says current value = 0. So I do believe that this might be the cause of it. I'll need to mess around with it to see what is going wrong with it. I'll let you know. Thanks for the help!

              Comment


                #8
                Originally posted by Orkney View Post
                In that case I would guess that your array is empty. When you start previewing the game press shift and f1 then go to your blueprint graph, at the top where it says 'No debug object selected' open the drop down and select the option in the list (Im not sure what this will be as I dont know where you are putting this graph logic, in the pawn?) once you have done that mouse over the interactables array and see if it has anything in it or if it is empty.
                I couldn't figure it out. The interactables array has all the stuff in it and everything is setup correctly. I think I'm just going to have to wait until later on and pay someone to debug it for me. I really appreciate the support and tips. I learned a lot from them. Thanks!

                Comment

                Working...
                X