Jump to content

Recommended Posts

Hi,

 

I thought i'd try asking this question over in this part of the forums as i've had no luck elsewhere. I'm trying to work out how to get AI units to stay where i have placed them in the Eden Editor? At the moment, every time i launch my scenario, the AI units move from their positions, presumably to try and stay in formation? Is there anyway to disable this behaviour, or command the units to stay at the locations i have placed them? Where they are moving around freely at the moment is making it very difficult to set up my scenario in a way that i am happy with...

 

Any help would be immensely appreciated!

 

Regards.

Share this post


Link to post
Share on other sites

Init field of the unit:

this disableAI "PATH";

will keep them in place.

If you want them to move again simply replace disableAI with enableAI.

 

Cheers

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi Grumpy Old Man,

 

Thank you very much for your reply. Your tip worked well, in a small experiment that i ran i found that the units will now stay in place instead of attempting to move into formation. I had noticed however, that the orientation of the individual units is not as i placed them in the editor - a couple of figures are facing in the opposite direction for example. Would you have any advice on how to correct this?

 

Also, a more general question, but how will the disable command affect wider AI behaviour? Will units still engage targets or more to cover when under fire, for example?

 

Thanks once again!

Share this post


Link to post
Share on other sites
10 minutes ago, -UNiOnJaCk- said:

Hi Grumpy Old Man,

 

Thank you very much for your reply. Your tip worked well, in a small experiment that i ran i found that the units will now stay in place instead of attempting to move into formation. I had noticed however, that the orientation of the individual units is not as i placed them in the editor - a couple of figures are facing in the opposite direction for example. Would you have any advice on how to correct this?

 

Also, a more general question, but how will the disable command affect wider AI behaviour? Will units still engage targets or more to cover when under fire, for example?

 

Thanks once again!

 

The units will still behave as regular ones, except that they won't move around, they can still turn around as you noticed, heh.

They will also still engage targets as expected and adjust stance accordingly.

Check out the wiki for additional functionality of the disableAI command.

 

To make a unit watch a certain direction use this in the units init field:

this dowatch (this getrelpos [150,180]);//will make unit watch south
this dowatch (this getrelpos [150,270]);//will make unit watch west

 

Cheers

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Hey Grumpy Old Man question for you. The inability to have the AI not automatically going into formation when place down in the editor should have been an update years ago. Like you said using the 

 

this disableAI "PATH"; will prevent the AI moving back in formation once the mission starts. So if I have a group of 4 man in a building do I just put it in the group init. Just the leader or every unit init.

 

Now if i want my for Man Group to move again out of the building following its next Waypoint once a blufor unit enters into the building can I place a trigger with the  enableAI "path"; 

 

Would it look like this [unit_1,unit_2,unit_3,unit_4] enableAI "path"; in a trigger activation box

 

Share this post


Link to post
Share on other sites
On 28.8.2017 at 2:53 PM, Grumpy Old Man said:

disableAI

 

What's wrong with a good old "doStop _x" (or "commandStop _x" for the bossy)?

Genuine question, since I'm really not sure what's the (practical) difference. Would a stopped unit still move under certain circumstances, whereas a path disabled one wouldn't?

Share this post


Link to post
Share on other sites
6 hours ago, avibird 1 said:

Hey Grumpy Old Man question for you. The inability to have the AI not automatically going into formation when place down in the editor should have been an update years ago. Like you said using the 

 

this disableAI "PATH"; will prevent the AI moving back in formation once the mission starts. So if I have a group of 4 man in a building do I just put it in the group init. Just the leader or every unit init.

 

Now if i want my for Man Group to move again out of the building following its next Waypoint once a blufor unit enters into the building can I place a trigger with the  enableAI "path"; 

 

Would it look like this [unit_1,unit_2,unit_3,unit_4] enableAI "path"; in a trigger activation box

 

 

Not entirely true, disableAI "PATH" prevents AI from moving, while still being able to freely turn around.

The reason for it not being default probably is that in most cases you want groups to act and move as groups, so it would be counter intuitive to have every unit stay on its position without further ado.

Your snippet doesn't work because disableAI/enableAI require object as first parameter, so a forEach loop or apply would do fine.

[unit_1,unit_2,unit_3,unit_4] enableAI "path"; //array won't be accepted

_units = [unit_1,unit_2,unit_3,unit_4];

_units apply {_x enableAI "PATH"};//will work
{_x enableAI "PATH"} forEach _units;//will work

 

 

 

5 hours ago, rübe said:

 

What's wrong with a good old "doStop _x" (or "commandStop _x" for the bossy)?

Genuine question, since I'm really not sure what's the (practical) difference. Would a stopped unit still move under certain circumstances, whereas a path disabled one wouldn't?

 

That's right, units with path disabled will remain stationary while still being able to turn, no matter the threat, whereas doStop will make the unit stay out of its own groups formation, with the ability to still head to cover etc.

At least that's how it always worked out when I was messing with it, might not be the case any longer, so a quick test could well be worth it.

 

Cheers

Share this post


Link to post
Share on other sites

@Grumpy Old Man, rube, fn_Quiksilver thank you guys for providing information on this forms for guys like me ? with that said how would one use the  

 

"doStop _x" (or "commandStop _x" for the bossy). What is the right syntax and where does it go in the group's leader or every unit init. 

 

I think using a combination of the two would definitely achieve what I'm aiming for. 

Share this post


Link to post
Share on other sites
4 minutes ago, avibird 1 said:

@Grumpy Old Man, rube, fn_Quiksilver thank you guys for providing information on this forms for guys like me ? with that said how would one use the  

 

"doStop _x" (or "commandStop _x" for the bossy). What is the right syntax and where does it go in the group's leader or every unit init. 

 

I think using a combination of the two would definitely achieve what I'm aiming for. 

Depends. When do you want them to be able to move again?

 

Cheers

  • Thanks 1

Share this post


Link to post
Share on other sites

I have a few  2 large buildings  with a few groups of units through the buildings. I have them in place now using the disableAI "PATH";   and I am trying to use the other code doStop _x" (or "commandStop _x" for the bossy). 

For a few other groups.

 

What I have in mind is to enable few groups to move again once the blufor units enter the building using a trigger. But I am a little lost on this how to enable them using a trigger ?

Share this post


Link to post
Share on other sites
1 hour ago, avibird 1 said:

But I am a little lost on this how to enable them using a trigger ?

 

If you've disabled AI then just enable it again: _soldier enableAI "PATH";

And if you've just stopped them, issue an: _soldier doFollow (leader _soldier); (or commandFollow - for the bossy ;)

 

Either store the affected units first in some global array, or make use of thisList of a trigger maybe.

 

  • Thanks 1

Share this post


Link to post
Share on other sites

@rübe

I understand but still can't get the  syntax correct in a trigger. 

 

For example I have a group of three units u1 u2 and u3. I have them placed on a second floor building all in different rooms. I put  this disableAI "PATH"; in each unit init. And the units are out of formation and they will stay in the rooms. Grumpy old man was kind enough to help me with the syntax to get it enabled again using this in a trigger. I have not attempted it yet.

 

_units = [unit_1,unit_2,unit_3,unit_4]; _units apply {_x enableAI "PATH"};//will work {_x enableAI "PATH"} forEach _units;//will work

 

 

 

I attempted to use your suggestion above "doStop _x" (or "commandStop _x" for the bossy)  once I'm able to get it to work how would I reverse it using a trigger.

Share this post


Link to post
Share on other sites

@avibird 1

try something like this to reactivate them:

{ _x doFollow (leader _x); } forEach [u1, u2, u3, u4];

after having initially:

doStop this;

them (assuming you put this individually into the init line of the units, alternatively iterate over them with forEach).

Now, I'm not quite sure since I never use the editor's init line, but you might have to wrap this stuff up in a spawn block, as in:

[] spawn { <put code here> };

Make sure you only refer to _unit where it's (locally) defined, or create a global variable instead. Anyways, if you got this working with disabling/reenabling pathing, then you can just replace the enable with the doFollow, and the disable with the doStop part. Or use the command variants, if you like.

Share this post


Link to post
Share on other sites

hey Grumpy Old Man, rube and fn_Quiksilver works out great for me now. Using A combination of both of the STOP  COMMANDS really makes CQC very interesting using triggers to switch some of the units to move again. Now when my blufor units go into the buildings to clear they are meet with some units going through the buildings to meet them and some of the units stay stationary providing choke points.  Thank you guys for the help Avibird!!!

Share this post


Link to post
Share on other sites
On 21.2.2018 at 5:33 AM, Grumpy Old Man said:

so a quick test could well be worth it.

 

Yep, disabling pathing keeps em nicely in place, but they rotate and engage just fine. While doStop keeps them in place only for as long as combatMode (I think) doesn't raise to yellow or red (something like that). Once they're aware of some danger, a dead buddy or something, they'll engange, which is they'll start to move. All without an extra trigger, so a doFollow is only necessary if nothing happened, yet you still want them to move freely again, well, not so free, because it's back to formation then.

 

So that's all fine. Question is if we can further fine tune the engagement of units. Do they engange on their own? Or do they engage due to the leader telling them? And if so, can we disable the leader from issuing engage orders, s.t. units would only ever move if personally threatened or something? Might be worth a shot.

 

Anyways, if in doubt and you need that officer in place there at his desk, disable pathing it is.

Otherwise...

 

@avibird 1

...cool beans. And yep, a good mix might be nice. You could also try to write a simple FSM that keeps switching between the two states (using a pool of good resting positions/choke points) at some slightly random interval. For the extra surprise buttseks. :don16:

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×