![]() |
|
#1
|
|||
|
|||
![]()
Thanks FG28_Kodiak, do it and attach a 'script' copy.
DFLion |
#2
|
|||
|
|||
![]() Code:
using System; using maddox.game; using maddox.game.world; using System.Diagnostics; // for Stopwatch timer public class Mission : AMission { Stopwatch PlayerGroupIdleTimer = new Stopwatch(); const int PlayerAirgroupIdleTimeMinutes = 3; // 3 minutes for player to warm up his engine public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex) { base.OnPlaceEnter(player, actor, placeIndex); AiAircraft airc1 = (AiAircraft)GamePlay.gpPlayer().Place(); PlayerGroupIdleTimer.Start(); if (!airc1.IsAirborne()) { airc1.AirGroup().Idle = true; GamePlay.gpHUDLogCenter(player.Name() + " warm up your engine"); } } public override void OnTickGame() { base.OnTickGame(); //check mission timers if (PlayerGroupIdleTimer.Elapsed.Minutes >= PlayerAirgroupIdleTimeMinutes) { PlayerGroupIdleTimer.Reset(); //Set timer to 0 PlayerGroupIdleTimer.Stop(); AiAircraft airc1 = (AiAircraft)GamePlay.gpPlayer().Place(); airc1.AirGroup().Idle = false; } } } Last edited by FG28_Kodiak; 08-16-2011 at 09:09 AM. |
#3
|
|||
|
|||
![]()
Thanks for doing this Kodiak, I will experiment with this script and see what happens? Will give you some feedback as soon as possible.
DFLion |
#4
|
|||
|
|||
![]()
How are you Kodiak. I have combined your 'time script' with the 'mission sequencing script' and everything seems to be ok, although sometimes it is intermittent (it sometimes works and somestimes not).
Just to get the function of the script clear in my head. When you start the mission, your wingman and leader go straight onto autopilot, then they wait for three minutes before they take-off, giving you time to warm-up your engine. You then take-off when they take-off. Is my explanation right, on what you are trying to do with the script? With this three minute mission lag before takeoff, you have to adjust everything in the mission to occur 3 minutes later, for everything to coincide. Anyway, thankyou again for your help and if don't agree in what I am saying above, let me know. DFLion |
#5
|
|||
|
|||
![]() Quote:
AiAircraft airc1 = (AiAircraft)GamePlay.gpPlayer().Place(); Then i start the Stopwatch, you can use a trigger or Time.tickCounter() also, its only a example. PlayerGroupIdleTimer.Start(); Then check if plane is airborne (if it airborne its a bad idea to set it on idle ![]() if (!airc1.IsAirborne()) { If the plane is not airborne, i set the complete player airgroup on idle, it's the same you set the idle state in FMB airc1.AirGroup().Idle = true; then a short message for the player GamePlay.gpHUDLogCenter(player.Name() + " warm up your engine"); } later in OnTickGame i set the AirGroup().Idle = false; so the AI will make it's job ![]() |
#6
|
||||
|
||||
![]()
I see Mission Building is going to be for script experts only...how sad
![]() I used to enjoy maing short missions in 1946, this looks like computer coding, which for me is totally out of my league ![]() Good luck to you experts, cheers, MP
__________________
|
#7
|
|||
|
|||
![]()
I see no problem.
If you need a script for a mission simply ask. May be we need some scripting corner, to bring mission builders and coders together. |
#8
|
||||
|
||||
![]()
Hi Kodiak, thanks for the reply. I think the scripting, once the dedicated Mission and Campaign Builders get fully to grips with it, will be an incredible asset, it's just that for me and others who like to make something on the odd occasion, it looks like there is a huge learning curve which is a shame for coding/scripting novices. I am sure though, that as more is discovered, many requests will be made to the experts! Cheers, MP
__________________
|
#9
|
|||
|
|||
![]() Quote:
Good to see you on here MP, we are all working hard to get some good missions/campaigns working properly and it is a very steep learning curve without any official documentation! DFLion |
![]() |
|
|