Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 04-11-2012, 04:36 PM
Osprey's Avatar
Osprey Osprey is offline
Approved Member
 
Join Date: Jan 2010
Location: Gloucestershire, England
Posts: 1,264
Default

You can't use a variable or parameter?
Reply With Quote
  #2  
Old 04-11-2012, 04:49 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

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

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);
            }
        }
    }
}

Last edited by FG28_Kodiak; 04-11-2012 at 04:51 PM.
Reply With Quote
  #3  
Old 04-11-2012, 04:54 PM
Osprey's Avatar
Osprey Osprey is offline
Approved Member
 
Join Date: Jan 2010
Location: Gloucestershire, England
Posts: 1,264
Default

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?
Reply With Quote
  #4  
Old 04-11-2012, 04:57 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Do you will script this by your own? - No problem i 've some other scriptwork to do.
At the moment it's only a test for communication, nor other features like sectors implemented.
Reply With Quote
  #5  
Old 04-11-2012, 07:05 PM
Osprey's Avatar
Osprey Osprey is offline
Approved Member
 
Join Date: Jan 2010
Location: Gloucestershire, England
Posts: 1,264
Default

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
Reply With Quote
  #6  
Old 04-11-2012, 08:15 PM
_79_dev _79_dev is offline
Approved Member
 
Join Date: Sep 2010
Location: Dublin
Posts: 242
Default

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

Asus P6T V2 Deluxe, I7 930, 3x2 GB RAM XMS3 Corsair1333 Mhz, Nvidia Leadtek GTX 470, Acer 1260p screen projector, Track IR 4 OS ver5, Saitek Pro Flight Rudder, Saitek X52, Win 7 x64 ultimate
Reply With Quote
  #7  
Old 04-12-2012, 04:14 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Quote:
Originally Posted by Osprey View Post
I would just like to offer help with getting this working, I think a lot of people would find 'realistic radar' quite useful
A great help would be looking what oggs (and sequence) are usefull for communication. So i can 'translate' it direct in code.
Reply With Quote
  #8  
Old 04-12-2012, 06:07 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Kodiak,
Here's the speech file (text) with all the ogg phrases in various languages. http://www.freefilehosting.net/speech I'm trying to concatonate various phrases into sentences, without success at the moment. There must be a way, since the inj-game radar speech uses almost complete sentences from the ogg phrases.
__________________
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

Last edited by salmo; 04-12-2012 at 06:20 AM.
Reply With Quote
  #9  
Old 04-12-2012, 07:11 AM
Osprey's Avatar
Osprey Osprey is offline
Approved Member
 
Join Date: Jan 2010
Location: Gloucestershire, England
Posts: 1,264
Default

Quote:
Originally Posted by FG28_Kodiak View Post
A great help would be looking what oggs (and sequence) are usefull for communication. So i can 'translate' it direct in code.
I can give you a solution to a minor problem, in one of your scripts you said in comments that there was no "to.ogg" - just use the "2.ogg" instead since it is phonetically the same.


Really sorry I did nothing yesterday. I am changing ISP and since I told them I have been getting cut off every night

I have been looking at these and have some ideas on what needs to be said by the radio operator. For instance, I'm interested in the Point3D position of both aircraft, therefore for example

if(pilot.height < aiairgroup.height)
{
//use "climb.ogg" & "2.ogg" angels i;
}
else
{
//use "descend.ogg & "2.ogg" angels i;
}

There are also direction oggs such as "turn right.ogg" but I don't know how sophisticated this can be. Unless it is easy to work out interception vectors then that is probably too much work or a longer term project. It is not needed for now

I would like to know more about the sectors and how you intend to have this working. I have some input for this. There are a few important behaviour requirements for this if possible, briefly:

1. No aircraft reported under 600m (Chain Home Low min operating height)
2. RDF range as far as the French coast (and into France some 50 miles in the Pas De Calais area) A range map is available on Wikipedia

I have an idea for a 4 minute delay but it's probably complicated and not the first thing to implement. It would involve the radar constantly working behind in the script and storing 4 minute old data in variables, then releasing that to the user on request instead of current data. Perhaps if the RDF event fired every minute transparently and the resulting information string stored and passed on every minute into a new variable until the 4th minute, then this was accessed and played to the player. (hope that makes sense)

Speak later ~S~
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:48 PM.


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