Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   Organising flights in a multisquad campaign. (http://forum.fulqrumpublishing.com/showthread.php?t=30979)

FG28_Kodiak 04-11-2012 02:32 PM

Ok Problem, there are callsighn?? ogg present, but if i try to play them via SayToGroup nothing happens. :(
So it seems it's better to wait for the next patch, hope the problem is solved.

Osprey 04-11-2012 03:45 PM

I think that customising sounds to individuals may be a step too far for now, the existing sounds seem to have most of the comments needed to piece together a decent instruction. I'll write up some design/requirements and example scenarios in which existing logic could be used to create those instructions. I think we could start with some basic vocal instruction and extend the logic in pieces to improve the description as that is proven out.

I need a chat with Farber about his requirements from a German pilot perspective. We need to be careful here, and I'm not trying to gain advantage for the RAF BUT it should be noted that in 1940 it was not possible for German fighter pilots to talk on radios to German bomber crews because they had completely different sets and 'crystals'. This is explained in Ulrich Stienhilpers book "Spitfire on my Tail" who was responsible for radio comms for his squadron. Of course I am open to correction on this, and I'm keen to learn about any use of German radar in directing fighter squadrons - again I don't think there was any, they used radar for attack eg finding ships to target in the Channel.

5./JG27.Farber 04-11-2012 03:51 PM

No, fighters could not communicate with bombers and niether will we, as most if not all will be AI.

FG28_Kodiak 04-11-2012 04:23 PM

Argh sometimes i could the devs ... :grin:

Callsigns work, the oggs are called callsign1 .. etc. but you must write CallSign1 in code :rolleyes:

Osprey 04-11-2012 04:36 PM

You can't use a variable or parameter?

FG28_Kodiak 04-11-2012 04:49 PM

Yes i can, but i must it 'translate' it somewhere. :rolleyes:

Ok try of a 'connect' - communication (use the mission-menu ;)):

Code:

using System;
using System.Collections;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
using maddox.GP;


public class Mission : AMission
{
    #region class Menu
   
    internal class Menu
    {
        internal class MenuEntry
        {
            internal string MenuName { get; set; }
            internal bool active { get; set; }
        }

        internal List<MenuEntry> menuEntries = new List<MenuEntry>();

        public void AddMenuEntry(string description, bool active)
        {
            MenuEntry NewMenuEntry = new MenuEntry();

            NewMenuEntry.MenuName = description;
            NewMenuEntry.active = active;

            menuEntries.Add(NewMenuEntry);
        }

        public string[] GetMenuDescriptions()
        {
            List<string> Descriptions = new List<string>();

            menuEntries.ForEach(item =>
            {
                Descriptions.Add(item.MenuName);
            });

            return Descriptions.ToArray();
        }

        public bool[] GetActives()
        {
            List<bool> Actives = new List<bool>();

            menuEntries.ForEach(item =>
            {
                Actives.Add(item.active);
            });

            return Actives.ToArray();
        }

        public bool IsValid()
        {
            if (menuEntries == null || menuEntries.Count < 1)
                return false;
            else
                return true;

        }

    }

    #endregion


    internal class Pilot
    {
        public Player player { get; set; }
        public LocalHeadquarters connectedHeadquarter;

        public Pilot(Player player)
        {
            this.player = player;
        }
    }


    internal List<Pilot> PilotsInGame = new List<Pilot>();


    internal class LocalHeadquarters
    {
        public string Name { get; set; }
        public Point2d LocationCoords { get; set; }
        public string Callsign { get; set; }
        public List<string> AttachedSectors = new List<string>();

        public LocalHeadquarters(string name, string callsign, double x, double y)
        {
            this.Name = name;
            this.Callsign = callsign;
            this.LocationCoords = new Point2d(x, y);
        }
    }


    List<LocalHeadquarters> Headquarters = new List<LocalHeadquarters>{
        {new LocalHeadquarters("Luton", "CallSign24", 100.0, 100.0)},
        {new LocalHeadquarters("RadPoe", "CallSign32", 200.0, 200.0)},
        {new LocalHeadquarters("Forest", "CallSign15", 300.0, 300.0)},
        {new LocalHeadquarters("Bearskin", "CallSign5", 400.0, 400.0)}};



    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);


        if (!PilotsInGame.Exists(item => item.player == player))
        {
            PilotsInGame.Add(new Pilot(player));
        }

        GamePlay.gpLogServer(null, "Callsign: {0}", new[] { (actor as AiAircraft).CallSign() });

        SetMainMenu(player);
    }


    private void connectToHeadquarterSpeech(AiAircraft aircraft, LocalHeadquarters localHQ)
    {
        double initTime = 0.0;

        aircraft.SayToGroup(aircraft.AirGroup(), "Hello_guys");

        Timeout(initTime += 2, () =>
            {
                aircraft.SayToGroup(aircraft.AirGroup(), "This_is");
            });

        Timeout(initTime += 2, () =>
        {
            aircraft.SayToGroup(aircraft.AirGroup(), localHQ.Callsign);
        });

       
        // to is missing as ogg


        Timeout(initTime += 2, () =>
        {
            aircraft.SayToGroup(aircraft.AirGroup(), aircraft.CallSign());
        });

       

        Timeout(initTime += 2, () =>
        {
            aircraft.SayToGroup(aircraft.AirGroup(), "leader__");
        });


    }


   
    public void SetMainMenu(Player player)
    {
        if (player.Army() == 1) // red Side
            GamePlay.gpSetOrderMissionMenu(player, false, 0, new string[] { "Radaroperations" }, new bool[] { true });
        else
            GamePlay.gpSetOrderMissionMenu(player, false, 0, new string[] { "Not Available" }, new bool[] { true });
    }


    public void SetRadarMenu(Player player)
    {
        string headQuarter = "Select Headquarter";
        string connectedTo = "";

        if (PilotsInGame.Exists(item => item.player == player))
        {
            int i = PilotsInGame.FindIndex(item => item.player == player);

            if (PilotsInGame[i].connectedHeadquarter != null)
                connectedTo = string.Format(" (connected: {0})", PilotsInGame[i].connectedHeadquarter.Name);
        }
        headQuarter += connectedTo;

        GamePlay.gpSetOrderMissionMenu(player, true, 100, new string[] { headQuarter, "Get Radar Information" }, new bool[] { true, true });

    }


    public void SetConnectToHeadquarterMenu(Player player)
    {
        Menu NewMenu = new Menu();
        LocalHeadquarters headQuarter = null;

        if (PilotsInGame.Exists(item => item.player == player))
        {
            int i = PilotsInGame.FindIndex(item => item.player == player);
            headQuarter = PilotsInGame[i].connectedHeadquarter;
        }

        Headquarters.ForEach(item =>
        {
            if (headQuarter != null && item == headQuarter)
            {
                NewMenu.AddMenuEntry(item.Name + " *", true);
            }
            else
                NewMenu.AddMenuEntry(item.Name, true);
        });

        if (NewMenu.IsValid())
            GamePlay.gpSetOrderMissionMenu(player, true, 101, NewMenu.GetMenuDescriptions() , NewMenu.GetActives());
        else
            GamePlay.gpSetOrderMissionMenu(player, true, 101, new string[]{ "Not available" }, new bool[]{true});
    }


    public void SetHeadQuarter(Player player, int menuItemIndex)
    {
        if (PilotsInGame.Exists(item => item.player == player))
        {
            int i = PilotsInGame.FindIndex(item => item.player == player);
            PilotsInGame[i].connectedHeadquarter = Headquarters[menuItemIndex-1];
            if (player.Place() != null)
                connectToHeadquarterSpeech((player.Place() as AiAircraft), PilotsInGame[i].connectedHeadquarter);
        }

    }


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


        if (ID == 0)
        { // main menu
            if (menuItemIndex == 1)
            {
                SetRadarMenu(player);
            }
            //if (menuItemIndex == 2)
            //{


            //}
            //if (menuItemIndex == 3)
            //{


            //}
        }


        if (ID == 100)
        {
            //Radar Menu
            if (menuItemIndex == 1)
            {
                SetConnectToHeadquarterMenu(player);
            }

            if (menuItemIndex == 2)
            {
                SetMainMenu(player);
            }


            if (menuItemIndex == 0)
                SetMainMenu(player);
        }

        if (ID == 101)
        {
            //Radar Menu
            if (menuItemIndex == 0)
                SetRadarMenu(player);
            else
            {
                SetHeadQuarter(player, menuItemIndex);
                SetRadarMenu(player);
            }
        }
    }
}


Osprey 04-11-2012 04:54 PM

Oooo you're working ahead of me :) This looks interesting, when I get back from football I'll run it up in VS and try it in a dedicated server. Do I need any special map set up so it knows about the sectors?

FG28_Kodiak 04-11-2012 04:57 PM

Do you will script this by your own? - No problem i 've some other scriptwork to do. :rolleyes:
At the moment it's only a test for communication, nor other features like sectors implemented.

Osprey 04-11-2012 07:05 PM

No no, I am rubbish at writing the code myself because I am not trained properly. I can only read it and understand it usually, and write basic logic.

I would just like to offer help with getting this working, I think a lot of people would find 'realistic radar' quite useful :)

_79_dev 04-11-2012 08:15 PM

Latest script for menu is up on server, ready to be tested... thanks Kodiak... Conect here http://www.5jg27.net/


All times are GMT. The time now is 03:02 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.