Thread: Eagle Campaign
View Single Post
  #4  
Old 09-26-2011, 10:23 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

You can add this code to a script:

Code:
using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{

    private void setMainMenu(Player player)
    {
        GamePlay.gpSetOrderMissionMenu(player, false, 0, new string[] { "Start Airgroup Engines" }, new bool[] { true });
    }

    public override void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex)
    {
        base.OnOrderMissionMenuSelected(player, ID, menuItemIndex);

        if (ID == 0) // main menu
        {
            if (menuItemIndex == 1)  // Start Airgroup Engines
            {
                GamePlay.gpLogServer(null, "Start Engines", null); // Controlmessage
                GamePlay.gpPlayer().Place().Group().Idle = false;
            }
        }
    }


    public override void Inited()
    {
        setMainMenu(GamePlay.gpPlayer());
    }
    
    
    public override void OnBattleStarted()
    {
        base.OnBattleStarted();

        MissionNumberListener = -1;

        GamePlay.gpPlayer().Place().Group().Idle = true;
    }
}
With this you can give a "Start Airgroup Engines" - Command via the communication menu. 4.Mission -> 1. Start Airgroup Engines.

Little Explanation with
GamePlay.gpPlayer().Place().Group().Idle you can set the player Airgroup to Idle (true) or active (false).
So at the beginning i set the player airgroup to idle (true).
And add a entry to the mission menu, so the player can activate the airgroup manually.

This Script works in singleplayer and with actual beta (needs GamePlay.gpSetOrderMissionMenu and OnOrderMissionMenuSelected(..) ).

Last edited by FG28_Kodiak; 09-26-2011 at 10:35 AM.
Reply With Quote