![]() |
|
![]() |
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
![]()
Yes OnActorTaskComplete sometimes have strange results (not triggered correctly). Additional problem is that it's not possible to get GetWay() on a Groundgroup to work, it's always returns null. So its not possible to check which Waypoint is reached.
![]() |
#12
|
||||
|
||||
![]()
ah ok thats why.....
damn it, i really hope that this is possible soon but thx for your answer |
#13
|
|||
|
|||
![]() Quote:
Hey David, I've written a solution for random life on the ground but it's collecting dust at the moment as I'm buzy writing "Fighter Command" (will be uses to simulate Chain Home and Observer corps in online sessions). I call the solution "Live Map" and if you're willing to be my tester I would love to send it to you. Currently it's written for offline use but I'm gonna upgrade it for online when I see it works as expected. Are you thinking online or single player for this? LiveMap works by loading and running "sub missions" as you fly over the country side. Most actors that gets activated below will get removed after a set time (I also couldn't get any even when they reached their last waypoint) to reduce workload. There's a few exceptions to that rule. Ships and trains do not get removed as they're much more visible and you'd expect to see them lumbering along somewhere if you return to the region some time after you saw them last. The solution means you'll need to piece together those sub missions for regions you intend to fly over. It's not alot of work and you only need to do it once. The sub missions just gets thrown into a sub folder and you're good to go. Let me know if you're interested.
__________________
Core i7 3930K @ 4.8GHz; 16Gb DDR3 (Vengeance); nVidia GTX580; OS disk: 150Gb 10000rpm; SIM disk: 300Gb 10000rpm; Windows 7 x64 Ultimate |
#14
|
||||
|
||||
![]()
hey moggel!
nice to see you on the forum as well! man i would love to be your crash test dummy! my main aim is, to make that work for a coop mission, but it would be fine for offline use as well first! regarding the submissions..... i would like to introduce some random life on ground in my mission, which generates flights out of a pool of submissions as well... my problem is mainly, that if i just put ground vehicles into my submissions, the longer the mission runs, the more vehicles will be on the ground, that in the end they are that many, that its not playable anymore because of performance decrease... have a look, this is my script.....right now, there are no moving ground object placed in the submissions, only in the main mission template, there are static objects, and a few ships(its the ACG map template).... HTML Code:
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using maddox.game; using maddox.game.world; public class Mission : AMission { Stopwatch MissionTimer = new Stopwatch(); public override void OnBattleStarted() { base.OnBattleStarted(); MissionTimer.Start(); MissionNumberListener = -1; } public override void OnActorCreated(int missionNumber, string shortName, AiActor actor) { base.OnActorCreated(missionNumber, shortName, actor); if (actor is AiAircraft) { switch ((actor as AiAircraft).InternalTypeName()) { case "bob:Aircraft.He-111P-2": case "bob:Aircraft.BlenheimMkIV": Timeout(3000, () => // Time in Seconds { (actor as AiAircraft).Destroy(); }); break; } } } public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft) { base.OnAircraftCrashLanded(missionNumber, shortName, aircraft); if(IsActorDestroyable(aircraft)) aircraft.Destroy(); } public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft) { base.OnAircraftLanded(missionNumber, shortName, aircraft); if (IsActorDestroyable(aircraft)) aircraft.Destroy(); } private bool IsActorDestroyable(AiActor actor) { bool actorDestroyable = true; //Check if actor is empty (no Player) if (actor is AiAircraft) { if ((actor as AiAircraft).ExistCabin(0)) for (int i = 0; i < (actor as AiAircraft).Places(); i++) { if ((actor as AiAircraft).Player(i) != null) { actorDestroyable = false; break; } } } else if (actor is AiGroundActor) { if ((actor as AiGroundActor).ExistCabin(0)) for (int i = 0; i < (actor as AiGroundActor).Places(); i++) { if ((actor as AiGroundActor).Player(i) != null) { actorDestroyable = false; break; } } } return actorDestroyable; } // to remove GroundActors after their Task is completed public override void OnActorTaskCompleted(int missionNumber, string shortName, AiActor actor) { base.OnActorTaskCompleted(missionNumber, shortName, actor); if (actor is AiGroundActor) if (IsActorDestroyable(actor)) (actor as AiGroundActor).Destroy(); } public int GetSumAllPlanes() { int planeCount = 0; List<AiAirGroup> allAirgroups = new List<AiAirGroup>(); if (GamePlay.gpAirGroups(1) != null) allAirgroups.AddRange(GamePlay.gpAirGroups(1)); if (GamePlay.gpAirGroups(2) != null) allAirgroups.AddRange(GamePlay.gpAirGroups(2)); allAirgroups.ForEach(item => { foreach (AiAircraft ac in item.GetItems()) { planeCount++; } }); return planeCount; } public override void OnTickGame() { if(MissionTimer.Elapsed.TotalSeconds >= 130 && GetSumAllPlanes() < 30) //Loads a mission every 130s and only if the sum of all planes < 30 { Random ZufaelligeMission = new Random(); MissionTimer.Restart(); // Sets timer to 0 and start again switch (ZufaelligeMission.Next(1,34)) { case 1: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission1.mis"); break; case 2: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission2.mis"); break; case 3: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission3.mis"); break; case 4: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission4.mis"); break; case 5: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission5.mis"); break; case 6: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission6.mis"); break; case 7: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission7.mis"); break; case 8: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission8.mis"); break; case 9: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission9.mis"); break; case 10: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission10.mis"); break; case 11: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission11.mis"); break; case 12: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission12.mis"); break; case 13: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission13.mis"); break; case 14: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission14.mis"); break; case 15: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission15.mis"); break; case 16: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission16.mis"); break; case 17: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission17.mis"); break; case 18: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission18.mis"); break; case 19: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission19.mis"); break; case 20: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission20.mis"); break; case 21: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission21.mis"); break; case 22: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission22.mis"); break; case 23: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission23.mis"); break; case 24: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission24.mis"); break; case 25: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission25.mis"); break; case 26: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission26.mis"); break; case 27: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission27.mis"); break; case 28: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission28.mis"); break; case 29: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission29.mis"); break; case 30: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission30.mis"); break; case 31: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission31.mis"); break; case 32: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission32.mis"); break; case 33: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission33.mis"); break; case 34: GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission34.mis"); break; } } } } Last edited by David198502; 06-18-2012 at 09:49 AM. |
#15
|
|||
|
|||
![]() Quote:
There's certainly room for improvement, especially in making the "life" appear more random, but my tests show they work quite fine. I don't think it's all that much code that needs to be modified to make it work on a server in the online context but I need to clean away the "dust" and get back into the code. I'll give it a look this week and send you my private e-mail so we can link up. ~S~ Mog
__________________
Core i7 3930K @ 4.8GHz; 16Gb DDR3 (Vengeance); nVidia GTX580; OS disk: 150Gb 10000rpm; SIM disk: 300Gb 10000rpm; Windows 7 x64 Ultimate |
#16
|
||||
|
||||
![]()
that sounds great moggel!
|
#17
|
|||
|
|||
![]() Quote:
![]() ![]() ![]()
__________________
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 |
![]() |
|
|