How can I script AI Units to Move when told to and not move unless told to?

ImageImageTalking about Modding for EE2 and EE2 AOS. New maps, patches, programs and Multiplayer scenarios.
Post Reply
EmpireEarthManiac
Posts: 13
Joined: 19 May 2018, 21:51

How can I script AI Units to Move when told to and not move unless told to?

Post by EmpireEarthManiac » 19 May 2018, 21:57

How can I script to make AI units go to a certain location when I want them too, also how can I make AI units not move or not leave a certain location until I want them to?


User avatar
Leader
Dr.MonaLisa
Posts: 7073
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: How can I script AI Units to Move when told to and not move unless told to?

Post by Leader » 19 May 2018, 23:30

Do you mean .ies scripting for Scenarios, or general AIPs game files modding?
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains

User avatar
Loewenherz
Posts: 56
Joined: 23 Sep 2017, 17:26
Location: Germany

Re: How can I script AI Units to Move when told to and not move unless told to?

Post by Loewenherz » 20 May 2018, 09:35

I think, he mean the ies scripting. With the Aip files would be that difficult. ;)

How can I script to make AI units go to a certain location when I want them too,

Code: Select all

Actions on Selections

// void MoveSelection(float fX, float fY)
// Give a move goal to the units in the current selection.  After 
// giving the move goal, this flushes the current selection.
// example usage:
	SelectUnit("AmbassadorToPlayer1");
	//Send the ambassador to the city gates
	MoveSelection(10, 10);
how can I make AI units not move or not leave a certain location until I want them to?

Code: Select all

// void SetUnitSpecialForces(const char *in_szUnitName,
//   bool in_bSpecial)
// void SetGroupSpecialForces(const char *in_szGroupName,
//   bool in_bSpecial)
// Set Scripted Unit - "Special Forces"
// Marks/Clears the selected units as 'special forces', so that
// the strategic AI won't touch them.
// example usage:
	//For a while, keep him out of the eyes of the strategic AI so
//it doesn't accidentally send him to gather firewood while we're
//trying to get him to infiltrate the enemy city
	SetUnitSpecialForces("JamesBond", true);
...or you pause the AI.

Code: Select all

// void PausePlayerAI(int in_iPlayerID, bool bPaused)
// 	Disable/enable strategic AI of computer player
// example usage:
		//Pause AI player 2 until some condition is met.
		PausePlayerAI(2, true);
		...
		//Unpause player 2, now that the human player's ready.
		PausePlayerAI(2, false);
Last edited by Loewenherz on 20 May 2018, 16:27, edited 2 times in total.
My EE2 Work:
EE2 Scripts - Notepad ++ User Defined Language make the scripting clearly and easy.
Grid Utility for EE2 and EE2X to create accurate maps.
IES Script Collection with all scenario scripts from EE2 1.5

EmpireEarthManiac
Posts: 13
Joined: 19 May 2018, 21:51

Re: How can I script AI Units to Move when told to and not move unless told to?

Post by EmpireEarthManiac » 20 May 2018, 15:36

Loewenherz wrote:
20 May 2018, 09:35
I think, he mean the ies scripting. With the Aip files would be that difficult. ;)

How can I script to make AI units go to a certain location when I want them too,

Code: Select all

Actions on Selections

// void MoveSelection(float fX, float fY)
// Give a move goal to the units in the current selection.  After 
// giving the move goal, this flushes the current selection.
// example usage:
	SelectUnit("AmbassadorToPlayer1");
	//Send the ambassador to the city gates
	MoveSelection(10, 10);
how can I make AI units not move or not leave a certain location until I want them to?

Code: Select all

// void SetUnitSpecialForces(const char *in_szUnitName,
//   bool in_bSpecial)
// void SetGroupSpecialForces(const char *in_szGroupName,
//   bool in_bSpecial)
// Set Scripted Unit - "Special Forces"
// Marks/Clears the selected units as 'special forces', so that
// the strategic AI won't touch them.
// example usage:
	//For a while, keep him out of the eyes of the strategic AI so
//it doesn't accidentally send him to gather firewood while we're
//trying to get him to infiltrate the enemy city
	SetUnitSpecialForces("JamesBond", true);
...or you pause the AI.

Code: Select all

// void PausePlayerAI(int in_iPlayerID, bool bPaused)
// 	Disable/enable strategic AI of computer player
// example usage:
		//Pause AI player 2 until some condition is met.
		PausePlayerAI(2, true);
		...
		//Unpause player 2, now that the human player's ready.
		PausePlayerAI(2, false);
Thank you so much, I tried the pause player and tried to move specific AI units with the AI paused because I did not want the other units to move.

Post Reply