![]() |
|
|||||||
| CoD Multiplayer Everything about multiplayer in IL-2 CoD |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Quote:
using maddox.game.world; public void DestroyAllActors() { for each AiActor a in maddox.game.world { a.destroy(); } }
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash. Get the latest COD Team Fusion patch info HERE |
|
#2
|
|||
|
|||
|
Sorry, I do not have a script which destroys all actors (never used it) but there are some examples in a sticky thread in the FMB section. E.g. I did a timeout OnActorCreated to destroy ground actors in some time.
Last edited by Ataros; 11-27-2011 at 04:16 PM. |
|
#3
|
|||
|
|||
|
Salmo -
This is what I use to destroy actors between missions: 1st create a list to store all the objects at the top of the mission script: Code:
private Dictionary<String, AiActor> allActors = new Dictionary<String, AiActor>(); Code:
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
}
Finally I use the OnBattleStopped trigger to destroy any Actors which have not already been destroyed. Code:
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]+")");
}
}
}
}
catch (Exception ex)
{
System.Console.WriteLine("Stats.OnBattleStoped - Exception: " + ex);
}
#endregion
//add your code here
}
WildWillie |
![]() |
| Thread Tools | |
| Display Modes | |
|
|