Hello everyone, I’m trying to implement in my project a simple skill blueprint that makes my character able to generate a sort of “shock wave”, moving away and stunning the surrounding enemies.
First of all, I’ve created a new bp class that is spawned from the character blueprint by pressing Q key. This is it:
First it generates a fire impulse, then it takes all the enemies within a sphere (that has the same radius as the radial force component). For every pawn detected, it sets the bool variable “stordito” (that means “stunned”) as true. That var is used to temporary unlink (with a branch) the “Ai move to” node from the enemy blueprint.
Now, the problem is that nothing works at all. As you can see in the following video, it seems that the impulse is ok for one single enemy, but not strong enought to move away more that an enemy in a row.
So… am I missing something? Maybe there is some error in my blueprint?
Ok you were totally right, I didn’t thought about that. But, the problem seems is to be the same as before, again.
New video after the “completed loop” fix: v=9KLzkuP6pgU
Honestly if this is supposed to be a blast of energy to move the enemy’s I’d use launch instead it’d be a little more complicated but may work better.
Inside the actor your spawning. You’d want to grab the location of the actor and the effected enemy. Hey look at rotation from actor to ai. Return that into a multiply by float. Return that into break vector and move to a make vector. Cross the X , y over and on the Z + 100 or so and go into the make vector. (Adds lift)
This goes into the launch and target is the enemy from the for each.
This will loop through all characters and push them up and away from the actor your spawning.
Because there’s something weird, as you can see (-> v=SlaQCsNhZ5c) the enemies simply jump along the z axis (actually, in the video the don’t just because i killed the z axis in the make rot).
Multiplying the launch velocity does nothing, apparently, and I also tried to multiply the single floats before the make vector.
Could that “get all actors of class” be the problem? Because I can’t plug the “Array element” of the ForEachLoop directly in the “target” of the launch.
What kinda air control do they have? They’re constantly running at you which can negate the effect. Try against done non moving enemy’s to further troubleshoot.
That “Stordito” variable should do the work; the following is the AI (at the beginning of the bp there is an Event tick): when “stordito” is true, the “simple move to” node is delayed for three seconds, so enemies don’t move during that time. Stordito is set as True in the shockwave bluprint, after the ForEachLoop (so every enemy affected should be stunned).
This is condensed and missing some things you use, but it works, i did note that the standing character blue prints collide with each but it does shoot them all away just some further then others (sorry at work hard to explain.)
You gave me an idea on what’s happening. I never tried it before, but if I unplug the entire AI block from the enemy bp, your node set up works perfectly
(by the way, thank you a lot! I don’t know why, but there was a problem in my bp, with the target of “Find look at rotation”: getting the actor location from each array element of the loop makes all enemies getting launched in the same direction).
That’s right, this is the reason why I’m using that “stordito” variable, but I realized that it is useless with the “simple move to actor”: once that the goal is set (player), the enemy will just go to his location. When he gets there, the goal is refreshed and set again as the player location.
My node set up just delays that refresh by 3 seconds, but does not stop the enemy: if he hasn’t catched up the player yet, the goal is still valid and the enemy keeps moving. This is the reason why only the nearest enemies were been moved away: they were the only ones to have reached their goal location, so they weren’t moving.
So, in summary, the shockwave works now but I need another way to temporary stun the enemies. Maybe there is something to lock the “move to actor”, or I should use another AI node that can be “stopped”.
I was thinking about something like this: I could promote as a variable the goal of the simple move to. After the ForEachLoop, instead of setting the “stordito” variable, I could change that goal with something else, like the current enemy location (so he just stands still) and, after three seconds, change it again with the player location. What do you think? Tomorrow I’ll give it a try.
I’ve tried the “goal as variable” thing and it’s ok! It works quite well (first part of the video, 3 enemies).
The problem is again when I have much more enemies surrounding the player, only a few of them are launched away (second half of the video, 12 enemies).
Could it really be the collisions between the enemies, as you suggested? maybe I could try with a “collision response to channel”
Looks like collision. The way to solve this would be to also get the length of the actor location - ai location and arrange it in an array so it goes furthest to closest.
This I’m not completely sure how to Graph in blue print. The idea is to ensure the furthest is already moving away before the closer ones are no if away so they don’t collide.