Announcement

Collapse
No announcement yet.

Spawning Blueprints via another Blueprint Constructors Script

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

    Spawning Blueprints via another Blueprint Constructors Script

    Hi all,

    This evening I set to do something I expected to be very simple. However, after a couple of hours of digging I've no idea if this is even possible.

    The idea is pretty straight forward:

    1) Create a Blueprint called CaveSection - This blueprint consists of 2 items, a static mesh and an vector3d array called joints.
    2) Create Child Blueprints of this class, where I setup lighting and other items within the cave section and I set the joint locations.
    3) Create a Cave Blueprint - This has 2 variables also, Int NumberofSections and Array of references to the blueprints (At the moment this is set as an array of Class CaveSection)
    4) Cave Blueprint Constructor script randomly pics a CaveSection and spawns it at a free joint section of a previous section. (Logic here will be much more involved but I'm keeping it simple here)

    The issue Is I have no idea how to make the Cave Blueprint Construction script execute that logic.

    Any thoughts?

    Thanks

    Swifty

    p.s. Done loads of googling a forum searchs and not come up with anything particularly useful (maybe im googling the wrong question)

    #2
    Hi Sw1fty,

    The node you are specifically looking for is "Spawn Actor of Class", with the class type being your other blueprint. This will spawn copies of your other blueprint based on the parameters you give it, so if you set the location, rotation, scale, etc within your Cave Blueprint and spawn these through for or foreachloops.
    Adam Davis | Marketplace Support | Epic Games
    How to report a bug? | Installation & Setup issues? | Answerhub Bug Reports | Twitter

    Comment


      #3
      Thanks for the responce Adam.

      I guess there's a bug then, because 4.7 doesn't allow "Spawn Actor of Class" in a construction script.

      As a work around I've decided to manual setup the cave enterance in the Cave blueprint and then dynamically create a cave. This is going to be a cool little system.

      Thanks agian
      Last edited by Sw1fty; 05-06-2015, 05:57 PM.

      Comment


        #4
        Hello guys, so if I use 'Block' BPs event graph and spawn another actor, is the new actor a child of 'Block'? And if so, what does this mean for how things will work within the BP and new actor?
        Marketplace Assets

        Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
        Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
        Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

        Comment


          #5
          Hi,

          I guess there's a bug then, because 4.7 doesn't allow "Spawn Actor of Class" in a construction script.
          Im using "Add Child Component" (see link below).
          That seems to work very well in terms of blueprint creation (FassadeColumn), but fails to work for setting its variables when spawned by a FassadeRow BP...

          @ Adam Davis
          Im doing basically the same thing. Creating Blueprints from Blueprints.
          But I cant seem to be able to access/set set variables of those child components..
          Maybe you can give me a quick pointer??

          Problem description: https://forums.unrealengine.com/show...nt-s-variables

          Thanks,
          Klaus

          Comment


            #6
            The way I do it is to have a custom event within the blueprint that essentially replicates what you would have on the child blueprints construction script and then simply spawn the child actor and cast to your "blueprintSetup" event on it and feed across any variables that you want.

            Comment


              #7
              The way I do it is to have a custom event within the blueprint
              But that would only fire during play, or not?
              So during design-time, in the viewports, you would not see any changes, unless you hit "play"....
              Or am I wrong?

              Comment


                #8
                I use blutility functionality when I want it to appear in the viewport. Only downside to this method is that when you move the actor around then it resets to it's original construction script state. I was hoping to find a way to stop the constuction re-running every time you move an object, which is why I originally turned to a blutility, so currently it works but isn't ideal

                Comment


                  #9
                  I use blutility functionality when I want it to appear in the viewport
                  Ah ok. I try to cretae a fully self contained solution without the needs for level scripts, runtime events or editor extensions (Bluetilities).
                  I try to design my assets as if they were for the dumbest level designer ever

                  Comment


                    #10
                    Hi so I got the Cave generator working at run time with EventBeginPlay.
                    However, I have been unable to get it working in the editor (I'd like it in the editor to make tweaks in build lightmaps)

                    When I run a custom event in editor that executes the BuildCave Function the collision detection does not seem to fire.

                    Do collision events only work at run time? Is there anyway to force them to work in the editor for a short while?

                    Click image for larger version

Name:	HighresScreenshot00003.png
Views:	1
Size:	872.6 KB
ID:	1076027

                    Here is the main function "TrySpawnSection"

                    Click image for larger version

Name:	MainFunctionTrySpawnSection.png
Views:	1
Size:	294.4 KB
ID:	1076031

                    Thanks all
                    Last edited by Sw1fty; 05-09-2015, 01:07 PM.

                    Comment

                    Working...
                    X