Tactical, Surround task acts like an ordinary attack

leslviv

New member
Hi, we're trying to make the Tactical Pack to work in our project, specifically the Surround feature, but it acts like an ordinary attack.

Demo Tactical scene works:

So we have moved the AI with Surround task from the demo scene to ours and it doesn't act as it should.

Demonstration video

Any ideas how to make it work? Thanks

P.S. I have used my Behavior Designer invoice to create this account on this forum, but I would like my software engineer to be able to communicate here as well. I have shared my separate add-on invoice with him, but the registration was denied, invoice not found, even though it's 100% correct. It looks like you don't accept invoices from add-ons. How do I add a collaborator?
 

Justin

Administrator
Staff member
What do the settings for your surround task look like? Are you setting the leader to one of the agents from all of the other agents?

P.S. I have used my Behavior Designer invoice to create this account on this forum, but I would like my software engineer to be able to communicate here as well. I have shared my separate add-on invoice with him, but the registration was denied, invoice not found, even though it's 100% correct. It looks like you don't accept invoices from add-ons. How do I add a collaborator?
Behavior Designer is licensed per seat so each developer should have their own invoice.
 

leslviv

New member
What do the settings for your surround task look like? Are you setting the leader to one of the agents from all of the other agents?


Behavior Designer is licensed per seat so each developer should have their own invoice.
No leader, just like in your demo
 

Attachments

  • IMG_20210120_074521_814.jpg
    IMG_20210120_074521_814.jpg
    83.1 KB · Views: 7

Justin

Administrator
Staff member
Thank you, though it doesn't look like there are line numbers so I can't tell what is causing the null reference. Did you do a build? Can you enable line numbers?
 

leslviv

New member
Thank you, though it doesn't look like there are line numbers so I can't tell what is causing the null reference. Did you do a build? Can you enable line numbers?
Not sure what you mean by enable line numbers.
 

Attachments

  • IMG_20210126_211106_322.jpg
    IMG_20210126_211106_322.jpg
    57.4 KB · Views: 5
  • IMG_20210126_211108_609.jpg
    IMG_20210126_211108_609.jpg
    48.7 KB · Views: 5

Justin

Administrator
Staff member
That looks better. Line 70 of surround points to:

Code:
                tacticalAgent.SetDestination(destination);

So tacticalAgent is null. tacticalAgent will be null if the agent hasn't been added to a formation yet. I can't see anything wrong with your setup but can you try just having the singular surround task in your behavior tree and nothing else? This will allow it to look exactly like the demo scene to get started.
 

leslviv

New member
That looks better. Line 70 of surround points to:

Code:
                tacticalAgent.SetDestination(destination);

So tacticalAgent is null. tacticalAgent will be null if the agent hasn't been added to a formation yet. I can't see anything wrong with your setup but can you try just having the singular surround task in your behavior tree and nothing else? This will allow it to look exactly like the demo scene to get started.

Zombie simple leader.png

Zombie simple.png
Zombie simple rezult.png
 

Justin

Administrator
Staff member
I would try slowly building up your tree to see what causes the error. For example, start with just having a Sequence -> Wait -> Surround task. Does that work? If it does add the Parallel task and continue from there.

If you want to breakpoint debug it you can place a breakpoint within NavMeshTacticalGroup.AddAgentToGroup. This is what creates the Tactical Agent.
 

leslviv

New member
I would try slowly building up your tree to see what causes the error. For example, start with just having a Sequence -> Wait -> Surround task. Does that work? If it does add the Parallel task and continue from there.

If you want to breakpoint debug it you can place a breakpoint within NavMeshTacticalGroup.AddAgentToGroup. This is what creates the Tactical Agent.
Hello, we investigated this issue and found next:
Looks like that "AddAgentToGroup" method is not called, when we place them as childs of parallel/sequence task, maybe it is source of our errors. But everything works fine, when we disable our AI and set them active during play mode. Do you know what may cause this?
 

Justin

Administrator
Staff member
As a test I just placed the task underneath a parallel task and it still worked. AddAgentToGroup should be called when the agent starts - are you able to set a breakpoint earlier to see why it isn't?
 

leslviv

New member
As a test I just placed the task underneath a parallel task and it still worked. AddAgentToGroup should be called when the agent starts - are you able to set a breakpoint earlier to see why it isn't?
Hi Justin. I'm sorry, but we don't quite understand and this whole process is taking too long. We have created a little project for 2019.4.19f1 Unity Editor. Would you be so kind to please take a look and let us know what is wrong and how to fix it?

-snip-

Scene name - AI Testing.
Look into TreeMobs and the Complex Zombies:

1. When you have only Zombie Complex Leader enabled and start the scene - zombie works.
2. When you have both Zombie Complex Leader & Zombie Complex enabled and start the scene - it doesn't work and you get errors.
3. If you have both Complex Zombies disabled, start the scene and enable both during play mode - it works.


Thank you very much.
 
Last edited by a moderator:

Justin

Administrator
Staff member
Please do not link to a project which contains Behavior Designer as not everyone who reads this forum has a license to it. If you want to send a project you can send it to me via PM (or not include BD as I already have a copy of it :) )

I am currently traveling so am not able to take a look at it right now but I can when I get back. I have the project so have edited your post.
 

Justin

Administrator
Staff member
I got a chance to look at your project. The problem stems from the follower activating before the leader so the leader doesn't issue the callbacks correctly. You'll want to make sure the leader is enabled before the follower, or have the follower be their own leader until the leader is ready. I will have the task more gracefully handle this situation by returning failure.
 

leslviv

New member
I got a chance to look at your project. The problem stems from the follower activating before the leader so the leader doesn't issue the callbacks correctly. You'll want to make sure the leader is enabled before the follower, or have the follower be their own leader until the leader is ready. I will have the task more gracefully handle this situation by returning failure.
Ok. We set followers to get activated with 0.1 sec delay and it works, but we get a problem when leader dies. Followers stop, or just take surrounding position 1st and then stop and do nothing, if leader was disabled suddenly.

We can try your 2nd proposed solution, but we don't know how to do it:
"or have the follower be their own leader until the leader is ready".
Is there a specific task for this? How are they going to surround without one specific leader?
Couldn't find anything in 4 page manual.

I think we need a way to pass leadership to another unit in case leader is not active yet or anymore, or via script.

I imagine we need something like this:
Zombie 1 is a leader for the whole group as long as it remains active. When leader gets disabled - zombie 2 becomes leader for the whole group. When zombie 2 gets disabled - zombie 3 becomes leader for the whole group. And a way to pass or not to pass leadership back to zombie 1 if it gets enabled again.
Is it possible to make it this way?

Also, I didn't get your last sentence. What do you mean by: "I will have the task more gracefully handle this situation by returning failure."

Thank you.
 
Top