Jump to content

Recommended Posts

So I'm creating a mission where the players are supposed to meet up with a contact but in reality the contact has already been captured and they are walking into a trap. Once they get to a certain spot two cars blow up in front of them and AI ambush them. In order to keep the AI from firing on them too early I used disableAI "ALL" in their init fields which worked just fine. However I'm having an issue with enableAI, specifically that it's not enabling the AI. I have it in the same trigger that cancels one of their objectives so I know the trigger is firing and it's not a locality issue with any headless clients because they are blacklisted from HCs and it also doesn't work in local multiplayer.

This is how I have it scripted in the trigger:

s1 enableAI "ALL";

 

Share this post


Link to post
Share on other sites

You may have to name each bad guy and write the code for each named character

Share this post


Link to post
Share on other sites
1 minute ago, warlord554 said:

You may have to name each bad guy and write the code for each named character

 

that's what I did, but thinking maybe I was listing them wrong I started only doing it to the one labelled s1 to see if I could get it working with just one AI. However I still couldn't get it to work so I came here.

Share this post


Link to post
Share on other sites

I wanna say after you DISABLEAI,then enable you have to give them a anim to perform. It's been a while though 

Share this post


Link to post
Share on other sites

You could try setting their side to friendly then trigger enemy side when needed

Share this post


Link to post
Share on other sites

I just tested this in the Editor, works fine. Placed myself down, along with an AI named Bob. Debug console:

Bob doMove [0, 0, 0];

Wait a few seconds... He will move.

Bob disableAI "ALL";

He will stop.

Bob enableAI "ALL";

He will resume to move, without having to order the move again. No idea what it is not working for you... Could you provide more information? Is your trigger scripted? Local? Global? Server? Does "s1" exist? Etc...

 

UPDATE!

This is really strange. Once I do the above steps. After he resumes moving. I put the following in debug console again:

Bob disableAI "ALL";

He continued to move. WTF?! lol...

  • Like 1

Share this post


Link to post
Share on other sites

wait. It's more complex than that!

 

 

one player BLUFOR, allowDamage false.

one group OPFOR , gr1 , {_x disableAI "all"} forEach units gr1 somewhere at start

add a repeatable trigger BLUFOR PRESENT

on act : {_x enableAI "all"} forEach units gr1

on deact : {_x disableAI "all"} forEach units gr1

 

when player entering the area, reds fire..... OK

when player leaving the area, reds hold fire, some of them continue their movement (running, walking, on straight line, animations continue!!)

when player re-entering the area, the walking reds are teleported to their previous position!

 

 


 

 

  • Like 1

Share this post


Link to post
Share on other sites

Good find, did any of you made a ticket already @pierremgi/@HazJ?

If it's an easy fix it might make it into the next update.

 

Edit: Tested it and the command seems to be completely broken.

 

test = [] spawn {
	sleep 3;

	bob domove getposatl player;
	systemchat "Move";
	sleep 3;

	systemchat "AI disabled";
	bob disableAI "ALL";
	sleep 3;

	bob enableAI "ALL";
	systemchat "AI enabled";
	sleep 3;

	systemchat "AI disabled";
	bob disableAI "ALL"
};

Doesn't do anything.

 

Made a ticket just in case.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

So I actually fixed the issue I had. I guess it didn't like the fact that I was using the same trigger to update objectives. Also couldn't figure out the proper syntax for a list of AI being affected (I tried things like s1, s2, s3, etc.) so I ended up just placing the multiple times, once for each unit I needed changed like so:

 

s1 enableAI "ALL";
s2 enableAI "ALL";
s3 enableAI "ALL";
s4 enableAI "ALL";
s5 enableAI "ALL";
s6 enableAI "ALL";
s7 enableAI "ALL";

EDIT: If any of you knows the proper way to list it so I don't have to clutter the trigger activation field with the same command over and over that'd be great to know.

Edited by Eogos

Share this post


Link to post
Share on other sites
3 hours ago, Eogos said:

So I actually fixed the issue I had. I guess it didn't like the fact that I was using the same trigger to update objectives. Also couldn't figure out the proper syntax for a list of AI being affected (I tried things like s1, s2, s3, etc.) so I ended up just placing the multiple times, once for each unit I needed changed like so:

 


s1 enableAI "ALL";
s2 enableAI "ALL";
s3 enableAI "ALL";
s4 enableAI "ALL";
s5 enableAI "ALL";
s6 enableAI "ALL";
s7 enableAI "ALL";

EDIT: If any of you knows the proper way to list it so I don't have to clutter the trigger activation field with the same command over and over that'd be great to know.

 

forEach is your friend here:

{_x enableAI "ALL"} forEach [s1,s2,s3,s4,s5,s6,s7];

 

 

Cheers

  • Like 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

×