No announcement yet.

Defense - End Mission script

  • Filter
  • Time
  • Show
Clear All
new posts

  • Defense - End Mission script

    The problem I have with defense missions is you have to eliminate every last enemy unit. Sometimes they are over 300m out any which way in the trees and the mission just drags on and on. With this script I created two zones to check and if there is no enemy in the inner zone but less than 4 in an outer zone, then the mission is considered a success.

    //check that the area is clear of Opfor for win
    // uses two zones so that you don't have to chase down every last OPFOR in a 400m radius
    // the trigger triggerObjZone is 200m round
    // the trigger triggerObjLargeZone is 400m round
    if (isServer) then
    	_run = true;
    	while {_run} do
    		_numEnemy = 0;
    		_numEnemyLargeZone = 0;
    		_numEnemyLeftToAttack = 0;
    		_numEnemy = east countSide list triggerObjZone;
    		_numEnemyLargeZone = east countSide list triggerObjLargeZone;
    		_numEnemyLeftToAttack = _numEnemyLargeZone - _numEnemy;
    		//player groupChat format ["_numEnemy is %1", _numEnemy];
    		sleep 3;
    		if ((_numEnemy < 1) and (_numEnemyLeftToAttack < 4)) then
    			_x = round (random 30);
    			sleep _x; //randomize the timer before mission ends so it doesn't feel as immediate when you kill the last enemy
    			missionComplete = "completed";
    			publicVariable missionComplete;
    			//player sideChat "cleared";
    			_run = false;
    |TG-189th| Unkl
    TG PrimerArmA Game Officer189th Infantry Brigade Former Irregular
    Submit a Ribbon Nomination!
    "this is on par with groups you have to join to get the quality of gameplay and i really enjoyed it" - random dude
    "Remember when the threat has spotted you, smoke first then bring the explosive rounds to bear. When the threat has not spotted you its bang first and smoke after to extract." - Wicks



TeamSpeak 3 Server




Twitter Feed