Im bad at programming. I was following this guys youtube video and he ran this script and had no problems with it. When I run it I get
"Assets/MasterSpawnScript.js(40,17): BCE0044):expecting ), found ‘enemyCounter’.
when I tried to remove the script I got like 20 more errors. Here is the script
#pragma strict
var spawnPoints : Transform[];
var enemyPrefabs : GameObject [];
var yieldTimeMin = 2;
var yieldTimeMax = 5;
static var enemyCounter = 0;
var spawnXOffsetMin = 0;
var spawnXOffsetMax = 0;
var spawnZOffsetMin = 0;
var spawnZOffsetMax = 0;
var defaultSpawnNumber = 5;
var waveNumber = 1;
var isSpawning = false;
function SpawnEnemies(wave : int)
{
var spawnNum = (defaultSpawnNumber + 5 * (wave - 1));
isSpawning = true;
for(var i = 0; i < spawnNum;i++)
{
yield WaitForSeconds(Random.Range(yieldTimeMin, yieldTimeMax));
var object : GameObject = enemyPrefabs[Random.Range(0, enemyPrefabs.Length)];
var positions : Transform = spawnPoints[Random.Range(0, spawnPoints.Length)];
Instantiate(object, position.position +
Vector3(Random.Range(spawnXOffsetMin, spawnXOffsetMax, 0,
Random.Range(spawnZOffsetMin, spawnZOffsetMax)), position.rotation)
enemyCounter++;
}
isSpawning = false;
}
function UpdateWave ()
{
waveNumber++;
SpawnEnemies(waveNumber);
}
function Start ()
{
SpawnEnemies(waveNumber);
}
function Update ()
{
if(enemyCounter == 0 && !isSpawning)
{
UpdateWave();
}
}