Jump to content
madmonkey119

Enable AI after team switch

Recommended Posts

Hello,

I've been creating a dynamic mission involving many spawned in units and groups. Currently I would like the player to be able to switch between roles and units using the team switch menu within the map. Currently you can select any unit and the transition works. However the old unit no longer has AI.

I've tried this but it didn't work unfortunately.

 

addMissionEventHandler["TeamSwitch", {
	_oldUnit = _this select 0;
	[_oldUnit] spawn {
		_oldUnit = _this select 0;
		_oldUnit enableAI "ALL";
		hint "TURN ON AI";
	};
}];

Any help would be appreciated. Thanks!
 

 
Edit: Nevermind, got it with
 
null=[] spawn {sleep 0.5;onTeamSwitch "selectPlayer (leader _from); {_x doFollow leader _from} foreach units _from; selectPlayer _to;"}

Share this post


Link to post
Share on other sites
20 minutes ago, pierremgi said:

Yep! I didn't see your post before. Nothing new under the sun since :

 


Seriously? You linked post when mission EH was just added and wasnt working in SP at all. What this has to do with this post when it is about something else completely? Also the mission EH was fixed long time ago. Your negative attitude combined with lack of knowledge is not going to make you many friends, trust me.

Share this post


Link to post
Share on other sites

KK don't be so sensible!

I posted this just because it seemed to me It's a waste of time trying to make the EH working, so it appeared to me a good idea to underline the (poor) solution can be the use of the old "onTeamSwitch" (even if you can't stack it I guess). Just to say that if people can go through a solution instead of wasting time, I can't imagine it's an offense! Or there are plenty of them in BI forums.

AFTER that, and not before, I read your brand new answer on my old post (link above). I thanked you (a little bit too fast) with a real pleasure!

Now, You're arguing for "something else completely" and I must admit my English is too poor to understand the controversy!

Sorry if this could be taken for a negative attitude! And I gladly admit my lack of knowledge. The little I learned, with a very positive result, truly, was in blogs like yours, on the top ten.

I know who you are for many years.

But be sure of one thing, Thanks God, I have nothing more to demonstrate in my real life as commander in French Navy. And scripting must stay for me a pleasure, not an arena for frustrated geeks. I'm not afraid at all of a lack of such friends! As an aircraft carrier pilot, I indeed relativize such threats!

I wish you again a merry Christmas

 

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

×