I’m trying to create a shield pickup for my game so when main character picks up a shield, he gets protected from enemy bullets by a force field for a certain period of time (e.g 10 secs). I’ve tried many ways to do it, but none worked properly.
So below are corresponding blueprints and please let me know if you have any ideas on how to achieve that spawned Force Filed BP TRACKS player movement when he runs, turns etc.
Elements of the equation are : Shield pickup BP: When player collides with box collision around shield, it destroys shield itself and initiates a Shield Sphere Event (Custom Event)
Third person character BP: Within Third person character BP, custom event spawns actor Force Field BP that protects main character from enemy bullets. THIS IS WHERE THE FORCE FIELD BP SHOULD BE PROGRAMMED TO FOLLOW PLAYER MOVEMENT AND THEN DESTROY ITSELF AFTER 10 SECONDS!
Force field BP: Below is force field BP that is programmed to destroy enemy bullet when they collide.
So the question would be what has to be done under TPC BP so that Spawned Actor BP follow player around?? The Force Field itself works OK so basically just needs to be following the main dude.
Yes so basically I’ve tried doing that in few ways but unfortunately none really worked.
I’ve tried integrating Vinterp to as well (pls see below the screenshot) as per your suggestion but got the same results which is when player picks up the shield pickup, the force field gets spawned and stays in one place. That one really puzzles me So if you have any suggestions, please let me know.
Umm don’t know really since even if I remove Delay and Destroy, I still get the same error massage…It works perfectly though when I’m playing in editor but when the game is stopped, I get that annoying error message.
There must be a way to do that and is probably simple as per usual
What needs to happen with that error is always the same. Click on the last linkable word on the right hand end, it will take you to the node that is getting the empty value.
Or to be more specific the issue is likely a pointer going from return value pin of Spawn Actor From Class Node into target pin of Set Actor Location Node
Coming in late to this party… but ClockworkOcean is right… You are probably destroying an actor whose location you are still trying to access and you get the Null reference. Also, even if don’t destroy as you say, you’ll get that error because on the first ticks you will try to set a location to an actor THAT DOESN’T EXIST YET, because you haven’t spawned it. I would suggest doing a IsValid check on the spawned object you get out of that node. This will avoid the error at the end.
I would also suggest perhaps saving a reference to that object you spawn for good housekeeping. Maybe create a variable in your blueprint (ActiveSpawnedShild) or something like that. Populate it when you have a shield, empty it when you don’t, or just always check if it’s valid first before you do anything with it.