I have targets in my world and i am spawning actor from class to those targets randomly. Inside the blueprint im spawning there is a click event that destroys the actor when clicked. And that all works fine. What im trying to do is when the actor is destroyed it will reset the randomizing system to spawn a new actor this system is in the level bp. Ive tried interfaces,event dispatchers none of them seem to be working. Does anyone how i can get this working?
i called the dispatcher in the actor blueprint before the destroy. And then the event inside the level blueprint. And the event was connected to the top pin of the multigate but its not in this screenshot.
Sorry didn’t mean that how it sounded just meant for this type of thing you really need to be using arrays , loops and functions etc but it’s a good attempt. Can you post full screenshots of what you’re trying to do and like I said I’ll post up later thanks
Sorry the way i typed that kind of sounded rude, i didn’t mean it like that. those two screenshots are all i have and its all working just cannot get it to spawn a new one right away when one is destroyed.
The problem im having this the dispatchers working is you need to have the bp selected in the level to get it to appear in the level blueprint. (unless im missing something about dispatchers) and the actor is not in the level until it is spawned by the spawnactor from class. So how do i get reference to the actor that is not yet spawned?
Ok, for some reason i always do things the hard. I took your advice and changed the setup to an array setup. But im still having issues trying to get reference for the dispatcher. This is the bit im stuck on still. Ill post a screenshot of my new setup.
Ok so now just put this into a event or function call it spawnBubble or something. Place this event somewhere where you can call it for example in my case as my actor I’m destroying is a character I put mine inside the player controller if , or you can use player state game instance etc
Then all you do is in the input and on touch screenshot you posted above cast to wherever you have this spawnBubble event /function and call it THEN destroy the actor . So basically it will call the function spawn a new actor and destroy the old one . Sorry can’t post pictures .
Try and give it a go and let me know how you get on
Instead of using an array of target actors , make the array an array of transforms that match the target actors position eg in the array you call it targetPos1 then set the X, y, ,z values to be the same as the target actor. It will take a bit of time to fill out at first as you have 23 but once it’s done it’s a much more flexible and editable system if you wanna add a new bubble spawn point you simpley add another transform to the array etc
Unfortunately the level blueprint is not a very good place to work with things as you cannot cast to it or access it from other blueprints.
This will work, another option though would be to use ‘get all actors of class’ node at the beginning of the level / game, in your controller / whatever blueprint you want these. Filter by the TargetActor class and that gives you an array of all the target actors in the map. If you dont want every target actor, or that doesn’t work, just make a new blank actor blueprint that you can use as a spawn location, and use get all actors to get an array of those to use for your spawning. That way you can continue to add as many spawn points as you like without having to manually enter in the location each time.