Announcement

Collapse
No announcement yet.

Need a way for a spawner object to pass itself to the spawned object...

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

    Need a way for a spawner object to pass itself to the spawned object...

    So first I'll need to describe what I'm trying to get to happen.

    I have a spawner object that spawns cubes in intervals that travel downward. If the cubes hit the floor then the floor gets destroyed, along with the cube, and I need to also turn off the spawner so more cubes aren't spawned.

    Click image for larger version

Name:	spawnerproblem.png
Views:	1
Size:	170.5 KB
ID:	1141818

    So what I need help with is how to reference the particular spawner that's ABOVE the floor(there will be multiple floor and spawner objects). If I can do that when either the cube collides with the floor, they can turn the spawner off. Or, before the floor is destroyed, it can tell the spawner to turn itself off.

    This is what I've tried in my ignorance :


    Click image for larger version

Name:	Putspawnerinthebox.png
Views:	1
Size:	217.9 KB
ID:	1141819

    The cube spawns inside of the spawner and travels downward, so I thought that using an end overlap with the spawner could pass a reference to itself there. But that doesn't work, it doesn't even print the hello. Yes I've checked that generate overlap is checked.

    I was also thinking that I could reference it in the floor, but I would need a way to maybe... scan for objects on the Z axis to find out which spawner belongs to which floor. I'm not sure how to do that.

    If anyone is willing to offer me any advice or possible solution I'd be very grateful.

    #2
    Hello,
    If you create an array with all your spawners and add an integer variable set with the value of the index where is registered the spawner in the array.
    If the spawned refers to the same spawner, Add this variable in spawned too when you spawn it and on event check this value with your array, you'll have your spawner.
    If spawned can lateraly move, do the same with floor instead of spawned.

    Comment


      #3
      Hmmm.... I kind of see where you're going. Where would I store the array and the variable? In the level blueprint?

      Comment


        #4
        You can set array in level before play and variables in both spawner and spawned, but as writing i realise that if your spawner is always the one which spawns the spawned, you don't need it, just create a variable "spawner blueprint" and set it with the spawner directly on spawn.

        Comment


          #5
          I don't really understand what you're trying to say. Sorry. X |

          Can anyone offer any other possible solutions please?

          Comment


            #6
            Try to do that :
            Click image for larger version

Name:	spawning.jpg
Views:	1
Size:	84.5 KB
ID:	1062084
            The type of the variable spawner is actor. Don't forget to click the eye and set tooltip or you can't see it in spawner bp.
            Last edited by Fen; 12-13-2014, 05:43 PM.

            Comment


              #7
              I finally got around to working on it, and your solution helped me very much. Thank you, Fen.

              Comment

              Working...
              X