Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 04-01-2012, 11:14 AM
5./JG27.Farber 5./JG27.Farber is offline
Approved Member
 
Join Date: Aug 2011
Posts: 1,958
Default Ghosts and Bermuda Triangle Stuff

Late last night we were testing a new mission on our dedicated server. Our missions are modula, for example, we have spawns as one maps, ground objects as another which loads instantaneously, then air missions which load throughout the time the maps up for - Usually three of them. So anyway, we are waiting over one of the targets and nothing shows up... OK so we turn external views on. One of the air missions is set to load within two mins of the mission starting and it does.


So in external view I follow the bombers. I can see what I thought was the next flight in the distance, so I cycle through the blue air objects. I can get hold of them, then I notice they are comming back from england! The ones Im looking at are going to England! Its the same flight on the homeward leg! Then bamm the outward bound bombers fly into a warm hole and vanish! Then their future selves vanish aswell!

The same thing happens with the next bombers.

ok what makes aircraft vanish - The despawn script! We removed it and there were no ghosts and the bombers went on their merry way...

This actually took 4 hours!


Anyone else had simular things happen?
Reply With Quote
  #2  
Old 04-01-2012, 02:00 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Yes i know this problem, best way to avoid this, is to store the Actors in a list (via OnActorCreator) and destroy the Actors with this list. Or to attach a landing Waypoint to the Aircraft and then destroy the Planes after landing.
Reply With Quote
  #3  
Old 04-01-2012, 02:09 PM
_79_dev _79_dev is offline
Approved Member
 
Join Date: Sep 2010
Location: Dublin
Posts: 242
Default

Any chance for OnActorCreator list script example Pleas...
__________________

Asus P6T V2 Deluxe, I7 930, 3x2 GB RAM XMS3 Corsair1333 Mhz, Nvidia Leadtek GTX 470, Acer 1260p screen projector, Track IR 4 OS ver5, Saitek Pro Flight Rudder, Saitek X52, Win 7 x64 ultimate
Reply With Quote
  #4  
Old 04-01-2012, 02:52 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

This i created for testing purposes:

Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using maddox.game;
using maddox.game.world;
using maddox.GP;


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


    #region Messages



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


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


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


    private void sendScreenMessage(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.gpHUDLogCenter(null, msg, args);
        else if (Consignees.Exists(item => item.Army() == army))
            GamePlay.gpHUDLogCenter(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
    }

    #endregion

    Stopwatch MissionTimer = new Stopwatch();


    internal InGameActors ActorList = new InGameActors();

    public override void OnBattleStarted()
    {
        base.OnBattleStarted();

        MissionNumberListener = -1;
        
        //GamePlay.gpPostMissionLoad("missions/Tests/DestroyTestSub1.mis");

        MissionTimer.Start();
    }


    public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorCreated(missionNumber, shortName, actor);

        ActorList.Add(actor, missionNumber);
    }


    public override void OnActorDestroyed(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorDestroyed(missionNumber, shortName, actor);

        ActorList.Removeable(actor);


    }


    TimeSpan DestroyAfter = new TimeSpan(0, 1, 0); // Destroyafter set to one minute


    public override void OnTickGame()
    {
        base.OnTickGame();

        if (MissionTimer.Elapsed.TotalSeconds >= 10)
        {
            sendChatMessage("MissionNr: {0}", GamePlay.gpNextMissionNumber());


            //Point3d test = new Point3d(40128.09, 20605.83, 0);


            foreach (AiActor ac in ActorList.GetActors())
                sendChatMessage("Actor: {0}", ac.Name());


            //InGameGroundActors.DestroyActors(AiGroundActorType.Tank, AiGroundActorType.AAGun);

            ActorList.DestroyActors(-1);

            //InGameGroundActors.DestroyActors(1, AiGroundActorType.Artillery);

            //InGameGroundActors.DestroyActors(GamePlay.gpPlayer().Place().Pos(), 300.0);

            //if (GamePlay.gpNextMissionNumber() - 1 >0)
            //    InGameGroundActors.DestroyActors(GamePlay.gpNextMissionNumber() - 1);

            //GamePlay.gpPostMissionLoad("missions/Training/DestroyTestSub1.mis");

            sendChatMessage("-----------------");


            foreach (AiActor ac in ActorList.GetActors())
                sendChatMessage("Actor: {0}", ac.Name());

            MissionTimer.Reset();
        }
    }
}
Reply With Quote
  #5  
Old 04-02-2012, 08:18 AM
_79_dev _79_dev is offline
Approved Member
 
Join Date: Sep 2010
Location: Dublin
Posts: 242
Default

PHP Code:

    
#region Messages



    
private void sendChatMessage(string msgparams object[] args)
    {
        
GamePlay.gpLogServer(nullmsgargs);
    }


    private 
void sendChatMessage(Player playerstring msgparams object[] args)
    {
        if (
player != null)
            
GamePlay.gpLogServer(new Player[] { player }, msgargs);
    }


    private 
void sendChatMessage(int armystring msgparams object[] args)
    {
        List<
PlayerConsignees = new List<Player>();

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

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


    private 
void sendScreenMessage(string msgparams object[] args)
    {
        
GamePlay.gpHUDLogCenter(nullmsgargs);
    }


    private 
void sendScreenMessage(Player playerstring msgparams object[] args)
    {
        if (
player != null)
            
GamePlay.gpHUDLogCenter(new Player[] { player }, msgargs);
    }


    private 
void sendScreenMessage(int armystring msgparams object[] args)
    {
        List<
PlayerConsignees = new List<Player>();

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

        if (
army == -1)
            
GamePlay.gpHUDLogCenter(nullmsgargs);
        else if (
Consignees.Exists(item => item.Army() == army))
            
GamePlay.gpHUDLogCenter(Consignees.FindAll(item => item.Army() == army).ToArray(), msgargs);
    }

    
#endregion

    
Stopwatch MissionTimer = new Stopwatch();


    
internal InGameActors ActorList = new InGameActors();

    public 
override void OnBattleStarted()
    {
        
base.OnBattleStarted();

        
MissionNumberListener = -1;
        
        
//GamePlay.gpPostMissionLoad("missions/Tests/DestroyTestSub1.mis");

        
MissionTimer.Start();
    }


    public 
override void OnActorCreated(int missionNumberstring shortNameAiActor actor)
    {
        
base.OnActorCreated(missionNumbershortNameactor);

        
ActorList.Add(actormissionNumber);
    }


    public 
override void OnActorDestroyed(int missionNumberstring shortNameAiActor actor)
    {
        
base.OnActorDestroyed(missionNumbershortNameactor);

        
ActorList.Removeable(actor);


    }


    
TimeSpan DestroyAfter = new TimeSpan(010); // Destroyafter set to one minute


    
public override void OnTickGame()
    {
        
base.OnTickGame();

        if (
MissionTimer.Elapsed.TotalSeconds >= 10)
        {
            
sendChatMessage("MissionNr: {0}"GamePlay.gpNextMissionNumber());


            
//Point3d test = new Point3d(40128.09, 20605.83, 0);


            
foreach (AiActor ac in ActorList.GetActors())
                
sendChatMessage("Actor: {0}"ac.Name());


            
//InGameGroundActors.DestroyActors(AiGroundActorType.Tank, AiGroundActorType.AAGun);

            
ActorList.DestroyActors(-1);

            
//InGameGroundActors.DestroyActors(1, AiGroundActorType.Artillery);

            //InGameGroundActors.DestroyActors(GamePlay.gpPlayer().Place().Pos(), 300.0);

            //if (GamePlay.gpNextMissionNumber() - 1 >0)
            //    InGameGroundActors.DestroyActors(GamePlay.gpNextMissionNumber() - 1);

            //GamePlay.gpPostMissionLoad("missions/Training/DestroyTestSub1.mis");

            
sendChatMessage("-----------------");


            foreach (
AiActor ac in ActorList.GetActors())
                
sendChatMessage("Actor: {0}"ac.Name());

            
MissionTimer.Reset();
        }
    } 
This part o script is causing console errors with my original script. What is this part of script needed for except sending messages to console?
__________________

Asus P6T V2 Deluxe, I7 930, 3x2 GB RAM XMS3 Corsair1333 Mhz, Nvidia Leadtek GTX 470, Acer 1260p screen projector, Track IR 4 OS ver5, Saitek Pro Flight Rudder, Saitek X52, Win 7 x64 ultimate

Last edited by _79_dev; 04-02-2012 at 08:21 AM.
Reply With Quote
  #6  
Old 04-02-2012, 08:25 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Which errormessage? Without i can't say where the problem is.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:42 PM.


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