Page 1 of 1

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

Posted: 19 May 2018, 21:57
by EmpireEarthManiac
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?

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

Posted: 19 May 2018, 23:30
by Dr.MonaLisa
Do you mean .ies scripting for Scenarios, or general AIPs game files modding?

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

Posted: 20 May 2018, 09:35
by Loewenherz
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);

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

Posted: 20 May 2018, 15:36
by EmpireEarthManiac
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.