View Single Post
  #1  
Old 03-20-2012, 02:56 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default Make vehicles attack nearest Nutral marker

I am looking to alter some coding and do a battle on a small scale.

The idea is have a Front line marker set in Red and a frontline marker set in Blue (all over land). But also a 3rd set of markers inbetween the two battle lines that are Nutral. So the marker is not 1 or 2.

The idea is then the tanks would first attack Nearest Nutral markers as they advance Else attack nearest Enemy marker.

Code below tackles the issue of nearestEnemyMarker, but anyone have an idea of how to set them to attack and then take over a Nutral Frontmarker?

there is a lot more to the below coding but this points out the "attack nearest enemy.

Do I need to set up a int or bool at the begining stating Frontmarker 0 = Frontmarker nutral or something?


Code:
            Point3d counterPoint = new Point3d(nearestEnemyMarker.x,nearestEnemyMarker.y,0);
	        if(25000 > counterPoint.distance(ref startPoint))
	        {
		      Timeout(60, () =>
		        {
			        if(army == MissionMarkers[mmIndex].army)
			        {	// if still under control launch new combat
				        if(!FrontMissions.Exists(_x => _x.x == counterPoint.x && _x.y == counterPoint.y))
				        {
					        CreateTankMission(startPoint, army);
			        		CreateTankMission(counterPoint, enemy);
		        		};
	        		};
        		});
    		};
    	}
__________________
__________________
Win7, 64bit Ultra
Asus P8P67Pro MB
Intel i7-2600K
Coursair 16GB (4x 4GB), DDR3-1600MHz
Gainward Nvidia 580GTX 3GB DDR5
850-Watt Modular Power Supply
WIN7 and COD on Gskill SSD 240GB
40" Panasonic LCD
TrackIR5 +
Thrustmaster Warthog stick, throttle & pedals
Reply With Quote