![]() |
#1
|
|||
|
|||
![]()
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? ![]() ![]() |
#2
|
|||
|
|||
![]()
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.
|
#3
|
|||
|
|||
![]()
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 |
#4
|
|||
|
|||
![]()
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(); } } } |
#5
|
|||
|
|||
![]() PHP Code:
__________________
![]() 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. |
#6
|
|||
|
|||
![]()
Which errormessage? Without i can't say where the problem is.
|
#7
|
|||
|
|||
![]() PHP Code:
PHP Code:
__________________
![]() 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 |
#8
|
|||
|
|||
![]()
and thats how it looks together
PHP Code:
__________________
![]() 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 |
#9
|
|||
|
|||
![]()
So if I remove
PHP Code:
__________________
![]() 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 |
#10
|
|||
|
|||
![]()
Just a note regarding Burmuda Triangle planes vanishing.
If you use OnTaskComplete as trigger to despawn or other function. If then another actor crosses the final path of another actor(between the 2nd last point and last point) or is near final point, the actor crossing will trigger the OnTaskComplete for itself and the result of that trigger or function assigned to the path complete. I have been making sure I set a short final path which is off to the side if that actor is triggering a despawning. Last edited by Smokeynz; 04-02-2012 at 10:35 AM. |
![]() |
|
|