Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Created some spawners for my enemy actors so that I could place the enemies in their correct locations in editor but spawn them at a later time using triggers. But they only function properly when I trigger them on level load.

--The Problem I am having.--

So I have several classes that I am working with. A parent class that powers the functionality of the actor being spawned and which all child classes will be derived from. So far I have only one child class which is the actor that is being spawned. A class that consists of an open spline. Another class that consists of a spline but this one is closed loop. And finally a class that I use as the spawner.

The way it is supposed to work is that the child is supposed to spawn and follow the open spline, when it gets to the end of that spline it should become tied to the closed loop spline and stay on that for the rest of the game or until it is destroyed. It works perfectly when the child spawns on "Begin Play" but as soon as I try to spawn it at a later time with a trigger it screws up.

From what I observe it completely skips over the open spline and spawns at the closed loop spline, and even worse when I tie spawner to just the close loop spline, totally bypassing the open spline, is sets the child actor location to 0,0,0 and just stays there.

--Screenshots of my event graphs and Default menus.--

Spawner Event Graph

alt text

Spawner Defaults Menu

alt text

Parent Class Event Graph

alt text

Open Spline Defualts Menu

alt text

Level Blueprint

alt text

--How my actors work--

The way it is set up is that the spawner is just an actor with a billboard component that I can place in world with the editor. It has some variables that I exposed on spawn. The two main ones being 1.) An actor class variable so I can set it to whatever class of enemy I want to spawn in the defaults menu. And 2.) An actor reference so that I can select the spline to tie my child actor to. The spawner has everything tied to "Event Begin Play" but uses a bool to prevent it from triggering the spawn actor node so that I can choose whether or not to spawn at the beginning or later. If I spawn later I set the bool to false so it does nothing on level load and waits for a custom event that is also plugged into the "spawn actor from class" node that I can then trigger from the level blueprint.

When it spawns the child actor the spawner takes the return value and casts to the parent class passing all the variables that the spawner was given from the default menu to the parent.

The parent has all the functionality to make the child follow the spline that you would expect, using nodes such as "get location/rotation at distance along spline" and whatnot.

The open spline class itself only has the spline component and an actor reference that is exposed on spawn so that I can point to which actor is the next spline to use.

The way this works is that in the parent class it moves the child along the open spline using the event tick as well as the actor reference (of the open spline actor) given to it by the spawner, once it reaches the end (by checking if the spline distance is greater than or equal to the length of the spline) it goes through a branch that is powered by bool "HasIncoming?" which I set in the defaults of the spawner and is sent to the parent class on spawn of child actor. If false (meaning the child is currently on a closed loop spline) it sets spline distance back to zero, if true (meaning child is currently on an open spline and will need to change spline actor references once it reaches the end) it casts to the open spline class, gets the actor reference to the closed loop spline from the open spline actor and sets the actor reference in the parent class to that closed loop spline....and then sets the spline distance to zero.

At least this is what it's supposed to be doing. Somehow the variables are getting mixed around on spawn. I know they exist somewhere in the aether because when it malfunctions the child ties itself to the closed loop spline so it knows its supposed to end up there but it shouldn't be spawning there when I have "Has Incoming?" set to true and tied it to the open spline.

The way I am testing the delayed spawn is just to get a reference to the spawner in the level blueprint then trigger the custom event that calls the spawn actor from class node in the spawner event graph. And I call that with the level blueprint's event begin play node plus a few second delay between them.

Product Version: UE 4.13
spawnerdefault.jpg (169.5 kB)
spawnerbp.jpg (304.9 kB)
parentbp.jpg (576.0 kB)
incomingdefault.jpg (235.2 kB)
levelbp.jpg (111.3 kB)
more ▼

asked Dec 31 '16 at 01:10 PM in Blueprint Scripting

avatar image

21 3 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question