Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   Make vehicles attack nearest Nutral marker (http://forum.fulqrumpublishing.com/showthread.php?t=30603)

hc_wolf 03-20-2012 02:56 AM

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);
                                        };
                                };
                        });
                    };
            }


FG28_Kodiak 03-20-2012 04:55 AM

if you use the Missionmarkerclass from narvy
Code:

internal class MissionMarker
    {
        internal double x;
        internal double y;
        internal int army;
        internal MissionMarker(double x, double y, int army) { this.x = x; this.y = y; this.army = army; }
    }

then you should use 0 for neutral, 1 for red and 2 for blue. In mis-file a neutral frontmarker has also the value 0


All times are GMT. The time now is 07:40 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.