News › Forums › RAIN › General Discussion and Troubleshooting › Wander Follow and Attack Behavior
This topic contains 15 replies, has 2 voices, and was last updated by prime 1 month, 4 weeks ago.
April 22, 2022 at 7:10 pm #37677
Hi there I have been working on a behavior, modifying the wander and flee behavior to follow, and then attack when close instead of flee.
I have gotten the follow working correctly, but not yet the attack. Anyone able to take a look and see why my behavior isn’t attacking? Much appreciated!
Link to the behavior
April 24, 2022 at 8:24 am #37695
- This topic was modified 2 months, 2 weeks ago by jbarrett98121.
What is the constraint condition for Near?April 24, 2022 at 10:25 am #37700
isNear declared at the topApril 24, 2022 at 1:10 pm #37702
Do you mean to have a parallel in that constraint? You are triggering two mecanim params simultaneously while moving?April 28, 2022 at 1:44 pm #37760
Is that my issue? I’m trying to take an attack from an example and combine it with a wander behavior. It’s still a little confusing.
I’m trying to move the ai to the player (which works), but when it is within range of the player, play an attack animation (set a mechanim state) and apply some damage, which i have not put in yet.April 29, 2022 at 6:52 am #37769
Those are things you probably want to do in sequence, not in parallel.
— MecParam (trigger attack animation)
— Custom Action (apply damage)April 29, 2022 at 2:16 pm #37780
get rid of the parallel?April 30, 2022 at 3:16 pm #37792
ok so I got the ai attacking the character. Almost there, but it attacks in an infinite loop…. and then once it attacks it never goes back to wandering or following if the player is out of range. How can I go about fixing that. I did set the attack parameter to false after attacking and waiting.25 seconds… but it still seems to infinitely attack. Here’s a shot :April 30, 2022 at 5:13 pm #37793
ok so I had the constant chasing set to loop forever. I set it to once, and he does only attack once and will continue following after he has attacked.
It acts very strange though, the ai will run right up to the player and keep running at him, and not attack, but will attack once after the player has moved away (and also runs in odd circles)
I’m not sure where the strange behavior is coming fromMay 1, 2022 at 9:30 am #37795
Thanks all for the help btw. Just about have this working the way it should. Boar (ai) doesn’t stop and attack though, he keeps chasing the player, and every once in a while randomly attacks (while spinning in a circle oddly)May 4, 2022 at 2:08 pm #37819
anyone?May 5, 2022 at 8:02 am #37832
Unclear what the problem is, but the BT doesn’t make sense to me. Once the Follow sequencer hits you should eventually get into the (chasing == false) constraint that loops forever. Once you are in there, you will never get back out again. The (evilperson == null) constraint that comes after it will never occur.
Does the “face for attack” node have a move target? Or just a facing target?May 8, 2022 at 8:12 pm #37880
(chasing == false) only loops until it is successful . Should it never loop?
I am really unsure about how to do this behavior, and am really just looking for some pointers on how to get there. Complete rain noob.
The face for attack node is actually just setting a mechanim parameter of attack to true.
I just took the wander and flee exaple and wanted to add following instea dof fleeing, which works.. and attacking a target and stopping following if the ai is in range of his target…… if the target is lost or out of range go back to wandering.
That’s what I am trying to achieve, any pointers in the right direction of that would be much appreciated.May 12, 2022 at 6:51 am #37907
The screenshot shows a yellow loop, which indicates loop forever (green is until success and red is until failure.)
There’s an example of exactly what you want to do inside the Starter Kit:
http://rivaltheory.com/community/tutorials/May 12, 2022 at 3:48 pm #37917
well almost, max follows waypoints and the ai behavior i’m using doesn’t. It’s a little different, so I do not know where to grab the attack behavior and where to place it in my own.
You must be logged in to reply to this topic.