# Unit Is Script Controlled
Grammar — unit is script controlled
Flags —Native
|Function
Returns true if the unit is being controlled by scripts/triggers instead of by AI. This function only works for units owned by an AI player. Script-controlled units are not used by the AI for attack waves. Units that are issued orders via trigger actions are automatically marked as script-controlled. You can manually mark a unit as script-controlled using the Enable/Disable Script Control trigger actions.
# Arguments
unit
— Unit
Returns — bool
native bool AIIsScriptControlled(unit u);
# Related
Category: AI / MiscCampaign / Functions
- [F] —
bool
— AI Time Is Paused — ( AITimeIsPaused ) - [F] —
fixed
— Elapsed AI Time — ( AIGetTime ) - [F] —
wave
— Wave Of Unit — ( AIUnitGetWave ) - [F] —
unitgroup
— Units Of Wave — ( AIWaveGetUnits ) - [F] —
unitgroup
— Escorts Of Unit — ( AIGetAllEscorts ) - [F] —
unitgroup
— Escorts Of Unit Group — ( AIGetAllEscortsGroup ) - [F] —
unitgroup
— Units In Waves With Target — ( AIGetUnitsInWavesWithTarget ) - [F] —
bool
— Unit Is Script Controlled — ( AIIsScriptControlled ) - [F] —
bool
— Unit Is Unavailable For Wave Use — ( AIIsNotUsableInWaves ) - [F] —
bool
— Unit Is Suicidal — ( AIIsSuicideUnit ) - [F] —
int
— Difficulty Value (Integer) — ( libNtve_gf_DifficultyValueInt ) - [F] —
fixed
— Difficulty Value (Real) — ( libNtve_gf_DifficultyValueFixed ) - [F] —
string
[ gamelink::Unit ] — Difficulty Value (Unit Type) — ( libNtve_gf_DifficultyValueUnitType ) - [F] —
bool
— Difficulty Is (one) — ( ) - [F] —
bool
— Difficulty Is (two) — ( ) - [F] —
bool
— Difficulty High — ( ) - [F] —
bool
— Difficulty Low — ( ) - [F] —
point
— Random Spawn Point — ( AIRandomSpawnPoint )
# Examples
# campaigns/void.sc2campaign
// L3163
AIIsScriptControlled(EventUnit())
// L1455
AIIsScriptControlled(lp_flyer)
// L1460
AIIsScriptControlled(lp_flyer)
// L2413
AIIsScriptControlled(auto065A6ADA_var)
// L2534
AIIsScriptControlled(auto2BE86D1D_var)
// L3163
AIIsScriptControlled(EventUnit())
// L1455
AIIsScriptControlled(lp_flyer)
// L1460
AIIsScriptControlled(lp_flyer)
// L2413
AIIsScriptControlled(auto065A6ADA_var)
// L2534
AIIsScriptControlled(auto2BE86D1D_var)
# mods/core.sc2mod
// L787
AIIsScriptControlled(unitToCheck)
// L921
AIIsScriptControlled(unitToCheck)
# mods/starcoop/starcoop.sc2mod
// L2080
AIIsScriptControlled(UnitLastCreated())
// L2175
AIIsScriptControlled(UnitLastCreated())
# mods/starcoop/starcoop.sc2mod
// L763
AIIsScriptControlled(unitToCheck)
// L886
AIIsScriptControlled(unitToCheck)