![]() |
|
#1
|
||||
|
||||
![]()
You can't use a variable or parameter?
|
#2
|
|||
|
|||
![]()
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. |
#3
|
||||
|
||||
![]()
Oooo you're working ahead of me
![]() |
#4
|
|||
|
|||
![]()
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. |
#5
|
||||
|
||||
![]()
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 ![]() |
#6
|
|||
|
|||
![]()
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 |
#7
|
|||
|
|||
![]()
A great help would be looking what oggs (and sequence) are usefull for communication. So i can 'translate' it direct in code.
|
#8
|
|||
|
|||
![]()
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. |
#9
|
||||
|
||||
![]() Quote:
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~ |
![]() |
|
|