![]() |
|
#1
|
|||
|
|||
![]()
Thanks, that is what I was afraid of...
|
#2
|
|||
|
|||
![]()
It totally blows! Two little fixes. Track destruction of Static Objects and Track destruction of pre-loaded objects (houses) on Maps. Then we can have fun with carpet bombing and attacking London and other cities without placing a Blue or Red static object within it to mimic destruction.
__________________
__________________ 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 |
#3
|
|||
|
|||
![]()
I have the following code in my current "work in progress" script
My intension was simple plane spawning limits and mission completion. The limitation works but mission completion has issues. However what I have found is relationships between various aspects. Destroyed can be killed or removed by various means. Killed is different to destroyed. I created the following so I could see what is going on. Doesnt really help objects though. Code:
/*=========================================*/ #region Resource Counters /*=========================================*/ int ActorsCreated; int ActorsCreatedLast; int ActorsDestroyed; int ActorsDestroyedLast; int ActorsDead; int ActorsDeadLast; int AircraftLanded; int AircraftLandedLast; int AircraftCrashed; int AircraftCrashedLast; int AircraftKilled; int AircraftKilledLast; int BlueActors; int BlueDOA; int BlueAircraftInService; int BlueAircraftLost; int BlueReserve;// = 300;//config list once setup int RedActors; int RedDOA; int RedAircraftInService; int RedAircraftLost; int RedReserve;// = 300; int PlaneLimit; //total aircraft in game at any one time private void ActorResources(AiActor actor) { if (ActorsCreated > ActorsCreatedLast) { if (actor.Army() == 1) { RedActors++; RedAircraftInService++; RedReserve--; } if (actor.Army() == 2) { BlueActors++; BlueAircraftInService++; BlueReserve--; } ActorsCreatedLast = ActorsCreated; } if (ActorsDestroyed > ActorsDestroyedLast) { if (actor.Army() == 1) { RedAircraftInService--; RedReserve++; } if (actor.Army() == 2) { BlueAircraftInService--; BlueReserve++; } ActorsDestroyedLast = ActorsDestroyed; } if (ActorsDead > ActorsDeadLast) { if (actor.Army() == 1) { RedAircraftInService--; RedDOA++; } if (actor.Army() == 2) { BlueAircraftInService--; BlueDOA++; } ActorsDeadLast = ActorsDead; } LimitPlanes(); } private void AircraftResources(AiAircraft aircraft) { if (AircraftLanded > AircraftLandedLast) { if (aircraft.Army() == 1) { RedAircraftInService--; RedReserve++; } if (aircraft.Army() == 2) { BlueAircraftInService--; BlueReserve++; } AircraftLandedLast = AircraftLanded; } if (AircraftCrashed > AircraftCrashedLast) { if (aircraft.Army() == 1) { RedAircraftInService--; RedAircraftLost++; //RedReserve--; } if (aircraft.Army() == 2) { BlueAircraftInService--; BlueAircraftLost++; //BlueReserve--; } AircraftCrashedLast = AircraftCrashed; } if (AircraftKilled > AircraftKilledLast) { if (aircraft.Army() == 1) { RedAircraftInService--; RedAircraftLost++; } if (aircraft.Army() == 2) { BlueAircraftInService--; BlueAircraftLost++; } AircraftKilledLast = AircraftKilled; } LimitPlanes(); } private void LimitPlanes() { if (RedAircraftInService > PlaneLimit) { rl = 1; gl = 3; GamePlay.gpLogServer(null, "Red Ingame limit reached: PlaneLimit:{0} InService:{1}", new object[] { PlaneLimit, RedAircraftInService }); } else { rl = 0; gl = 0; } if (BlueAircraftInService > PlaneLimit) { bl = 2; gl = 3; GamePlay.gpLogServer(null, "Blue Ingame limit reached: PlaneLimit:{0} InService:{1}", new object[] { PlaneLimit, BlueAircraftInService }); } else { bl = 0; gl = 0;} } public override void OnActorDestroyed(int missionNumber, string shortName, AiActor actor) { base.OnActorDestroyed(missionNumber, shortName, actor); if (actor != null) { if (actor is AiAircraft) { ActorsDestroyed++; ActorResources(actor); } } } public override void OnActorDead(int missionNumber, string shortName, AiActor actor, System.Collections.Generic.List<DamagerScore> damages) { base.OnActorDead(missionNumber, shortName, actor, damages); if (actor != null) { if (actor is AiAircraft) { ActorsDead++; ActorResources(actor); } } } public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft) { base.OnAircraftLanded(missionNumber, shortName, aircraft); if (aircraft != null) { AircraftLanded++; AircraftResources(aircraft); } } public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft) { base.OnAircraftCrashLanded(missionNumber, shortName, aircraft); if (aircraft != null) { AircraftCrashed++; AircraftResources(aircraft); } } public override void OnAircraftKilled(int missionNumber, string shortName, AiAircraft aircraft) { base.OnAircraftKilled(missionNumber, shortName, aircraft); if (aircraft != null) { AircraftKilled++; AircraftResources(aircraft); } } /*=========================================*/ #endregion /*=========================================*/ This goes in ticktimer section to report the results Code:
// Mission config collection cycle if (Time.tickCounter() % 1800 == 900) { GamePlay.gpLogServer(null, "-------------------------------------------------", null); GamePlay.gpLogServer(null, " [Overall Resources Count]", null); GamePlay.gpLogServer(null, " Actors:: Created:{0} Destroyed:{1} Dead:{2}", new object[] { ActorsCreated, ActorsDestroyed, ActorsDead }); GamePlay.gpLogServer(null, "Aircraft:: Landed:{0} Crashed:{1} Killed:{2}", new object[] { AircraftLanded, AircraftCrashed, AircraftKilled }); GamePlay.gpLogServer(null, "-------------------------------------------------", new object[] { }); GamePlay.gpLogServer(null, " [Blue Resources]", null); GamePlay.gpLogServer(null, " Pilots:: Actors:{0} DOA:{1}", new object[] { BlueActors, BlueDOA }); GamePlay.gpLogServer(null, "Aircraft:: InService:{0} Lost:{1} Reserve:{2}", new object[] { BlueAircraftInService, BlueAircraftLost, BlueReserve }); GamePlay.gpLogServer(null, "-------------------------------------------------", null); GamePlay.gpLogServer(null, " [Red Resources]", null); GamePlay.gpLogServer(null, " Pilots:: Actors:{0} DOA:{1}", new object[] { RedActors, RedDOA }); GamePlay.gpLogServer(null, "Aircraft:: InService:{0} Lost:{1} Reserve:{2}", new object[] { RedAircraftInService, RedAircraftLost, RedReserve }); GamePlay.gpLogServer(null, " ------------------------------------------------", null); } |
#4
|
|||
|
|||
![]()
@pilsner
You can "register" the destroying of a static object (not all, no house for example) only with TGroundDestroyed Trigger. So you must add a TGroundDestroyed to every static you wana check, at the moment. |
#5
|
|||
|
|||
![]()
Very helpful, Thanks!
![]() |
![]() |
|
|