I can’t seem to find a way to spawn a blueprint, only objects. If anyone knows of any tutorials that explain this please share.
Aim : Player enters trigger of BP1, a tomato appears. You need to find one. Go pick up the tomato at another location at BP2, BP1 is destroyed. Now I want a BP3 to appear where BP1 was.
Am I even thinking of a good solution here? Perhaps I should be keeping BP1 alive and have all 3 items contained within in. I’m currently making the tomato fade in via dynamic material. So perhaps have all 3 items there each with their own dynamic material that I fade in accordingly?
use “Spawn Actor From Class” node and select your blueprint , you can use Event BeginPlay to store location of BP1 then even if it’s destroyed you will still have it location
You can store location at an Event Begin Play? Trying to find such a function but can’t.
if you create a variable vector in your character then you can “set” it with the value of your bp_1 location before destroying it. Then you use this position to spawn your bp3 when you want to spawn it.
Trying this tutorial but it seems that you can’t spawn actor from blueprint anymore? This guy is able to create a target point, a visual target that you physically place in the scene and can then refer to. Seems great but can’t even get that to work. He simply drags it from the outliner into his blueprint event graph and it just shows. Mine doesn’t.
As for Fen’s solution, have created the vector variable in character_bp. I set it to the value of BP_1 location (manually, couldn’t figure out how to input it from a node, if that was the idea?). I’ve just set it in character bp, so it sets at the start of the game. I tried doing it in item_A before destroying it by pulling a node from the “spawn transform” but it couldn’t find anything. If I add my BP2 into the class rolldown it gives me a blue socket called instigator but I can’t find anything when pulling a node from it.
Based on the other thread : You create a variable “startLocation” in “bp_me”. When you "cast to " bp_me in your bp_speech then you use this cast to drag a “set StartLocation” and use a "get world location to set it.
Like this? So now, if I GET ‘start location’ variable it will refer to the location of this speech blueprint?
Yes and automatically, each time you will have this event , the variable will be updated.
This is from item_A where I’m trying to spawn speech_B at my StartLocation.
Spawn actor speech_b (not sure why it’s added a _C at the end). I’ve tried dragging off all nodes to find my start location variable and to hook my characterREF/BP_Character etc to it. As I mentioned before, the tutorials seem to be showing a different spawn actor node that I can’t find (spawn actor from blueprint).
“C” means class
drag StartLocation on Location
I dragged from scale from location node on transform but it wouldn’t find start location. So, I made a GET start location in my character BP, copied and pasted into this blueprint. But I get an error saying it can’t find it. Normally I would make sure that it’s casting to character but getting a wire from either blue nodes (Instigator or return value) do not find my character ref.
Tried this too but with no luck.
So close to closing off the core mechanic of my game now, have set up item/speech_A but getting Item/speech_B to appear is quite a dilemma! Once I figure it out I can just apply what I’ve done to the rest of the speech/items.
In character BP have added variables for item_B, start Location and Speech_B
In going through Speech A it’s setting up my start location for my other speeches, telling it that it’s location is the same as speech A.
When I pick up Item_A it will spawn speech B at location -140,0,60. I couldn’t find a way to hook it to ‘start location’, I’m fine with just manually putting in the numbers. This location will not change. If anyone does know how to connect it then I’ll update it.
When I pass through the trigger for Speech_B it will SET speech_B in character_BP as well as Ítem_B_Initated (a rule that tells the program that the player has triggered this.)
Should work right? However, when I pickup (destroy) item_A and come back to the start location, speech_B does not appear.
Getting closer Forget everything I have posted before this.
I stripped it to absolute basics as you can see in the first graph. All I had was a trigger that once stepped in spawned another BP at 0,0,0 and it worked!
So as I get a better sense of this I’ve been able to tidy up this aspect of my game. It doesn’t work as I want, it now seems to load my old blueprint. But that’s something!
So in my 2nd graph,all I’m doing is setting a location when I enter a trigger volume (which is where ‘speechA’ blueprint is currently located) - I can’t see anything wrong here at all.
My third graph is for when I press the F key. I have a sequence, first it adds data to my HUD. secondly I am expecting it to spawn ‘SpeechB’ blueprint at the location of ‘SpeechA’. Then finally it destroys the item I just picked up. I should be able to go back to Speech A and find it replaced with Speech B but it’s still Speech A.
You forgot the “get player character” as source of your “cast to” bp_me.
Of course, that makes sense. That made it work, sort of, not how I was expecting. When I pick up the item I see it spawn speechB at the correct location which is great but it fades in/out and then I can’t activate it again. Yet check this graph for speechB, it should only fade in/out if I go within the volume trigger (which I’m not) so why would it fade in/out? I just want to activate it as invisible and only activates if I go inside the trigger volume. I’ve tried creating an event begin play linked to a node that hides it but no such luck.
Maybe your timeline is activated because your blueprint is overlapped by somthing. On your overlap events, try to cast to “bp-me” from other actor node.
Yep, that’s it! Works now (almost), it faded in straight away so added an event begin play so it automatically sets opacity to 0 for default. Only thing now, and this is blowing my mind, is that the speechB blueprint seems to spawn at a 90 degree rotation! No idea what could be doing that? All I told it was to spawn in the same location as speechA. They both use the same FBX mesh. In components, they both have the same transforms, rotations and scales.
from your “start location”, “Break transform”, “break rotation”, “+ 90 (-90)” to “Z rotation”, “make rotation”,“make transform” with this new rotation, " spawn speech_b"
Wow, seems like a lot of instructions just to rotate an object but it works so a huge huge HUGE thanks as that closes the door on spawning for now. I think that I have what I need and am sure I’ll be able to reproduce the rest on my own. I am curious, do extra instructions really impact the stability of a game in terms of how smoothly it runs? or is this so minor that in a little demo type scenario it won’t be much of an impact, if at all?