Announcement

Collapse
No announcement yet.

Blueprint Question

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

    Blueprint Question

    I am trying to make a game that spawns obstacles every second, but cannot figure out why it isn't working. Here is what I have so far, its basically supposed to spawn a new object called 'test' every tick, and add it into my array 'obstacles'. What am I doing wrong?




    Thanks!
    Attached Files
    My Portfolio: https://www.artstation.com/artist/sargentcrunch

    #2
    What you have just done is add the mesh to be instanced. You now need to Add Instance with your instance variable as input.
    Map Generator 1.0
    Map Generator 2.0
    Map Generator 3.0

    Comment


      #3
      More to above you are looping through array which would contain object allready created. Are you creating them? If array is not initialized it does nothing.
      And as Zeustiak written you need to use actual spawn function.

      Comment


        #4
        I think you need this.


        You can see more info in the documentation page.
        https://docs.unrealengine.com/latest...nts/index.html

        If you having trouble, check this video, which spawn toycow on keypress.
        Last edited by starseeker; 10-18-2014, 03:11 AM.
        Check my working title: The Locked Room here: https://forums.unrealengine.com/show...he-locked-Room

        Comment


          #5
          Originally posted by starseeker View Post
          I think you need this.


          You can see more info in the documentation page.
          https://docs.unrealengine.com/latest...nts/index.html

          If you having trouble, check this video, which spawn toycow on keypress.
          Spawn actor is going to be more resource intensive than Add Instance. Of course, adding instances on an Event Tick is probably going to end in disaster unless they are quickly removed.
          Map Generator 1.0
          Map Generator 2.0
          Map Generator 3.0

          Comment


            #6
            Oh, now I notice something about the graph! Hi you need to set a Delay timer, not set deltatime. The set Deltatime did nothing actually. Thats not how t use it.

            What you have it will try to create an instance every tick, not every sec!


            After looking at a tutorial, I think Add StaticMeshComponent work as well, as long as its a staticMeshComponent (Obviously).

            In any case, try add a timer, creating a object every tick will crush the program, or some very bad slowdown. Maybe that's the problem. Also you should have a limit on array size.

            Also I think for 'For each' loop to work, the array must be at first filled with values.

            If the array have a size of Zero, then I think it will not run the next execution, which may explain why it it not work.

            Try instead using add & put this in last step of the node. (see the screenshot from Tom Looman Tutorial)





            My suggestion to you is to do it step by step. Start simple. At first make sure you can spawn an object by a key press, Then make sure it can be stored in an array, slowly moving into the final solution you wanted.
            Last edited by starseeker; 10-18-2014, 06:14 AM.
            Check my working title: The Locked Room here: https://forums.unrealengine.com/show...he-locked-Room

            Comment


              #7
              Hey guys thanks for the help! You helped me find my mistakes and now I got the map randomly generating, now I just need to learn how to do dynamic arrays in blueprints :P Is this possible?
              My Portfolio: https://www.artstation.com/artist/sargentcrunch

              Comment

              Working...
              X