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)
-   -   Ghosts and Bermuda Triangle Stuff (http://forum.fulqrumpublishing.com/showthread.php?t=30851)

FG28_Kodiak 04-02-2012 10:30 AM

@_79_dev
the errormessage stated that there are two sendchatmessages(..) declared, so you are right when you remove one of them. ;)

_79_dev 04-02-2012 10:41 AM

Continiuing my thought...


If I remouve this part of my "original" script...
PHP Code:


  
private bool isAiControlledPlane (AiAircraft aircraft)  
  { 
        if (
aircraft == null)  
        {  
            return 
false; 
        } 

        
Player [] players = GamePlay.gpRemotePlayers (); 
        foreach (
Player p in players)  
        {     
            if (
p != null && (p.Place () is AiAircraft) && (p.Place () as AiAircraft) == aircraft) 
            {  
                return 
false; 
            } 
        } 

        return 
true; 
    } 

    private 
void destroyPlane (AiAircraft aircraft) { 
        if (
aircraft != null) {  
            
aircraft.Destroy (); 
        } 
    } 

    private 
void explodeFuelTank (AiAircraft aircraft)  
  { 
        if (
aircraft != null)  
        {  
            
aircraft.hitNamed (part.NamedDamageTypes.FuelTank0Exploded); 
        } 
    } 

    private 
void destroyAiControlledPlane (AiAircraft aircraft) { 
        if (
isAiControlledPlane (aircraft)) { 
            
destroyPlane (aircraft); 
        } 
    } 

    private 
void damageAiControlledPlane (AiActor actor) { 
        if (
actor == null || !(actor is AiAircraft)) {  
            return; 
        } 

        
AiAircraft aircraft = (actor as AiAircraft); 

        if (!
isAiControlledPlane (aircraft)) { 
            return; 
        } 

        if (
aircraft == null) {  
            return; 
        } 

        
aircraft.hitNamed (part.NamedDamageTypes.ControlsElevatorDisabled); 
        
aircraft.hitNamed (part.NamedDamageTypes.ControlsAileronsDisabled); 
        
aircraft.hitNamed (part.NamedDamageTypes.ControlsRudderDisabled); 
        
aircraft.hitNamed (part.NamedDamageTypes.FuelPumpFailure); 

        
int iNumOfEngines = (aircraft.Group() as AiAirGroup).aircraftEnginesNum(); 
        for (
int i = 0; i < iNumOfEngines; i++) 
        { 
            
aircraft.hitNamed((part.NamedDamageTypes)Enum.Parse(typeof(part.NamedDamageTypes), "Eng" + i.ToString() + "TotalFailure")); 
        } 

        
/***Timeout (240, () => 
                {explodeFuelTank (aircraft);} 
            ); 
         * ***/ 

        
Timeout (300, () => 
                {
destroyPlane (aircraft);} 
            ); 
    } 

and replace it with ....


PHP Code:

public class Mission : AMission
{

    
#region InGameActors
    
    

    
internal class InGameActors
    
{

        
internal class Actor
        
{
            
internal bool destroyed = false;
            
internal AiActor actor { get; set; }
            
internal DateTime CreationTime { get; set; }
            
internal int MissionNumber { get; set; }

            public 
Actor(AiActor actor, int missionNumber)
            {
                
this.actor = actor;
                
this.CreationTime = DateTime.Now;
                
this.MissionNumber = missionNumber;
                
this.destroyed = false;
            }
        }


        
internal List<Actor> ActorsInGame = new List<Actor>();


        private 
bool IsActorDestroyable(AiActor actor)
        {
            
bool ActorDestroyable = true;

            
//Check if actor is empty (no Player)
            
if (actor is AiCart)
            {
                if ((
actor as AiCart).ExistCabin(0))
                    for (
int i = 0; i < (actor as AiCart).Places(); i++)
                    {
                        if ((
actor as AiCart).Player(i) != null)
                        {
                            
ActorDestroyable = false;
                            break;
                        }
                    }
            }

            return 
ActorDestroyable;
        }


        private 
void destroyActor(AiActor actor)
        {
            if (
actor != null)
                if (
actor is AiCart)
                    (
actor as AiCart).Destroy();
        }


        public 
void Add(AiActor actor, int missionNumber)
        {
            if (
actor != null && actor is AiCart)
                
ActorsInGame.Add(new Actor(actor, missionNumber));
        }


        public 
void Removeable(AiActor actor)
        {
            if (
ActorsInGame.Exists(item => item.actor == actor))
                
ActorsInGame[ActorsInGame.FindIndex(item => item.actor == actor)].destroyed = true;
        }


        public List<
AiActor> GetActors()
        {
            List<
AiActor> tmpActors = new List<AiActor>();

            
ActorsInGame.ForEach(item => { tmpActors.Add(item.actor); });

            return 
tmpActors;
        }


        public 
void DestroyActor(AiActor actor)
        {
            if (
ActorsInGame.Exists(item => item.actor == actor))
            {
                
int i = ActorsInGame.FindIndex(item => item.actor == actor);

                if (
IsActorDestroyable(ActorsInGame[i].actor))
                {
                    
destroyActor(ActorsInGame[i].actor);
                }
            }
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(int missionNumber)
        {

            if (
missionNumber == -1)
            {
                
ActorsInGame.ForEach(item => { if (IsActorDestroyable(item.actor)) destroyActor(item.actor); });
            }
            else if (
ActorsInGame.Exists(item => item.MissionNumber == missionNumber))
                
ActorsInGame.ForEach(item =>
                {
                    if (
item.MissionNumber == missionNumber)
                        if (
IsActorDestroyable(item.actor))
                            
destroyActor(item.actor);
                });
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(int missionNumber, int army)
        {
            if (
ActorsInGame.Exists(item => item.MissionNumber == missionNumber && item.actor.Army() == army))
                
ActorsInGame.ForEach(item =>
                {
                    if (
item.MissionNumber == missionNumber && item.actor.Army() == army)
                        if (
IsActorDestroyable(item.actor))
                            
destroyActor(item.actor);
                });
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(Point3d Position, double Radius)
        {

            if (
ActorsInGame.Exists(item => item.actor.Pos().distance(ref Position) < Radius))
                
ActorsInGame.ForEach(item =>
                {
                    if (
item.actor.Pos().distance(ref Position) < Radius)
                        if (
IsActorDestroyable(item.actor))
                            
destroyActor(item.actor);
                });
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(int missionNumber, Point3d Position, double Radius)
        {

            if (
ActorsInGame.Exists(item => (item.MissionNumber == missionNumber && item.actor.Pos().distance(ref Position) < Radius)))
                
ActorsInGame.ForEach(item =>
                {
                    if (
item.MissionNumber == missionNumber && item.actor.Pos().distance(ref Position) < Radius)
                        if (
IsActorDestroyable(item.actor))
                            
destroyActor(item.actor);
                });
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(int missionNumber, params AiGroundActorType[] types)
        {
            foreach (
AiGroundActorType abat in types)
            {

                if (
ActorsInGame.Exists(item => item.MissionNumber == missionNumber && (item.actor as AiGroundActor).Type() == abat))
                    
ActorsInGame.ForEach(item =>
                    {
                        if (
item.MissionNumber == missionNumber && (item.actor as AiGroundActor).Type() == abat)
                            if (
IsActorDestroyable(item.actor))
                                
destroyActor(item.actor);
                    });
            }
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(TimeSpan DestroyAfterTime)
        {
            
DateTime tmpTime = DateTime.Now.Subtract(DestroyAfterTime);

            if (
ActorsInGame.Exists(item => item.CreationTime <= tmpTime))
                
ActorsInGame.ForEach(item =>
                {
                    if (
item.CreationTime <= tmpTime)
                        if (
IsActorDestroyable(item.actor))
                            
destroyActor(item.actor);
                });
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(params AiGroundActorType[] types)
        {

            foreach (
AiGroundActorType abat in types)
            {
                if (
ActorsInGame.Exists(item => (item.actor is AiGroundActor) && (item.actor as AiGroundActor).Type() == abat))
                    
ActorsInGame.ForEach(item =>
                    {
                        if ((
item.actor is AiGroundActor) && (item.actor as AiGroundActor).Type() == abat)
                            if (
IsActorDestroyable(item.actor))
                                
destroyActor(item.actor);
                    });
            }
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }

    }

    
#endregion
} 

everything should work fine right???

_79_dev 04-08-2012 07:58 AM

Tsted this script on dedicate server. Ai seems to be taking control over landeed aircraft, it's trying to take off again and circle over base...

FG28_Kodiak 04-08-2012 09:10 AM

When do you Destroy the planes?

Can i see this code part please?

_79_dev 04-08-2012 10:25 AM

PHP Code:

[PHP]
//$reference IL2ClodCommanderStats.dll
// v.1_0. script by FG28_Kodiak, ZaltysZ, Oreva, Small_Bee, RAF238thWildWillie
using System;
using System.Diagnostics;
using System.Collections;
using maddox.GP;
using maddox.game;
using maddox.game.world;
using part;
using System.Collections.Generic;
using IL2ClodCommanderStats;


public class 
Mission : AMission
{
    
#region Stats Initialization
    // For Connection to the IL2 Clod Commander Application
    // This allows you to store stats on players within Cliffs of Dover
    //  Change the following to meet your needs
    //
    
private static string serverName = "5. JG 27 Server";
    private static 
string serverIP = "127.0.0.1";
    
    
// Password is not used currently
    
private static string serverPassword = "password";
    private static 
Int32  serverPort = 27015;
    private 
StatsRecording stats = new StatsRecording(serverName, serverIP, serverPassword, serverPort);
    private 
Dictionary<String, AiActor> allActors = new Dictionary<String, AiActor>();
    private List<
ServerCommand> newCmds = new List<ServerCommand>();
    private 
Stopwatch MissionTimer = new Stopwatch();
    
#endregion

    
int LastMissionLoaded = 0;

    
double initTime;


    private 
void sendChatMessage(string msg, params object[] args)
    {
        
GamePlay.gpLogServer(null, msg, args);
    }


    private 
void sendChatMessage(Player player, string msg, params object[] args)
    {
        if (
player != null)
            
GamePlay.gpLogServer(new Player[] { player }, msg, args);
    }


    private 
void sendChatMessage(int army, string msg, params object[] args)
    {
        List<
Player> Consignees = new List<Player>();

        if (
GamePlay.gpPlayer() != null)
            
Consignees.Add(GamePlay.gpPlayer());
        if (
GamePlay.gpRemotePlayers() != null)
            
Consignees.AddRange(GamePlay.gpRemotePlayers());

        if (
army == -1)
            
GamePlay.gpLogServer(null, msg, args);
        else if (
Consignees.Exists(item => item.Army() == army))
            
GamePlay.gpLogServer(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
    }




    
// loading sub-missions
    
public override void OnTickGame()
    {
          
#region Stats Timer
          
if (MissionTimer.Elapsed.TotalSeconds >= 5) // 5 seconds
        
{
            
MissionTimer.Restart(); // stopwatch reset to 0 and restart
            
if (stats != null )
            {
               
newCmds = stats.getCommands();
               if (
newCmds != null && newCmds.Count > 0)
                   
ProcessCommands(newCmds);
            }
        }
        
#endregion
/////////////////////////////Missions timers here
        
if (Time.tickCounter() % 7200 == 3600)  
       
       {

       
sendChatMessage((-1), "PLEAS VISIT www.5jg27.net TO CHECK STATS");

        }
// loads ground
       
if (Time.tickCounter() % 2592000 == 300)  
       {
           
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/adlertag/adlertag_Ground.mis");
    
       }

       
// loads Mission1
       
if (Time.tickCounter() % 2592000 == 1800)  
       {
           
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/adlertag/adlertag_Air1blue20.mis");
                      
       }

// load test mission

  
if (Time.tickCounter() % 2592000 == 3600)  
       {
           
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/adlertag/landing.mis");
    
       }
    

// loads Mission2
       
if (Time.tickCounter() % 2592000 == 72000)  
       {
           
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/adlertag/adlertag_Air3red50.mis");
           
           
       }

       
// loads Mission3
       
if (Time.tickCounter() % 2592000 == 129600)  
       {
           
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/adlertag/adlertag_Air2blue35.mis");
          
           
       }
    }


////////////////////////////End Missions Timer Region
   
    #region InGameActors
    
    

    
internal class InGameActors
    
{

        
internal class Actor
        
{
            
internal bool destroyed = false;
            
internal AiActor actor { get; set; }
            
internal DateTime CreationTime { get; set; }
            
internal int MissionNumber { get; set; }

            public 
Actor(AiActor actor, int missionNumber)
            {
                
this.actor = actor;
                
this.CreationTime = DateTime.Now;
                
this.MissionNumber = missionNumber;
                
this.destroyed = false;
            }
        }


        
internal List<Actor> ActorsInGame = new List<Actor>();


        private 
bool IsActorDestroyable(AiActor actor)
        {
            
bool ActorDestroyable = true;

            
//Check if actor is empty (no Player)
            
if (actor is AiCart)
            {
                if ((
actor as AiCart).ExistCabin(0))
                    for (
int i = 0; i < (actor as AiCart).Places(); i++)
                    {
                        if ((
actor as AiCart).Player(i) != null)
                        {
                            
ActorDestroyable = false;
                            break;
                        }
                    }
            }

            return 
ActorDestroyable;
        }


        private 
void destroyActor(AiActor actor)
        {
            if (
actor != null)
                if (
actor is AiCart)
                    (
actor as AiCart).Destroy();
        }


        public 
void Add(AiActor actor, int missionNumber)
        {
            if (
actor != null && actor is AiCart)
                
ActorsInGame.Add(new Actor(actor, missionNumber));
        }


        public 
void Removeable(AiActor actor)
        {
            if (
ActorsInGame.Exists(item => item.actor == actor))
                
ActorsInGame[ActorsInGame.FindIndex(item => item.actor == actor)].destroyed = true;
        }


        public List<
AiActor> GetActors()
        {
            List<
AiActor> tmpActors = new List<AiActor>();

            
ActorsInGame.ForEach(item => { tmpActors.Add(item.actor); });

            return 
tmpActors;
        }


        public 
void DestroyActor(AiActor actor)
        {
            if (
ActorsInGame.Exists(item => item.actor == actor))
            {
                
int i = ActorsInGame.FindIndex(item => item.actor == actor);

                if (
IsActorDestroyable(ActorsInGame[i].actor))
                {
                    
destroyActor(ActorsInGame[i].actor);
                }
            }
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(int missionNumber)
        {

            if (
missionNumber == -1)
            {
                
ActorsInGame.ForEach(item => { if (IsActorDestroyable(item.actor)) destroyActor(item.actor); });
            }
            else if (
ActorsInGame.Exists(item => item.MissionNumber == missionNumber))
                
ActorsInGame.ForEach(item =>
                {
                    if (
item.MissionNumber == missionNumber)
                        if (
IsActorDestroyable(item.actor))
                            
destroyActor(item.actor);
                });
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(int missionNumber, int army)
        {
            if (
ActorsInGame.Exists(item => item.MissionNumber == missionNumber && item.actor.Army() == army))
                
ActorsInGame.ForEach(item =>
                {
                    if (
item.MissionNumber == missionNumber && item.actor.Army() == army)
                        if (
IsActorDestroyable(item.actor))
                            
destroyActor(item.actor);
                });
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(Point3d Position, double Radius)
        {

            if (
ActorsInGame.Exists(item => item.actor.Pos().distance(ref Position) < Radius))
                
ActorsInGame.ForEach(item =>
                {
                    if (
item.actor.Pos().distance(ref Position) < Radius)
                        if (
IsActorDestroyable(item.actor))
                            
destroyActor(item.actor);
                });
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(int missionNumber, Point3d Position, double Radius)
        {

            if (
ActorsInGame.Exists(item => (item.MissionNumber == missionNumber && item.actor.Pos().distance(ref Position) < Radius)))
                
ActorsInGame.ForEach(item =>
                {
                    if (
item.MissionNumber == missionNumber && item.actor.Pos().distance(ref Position) < Radius)
                        if (
IsActorDestroyable(item.actor))
                            
destroyActor(item.actor);
                });
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(int missionNumber, params AiGroundActorType[] types)
        {
            foreach (
AiGroundActorType abat in types)
            {

                if (
ActorsInGame.Exists(item => item.MissionNumber == missionNumber && (item.actor as AiGroundActor).Type() == abat))
                    
ActorsInGame.ForEach(item =>
                    {
                        if (
item.MissionNumber == missionNumber && (item.actor as AiGroundActor).Type() == abat)
                            if (
IsActorDestroyable(item.actor))
                                
destroyActor(item.actor);
                    });
            }
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(TimeSpan DestroyAfterTime)
        {
            
DateTime tmpTime = DateTime.Now.Subtract(DestroyAfterTime);

            if (
ActorsInGame.Exists(item => item.CreationTime <= tmpTime))
                
ActorsInGame.ForEach(item =>
                {
                    if (
item.CreationTime <= tmpTime)
                        if (
IsActorDestroyable(item.actor))
                            
destroyActor(item.actor);
                });
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }


        public 
void DestroyActors(params AiGroundActorType[] types)
        {

            foreach (
AiGroundActorType abat in types)
            {
                if (
ActorsInGame.Exists(item => (item.actor is AiGroundActor) && (item.actor as AiGroundActor).Type() == abat))
                    
ActorsInGame.ForEach(item =>
                    {
                        if ((
item.actor is AiGroundActor) && (item.actor as AiGroundActor).Type() == abat)
                            if (
IsActorDestroyable(item.actor))
                                
destroyActor(item.actor);
                    });
            }
            
ActorsInGame.RemoveAll(item => item.destroyed == true);
        }

    }

    
#endregion
////////////////////////////End desstroy actor list script

  
public override void Init(maddox.game.ABattle battle, int missionNumber)
  {
        
base.Init(battle, missionNumber);
        
MissionNumberListener = -1; //Listen to events of every mission
  
}

//////////////////////////////////////////
// Methods for Stats (You can add any code you may need after the Stats Region
//////////////////////////////////////////

    
public override void OnBattleStarted()
    {
        
base.OnBattleStarted();
        
#region Stats
           
MissionTimer.Start(); // start the stopwatch
        #endregion
    
}

    private 
void sendScreenMessageTo(int army, string msg, object[] parms)
    {
        List<
Player> Players = new List<Player>();

        
// on Dedi the server or for singleplayertesting
        
if (GamePlay.gpPlayer() != null)
        {
            if (
GamePlay.gpPlayer().Army() == army || army == -1)
                
Players.Add(GamePlay.gpPlayer());
        }
        if (
GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (
Player p in GamePlay.gpRemotePlayers())
            {
                if (
p.Army() == army || army == -1)
                    
Players.Add(p);
            }
        }
        if (
Players != null && Players.Count > 0)
            
GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms);
    }

    private 
void ProcessCommands(List<ServerCommand> newCmds)
    {
        try
        {
            foreach (
ServerCommand sc in newCmds)
            {
                if (
sc.CommandType.Equals("HUDmsg"))
                {
                    if (
sc.ToWho.Equals("All"))
                        
GamePlay.gpHUDLogCenter(sc.Command);
                  else if (
sc.ToWho.Equals("Red"))
                    {
                        
sendScreenMessageTo(1, sc.Command, null);
                    }
                    else if (
sc.ToWho.Equals("Blue"))
                    {
                        
sendScreenMessageTo(2, sc.Command, null);
                    }
                    else
                    {
                        if (
GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
                        {

                            foreach (
Player p in GamePlay.gpRemotePlayers())
                            {
                                if (
p.Name() == sc.ToWho)
                                    
GamePlay.gpLogServer(new Player[] { p }, sc.Command, null);
                            }
                        }
                        
// Message is for a specific player based on player name in string sc.ToWho
                    
}
                }
            }
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.ProcessCommands - Exception: " + ex);
        }
    }
 
    public 
override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        
#region stats
        
base.OnActorCreated(missionNumber, shortName, actor);
        
// Add actor to list of all Actors
        
if (!allActors.ContainsKey(shortName))
           
allActors.Add(shortName, actor);
        try
        {
            
stats.newActor(shortName, actor);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnActorCreated - Exception: " + ex);
        }
        
#endregion

        


    
}


    public 
override void OnPersonHealth(maddox.game.world.AiPerson person, maddox.game.world.AiDamageInitiator initiator, float deltaHealth)
    {
        
#region stats
        
base.OnPersonHealth(person, initiator, deltaHealth);
        try
        {
            
stats.playerHealth(person, initiator, deltaHealth);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnPersonHealth - Exception: " + ex);
        }
        
#endregion

    
}

    public 
override void OnPersonParachuteFailed(maddox.game.world.AiPerson person)
    {
        
#region stats
        
base.OnPersonParachuteFailed(person);
        try
        {
            
stats.personParachute("Failed", person);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnPersonParachuteFailed - Exception: " + ex);
        }
        
#endregion
    
}

    public 
override void OnPersonParachuteLanded(maddox.game.world.AiPerson person)
    {
        
#region stats
        
base.OnPersonParachuteLanded(person);
        try
        {
            
stats.personParachute("Landed", person);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnPersonParachuteLanded - Exception: " + ex);
        }
        
#endregion
    
}

    public 
override void OnPlayerArmy(maddox.game.Player player, int army)
    {
        
#region stats
        
base.OnPlayerArmy(player, army);
        try
        {
            
stats.playerArmy(player, army);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnPlayerArmy - Exception: " + ex);
        }
        
#endregion

    
}

    public 
override void OnPlayerConnected(maddox.game.Player player)
    {
        
#region stats
        
base.OnPlayerConnected(player);
        try
        {
            
stats.pilotInfo(player);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnPlayerConnected - Exception: " + ex);
        }

        
#endregion
        // Your code here
    
}
    public 
override void OnPlayerDisconnected(maddox.game.Player player, string diagnostic)
    {
        
#region stats
        
base.OnPlayerDisconnected(player, diagnostic);
        try
        {
            
stats.playerDisconnect(player, diagnostic);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnPlayerDisconnected - Exception: " + ex);
        }

        
#endregion
        // Your code here
    
}
    
    public 
override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        
#region stats
        
base.OnPlaceEnter(player, actor, placeIndex);
        try
        {
            
Point2d actorPos = new Point2d(actor.Pos().x, actor.Pos().y);
            
String startingGrid = GamePlay.gpSectorName(actorPos.x, actorPos.y).ToString();
            
stats.sortieBegin(player, actor, placeIndex, actorPos, startingGrid);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnPlaceEnter - Exception: " + ex);
        }
        
#endregion
        //add your code here
    
}


    public 
override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
    {
        
#region stats
        
base.OnPlaceLeave(player, actor, placeIndex);
        try
        {
            
stats.sortieEnd(player, actor, placeIndex);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnPlaceLeave - Exception: " + ex);
        }

        
#endregion
        //add your code here
        
    
}

    public 
override void OnAircraftCrashLanded (int missionNumber, string shortName, AiAircraft aircraft)
    {
        
#region stats
        
base.OnAircraftCrashLanded (missionNumber, shortName, aircraft);
        try
        {
            
Point2d actorPos = new Point2d(aircraft.Pos().x, aircraft.Pos().y);
            
String gridRef = GamePlay.gpSectorName(actorPos.x, actorPos.y).ToString();
            
stats.aircraftLanded("CrashLanded", shortName, aircraft, actorPos, gridRef);
            
System.Console.WriteLine("Stats.OnAircraftCrashLanded - ("+shortName+")");
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnAircraftCrashLanded - Exception: " + ex);
        }
        
#endregion
        //add your code here
        
      
}

    public 
override void OnAircraftTookOff(int missionNumber, string shortName, AiAircraft aircraft)
    {
        
#region stats
        
base.OnAircraftTookOff(missionNumber, shortName, aircraft);
        try
        {
            
stats.aircraftTakeoff(shortName, aircraft);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnAircraftTookOff - Exception: " + ex);
        }
        
#endregion
        //add your code here

     
}

      
    public 
override void OnAircraftLanded (int missionNumber, string shortName, AiAircraft aircraft)
    {
          
#region stats
          
base.OnAircraftLanded(missionNumber, shortName, aircraft);
            try
            {
              
Point2d actorPos = new Point2d(aircraft.Pos().x, aircraft.Pos().y);
             
String gridRef = GamePlay.gpSectorName(actorPos.x, actorPos.y).ToString();
             
stats.aircraftLanded("Landed", shortName, aircraft, actorPos, gridRef);
            }
            catch (
Exception ex)
            {
            
System.Console.WriteLine("Stats.OnAircraftTookOff - Exception: " + ex);
            }
          
#endregion
          //add your code here
         
          
    
}

    public 
override void OnActorDamaged(int missionNumber, string shortName, AiActor actor, AiDamageInitiator initiator, NamedDamageTypes damageType)
    {
        
#region stats
        
base.OnActorDamaged(missionNumber, shortName, actor, initiator, damageType);
        try
        {
            
stats.missionActorDamaged(shortName, actor, initiator, damageType);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnActorDamaged - Exception: " + ex);
        }
        
#endregion
        //add your code here

    
}

    public 
override void OnAircraftDamaged(int missionNumber, string shortName, AiAircraft aircraft, AiDamageInitiator initiator, NamedDamageTypes damageType)
    {
        
#region stats
        
base.OnAircraftDamaged(missionNumber, shortName, aircraft, initiator, damageType);
        try
        {
            
stats.missionAircraftDamaged(shortName, aircraft, initiator, damageType);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnAircraftDamaged - Exception: " + ex);
        }
        
#endregion
        //add your code here

    
}

    public 
override void OnAircraftCutLimb(int missionNumber, string shortName, AiAircraft aircraft, AiDamageInitiator initiator, LimbNames limbName)
    {
        
#region stats
        
base.OnAircraftCutLimb(missionNumber, shortName, aircraft, initiator, limbName);
        try
        {
            
stats.missionAircraftCutLimb(shortName, aircraft, initiator, limbName);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnAircraftCutLimb - Exception: " + ex);
        }
        
#endregion
        //add your code here
    
}

    public 
override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
    {
        
#region stats
        
base.OnActorDead(missionNumber, shortName, actor, damages);
        try
        {
             
stats.missionActorDead(shortName, actor, damages); 
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnActorDead - Exception: " + ex);
        }
        
#endregion
        //add your code here

    
}

    public 
override void OnActorDestroyed(int missionNumber, string shortName, AiActor actor)
    {
        
#region stats
        
base.OnActorDestroyed(missionNumber, shortName, actor);
        try
        {
            
stats.actorDestroyed(shortName, actor);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnActorDestroyed - Exception: " + ex);
        }
        
#endregion
        //add your code here

    
}
    public 
override void OnAircraftKilled(int missionNumber, string shortName, AiAircraft aircraft)
    {
        
#region stats
        
base.OnAircraftKilled(missionNumber, shortName, aircraft);
        try
        {
            
stats.aircraftKilled(shortName, aircraft);
        }
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnAircraftKilled - Exception: " + ex);
        }
        
#endregion
        //add your code here

    
}

    public 
override void OnBattleStoped()
    {
        
#region stats
        
base.OnBattleStoped();
        try
        {
            
stats.battleStopped();
            
// Loop through list of AiActors and destroy them all
            
List<string> keys = new List<string>(allActors.Keys);
            for (
int i = 0; i < keys.Count; i++)
            {
                
AiActor a = allActors[keys[i]];
                
AiAircraft aircraft = a as AiAircraft;
                if (
aircraft != null)
                {
                    
aircraft.Destroy();
                }
                else
                {
                    
AiGroundActor aiGroundActor = a as AiGroundActor;
                    if (
aiGroundActor != null)
                    {
                        
aiGroundActor.Destroy();
                    }
                    else
                    {
                        
System.Console.WriteLine("Stats.OnBattleStoped - Unknown Actor (" + a.Name()+") ShortName ("+keys[i]+")");
                    }
                }
            }
           
// stats.disconnectStats();
        
}
        catch (
Exception ex)
        {
            
System.Console.WriteLine("Stats.OnBattleStoped - Exception: " + ex);
        }
        
#endregion
        //add your code here
    
}
//////////////////////////////////////////////////////////////////////////////////////////////////


 
} 

[/PHP]


All times are GMT. The time now is 02:34 AM.

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