![]() |
#1
|
|||
|
|||
![]()
I suspect this has already been accomplished, but I can not find it through Google or Forum Search so I figure I will ask here...
I have a mission.cs script that I have been using, it starts with the usual: Code:
using System; using System.Collections.Generic; using maddox.game; using maddox.game.world; using maddox.GP; public class Mission : maddox.game.AMission Code:
[Static] Stationary.Environment.JP3_Generator_15_KW_UK1 gb 178768.08 197313.52 105.00, 2 Artillery.3_inch_20_CWT_QF_Mk_I_StandAlone2 gb 136914.39 198372.09 -60.00, 2 Stationary.Ammo_Vehicles.3inch_QF_AA_composition3_UK1 nn 136921.30 198377.00 -90.00, 2 I would then like to use a separate script (my overall campaign.cs) to parse the file and use the list to not create static objects in the next mission. I used to do C programming (command line), but the object model of C# is taking me some time to wrap my head around. If someone could help me write the objects to a file I believe I have the skills to parse the file and use the data in my own (campaign) script. The reason I would like it in a mission script is because it is for single player use. Thanks, von Pilsner p.s. - I have read through the basic tutorials and script examples so if that is all you are able to suggest, I'm doing that right now... ![]() Last edited by von Pilsner; 05-23-2012 at 10:59 PM. |
#2
|
|||
|
|||
![]()
Destruction of actors (moving ships, vehicles, planes) can be tracked via the OnActorDestroyed method, but there's no method that exposes the destruction of statics objects.
__________________
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 |
#3
|
|||
|
|||
![]()
Thanks, that is what I was afraid of...
|
#4
|
|||
|
|||
![]()
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 |
#5
|
|||
|
|||
![]()
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); } |
#6
|
|||
|
|||
![]()
@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. |
#7
|
|||
|
|||
![]()
Very helpful, Thanks!
![]() |
![]() |
|
|