![]() |
|
#1
|
|||
|
|||
|
Hi all,
this used to work but now it is not. any ideas on how to fix? Below code is in the .mis file that items the stationary objects i want to remove after 58 minutes. Code:
[Stationary] Static5 Stationary.Environment.FuelDrum_GER1_9 de 296598.06 217104.48 0.00 Static4 Stationary.Environment.FuelDrum_GER1_9 de 296582.91 217086.94 0.00 Static3 Stationary.Environment.FuelDrum_GER1_9 de 296562.56 217080.95 0.00 Static2 Stationary.Environment.FuelDrum_GER1_9 de 295859.16 217662.86 0.00 Static1 Stationary.Environment.FuelDrum_GER1_9 de 295877.09 217695.95 0.00 Static0 Stationary.Environment.FuelDrum_GER1_9 de 295899.00 217686.78 0.00 Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
using System.Diagnostics;
public class Mission : AMission
{
Stopwatch MissionTimer1M1 = new Stopwatch();
bool ReStart = false;
public override void Init(ABattle battle, int missionNumber)
{
base.Init(battle, missionNumber);
GamePlay.gpLogServer(null, "Mission 1 Loaded ", new object[] { }); //test Message
//MissionNumberListener = -1;
MissionTimer1M1.Reset();
MissionTimer1M1.Start();
}
public override void OnTickGame()
{
base.OnTickGame();
if (Time.tickCounter() % (32 * 30 * 1) == 0) // every 30sec repeat, (32 ticks a sec x 60 sec * 1 mins)
{
if (MissionTimer1M1.Elapsed.Minutes >= 59)
MissionTimer1M1.Stop();
}
}
//Section to remove AI after 58 mins
public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
{
base.OnActorCreated(missionNumber, shortName, actor);
if (actor is AiGroundActor) // 3599 = 58 mins
Timeout(3599, () =>
{
if (actor != null)
{ (actor as AiGroundActor).Destroy(); }
});
}
}
__________________
__________________ Win7, 64bit Ultra Asus P8P67Pro MB Intel i7-2600K Coursair 16GB (4x 4GB), DDR3-1600MHz Gainward Nvidia 580GTX 3GB DDR5 850-Watt Modular Power Supply WIN7 and COD on Gskill SSD 240GB 40" Panasonic LCD TrackIR5 + Thrustmaster Warthog stick, throttle & pedals |
|
|