How can I script AI Units to Move when told to and not move unless told to?
-
- Posts: 21
- Joined: 19 May 2018, 21:51
How can I script AI Units to Move when told to and not move unless told to?
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?
- Dr.MonaLisa
- High Representative
- Posts: 8707
- Joined: 17 Jun 2010, 11:21
- Location: Poland
- Has thanked: 49 times
- Been thanked: 108 times
Re: How can I script AI Units to Move when told to and not move unless told to?
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
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
- Loewenherz
- Posts: 244
- Joined: 23 Sep 2017, 17:26
- Has thanked: 7 times
- Been thanked: 21 times
Re: How can I script AI Units to Move when told to and not move unless told to?
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,
how can I make AI units not move or not leave a certain location until I want them to?
...or you pause the AI.
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);
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);
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.
List of tutorials, useful threads and utilities (look here before posting): Here
Add Pics to Map: viewtopic.php?f=54&p=25184#p25184
Loews Work: viewtopic.php?f=54&t=5160
Add Pics to Map: viewtopic.php?f=54&p=25184#p25184
Loews Work: viewtopic.php?f=54&t=5160
-
- Posts: 21
- Joined: 19 May 2018, 21:51
Re: How can I script AI Units to Move when told to and not move unless told to?
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.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,how can I make AI units not move or not leave a certain location until I want them to?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);
...or you pause the AI.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);
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);