# Random Spawn Point
Grammar — Random point in region between minDistFromEnemies|Min and maxDistFromEnemies|Max distance from enemy units of player player (prefer points within maxDistFromBuildings|MaxDist of an enemy building)
Flags —Native
|Function
Returns a random point in the given region. Prefers to stay either close or far from enemies units. Also prefers to be within some max distance of enemy buildings. It will also stay away from previously returned random points in the region.
# Arguments
int
— Playerregion
— Regionfixed
— MinDistFromEnemiesfixed
— MaxDistFromEnemiesfixed
— MaxDistFromBuildings
Returns — point
native point AIRandomSpawnPoint(
int player,
region r,
fixed minDistFromEnemy,
fixed maxDistFromEnemy,
fixed maxDistFromBuilding,
);
# Related
Category: AI / MiscCampaign / Functions
- AI Time Is Paused —
bool
— AITimeIsPaused - Elapsed AI Time —
fixed
— AIGetTime - Wave Of Unit —
wave
— AIUnitGetWave - Units Of Wave —
unitgroup
— AIWaveGetUnits - Escorts Of Unit —
unitgroup
— AIGetAllEscorts - Escorts Of Unit Group —
unitgroup
— AIGetAllEscortsGroup - Units In Waves With Target —
unitgroup
— AIGetUnitsInWavesWithTarget - Unit Is Script Controlled —
bool
— AIIsScriptControlled - Unit Is Unavailable For Wave Use —
bool
— AIIsNotUsableInWaves - Unit Is Suicidal —
bool
— AIIsSuicideUnit - Difficulty Value (Integer) —
int
— libNtve_gf_DifficultyValueInt - Difficulty Value (Real) —
fixed
— libNtve_gf_DifficultyValueFixed - Difficulty Value (Unit Type) —
string
<gamelink::Unit> — libNtve_gf_DifficultyValueUnitType - Difficulty Is (one)
- Difficulty Is (two)
- Difficulty High
- Difficulty Low
- Random Spawn Point —
point
— AIRandomSpawnPoint
# Examples
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul03.sc2map/MapScript.galaxy:2513
}
lv_point = AIRandomSpawnPoint(gv_p02_ZERG_LOW_GROUND_AI, RegionFromId(32), 9.0, 40.0, 30.0);
if ((RegionContainsPoint(RegionCircle(lv_point, 10.0), CameraGetTarget(gv_p01_USER)) == true) && (gv_gameOver == false)) {
CameraShakeStart(gv_p01_USER, c_cameraPositionTarget, c_cameraDirectionZ, 0.07, 2.0, 100.0, 3.0);
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul03.sc2map/MapScript.galaxy:2561
}
lv_point = AIRandomSpawnPoint(gv_p02_ZERG_LOW_GROUND_AI, RegionFromId(24), 9.0, 40.0, 30.0);
if ((RegionContainsPoint(RegionCircle(lv_point, 10.0), CameraGetTarget(gv_p01_USER)) == true) && (gv_gameOver == false)) {
CameraShakeStart(gv_p01_USER, c_cameraPositionTarget, c_cameraDirectionZ, 0.07, 2.0, 100.0, 3.0);
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tzeratul03.sc2map/MapScript.galaxy:2609
}
lv_point = AIRandomSpawnPoint(gv_p02_ZERG_LOW_GROUND_AI, RegionFromId(40), 9.0, 40.0, 30.0);
if ((RegionContainsPoint(RegionCircle(lv_point, 10.0), CameraGetTarget(gv_p01_USER)) == true) && (gv_gameOver == false)) {
CameraShakeStart(gv_p01_USER, c_cameraPositionTarget, c_cameraDirectionZ, 0.07, 2.0, 100.0, 3.0);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul03.sc2map — MapScript.galaxy:2513
}
lv_point = AIRandomSpawnPoint(gv_p02_ZERG_LOW_GROUND_AI, RegionFromId(32), 9.0, 40.0, 30.0);
if ((RegionContainsPoint(RegionCircle(lv_point, 10.0), CameraGetTarget(gv_p01_USER)) == true) && (gv_gameOver == false)) {
CameraShakeStart(gv_p01_USER, c_cameraPositionTarget, c_cameraDirectionZ, 0.07, 2.0, 100.0, 3.0);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul03.sc2map — MapScript.galaxy:2561
}
lv_point = AIRandomSpawnPoint(gv_p02_ZERG_LOW_GROUND_AI, RegionFromId(24), 9.0, 40.0, 30.0);
if ((RegionContainsPoint(RegionCircle(lv_point, 10.0), CameraGetTarget(gv_p01_USER)) == true) && (gv_gameOver == false)) {
CameraShakeStart(gv_p01_USER, c_cameraPositionTarget, c_cameraDirectionZ, 0.07, 2.0, 100.0, 3.0);
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tzeratul03.sc2map — MapScript.galaxy:2609
}
lv_point = AIRandomSpawnPoint(gv_p02_ZERG_LOW_GROUND_AI, RegionFromId(40), 9.0, 40.0, 30.0);
if ((RegionContainsPoint(RegionCircle(lv_point, 10.0), CameraGetTarget(gv_p01_USER)) == true) && (gv_gameOver == false)) {
CameraShakeStart(gv_p01_USER, c_cameraPositionTarget, c_cameraDirectionZ, 0.07, 2.0, 100.0, 3.0);