![]() |
|
#1
|
|||
|
|||
![]()
Was feeling keen so ,
I have taken the liberty to take your layout and make it how i would do it. This is an example of how I would do it, others will do it differently and by know means the be all end of examples. The example i am attempting to show is input areas for easy programe mods. I have also added messages to armys(from the collections at 1C) note how the early part of the setup is for all the mission naming and timing triggers for those missions to load, this means you dont have to alter the core of the script(potential errors) This layout means you can use the script for all mission sets by altering the the main cs name, file paths and mission names. You will also probably need to add despawning code for excess planes, something everyone ends up adding. I again have modified others coding for our own design and need. by all means try this layout, modify as desired. Code:
/**mymission.cs**/ //By king1hw //lastmod 13/1/2012 using System; using System.Collections; using maddox.game; using maddox.game.world; using maddox.GP; using System.Collections.Generic; using System.Diagnostics; public class Mission : AMission { /*=========================================*/ #region Mission paths and Inputs //Mission setup //1mins=60sec=1800ticks string MissionPath = "missions/channelv6/BM1/"; string Mis0 = "Practice.mis";//mission name string Msg0 = "The Battle of Britain is about to begin";//msg to all string Msg0r = "Intell German Bomber Raids Heading For Hawkinge";//to Allies string Msg0b = "Auctung Hurricanes !";//to axis //note, r value must be bigger than d value private int rt0 = 108000;//60 min repeat private int dt0 = 18000;//30 min delay. string Mis1 = "Practice1.mis";//mission name string Msg1 = "Bombers!"; string Msg1r = "Intell German Bomber Raids Heading For Lympne"; string Msg1b = "Escort Bombers to Lympne!"; private int rt1 = 108000;//60 min repeat private int dt1 = 54000;//50 min delay string Mis2 = "Practice2.mis";//mission name string Msg2 = "Bombers!";//to all string Msg2r = "Intell German Bomber Raids Heading For Manston/Ramsgate";//to Allies string Msg2b = "Escort Bombers to Ramsgate!";//to axis //note, r value must be bigger than d value private int rt2 = 108000;//60 min repeat private int dt2 = 90000;//90 min delay #endregion /*=========================================*/ /*=========================================*/ #region const's and params //Msg's To private const int All = -1; private const int Allies = 1; private const int Axis = 2; //listen to events from all missions. public override void OnBattleStarted() { base.OnBattleStarted(); MissionNumberListener = -1; } #endregion /*=========================================*/ /*=========================================*/ #region Main mission operation public override void OnTickGame() { base.OnTickGame(); //sub-mission loaders //tick counter mission loader types if (Time.tickCounter() % rt0 == dt0) { GamePlay.gpPostMissionLoad(MissionPath + Mis0); ScreenMsg(-1, Msg0); Timeout(2.0, () => { ScreenMsg(1, Msg0r); ScreenMsg(2, Msg0b); }); } if (Time.tickCounter() % rt1 == dt1) { GamePlay.gpPostMissionLoad(MissionPath + Mis1); ScreenMsg(-1, Msg1); Timeout(2.0, () => { ScreenMsg(1, Msg1r); ScreenMsg(2, Msg1b); }); } if (Time.tickCounter() % rt2 == dt2) { GamePlay.gpPostMissionLoad(MissionPath + Mis2); ScreenMsg(-1, Msg2); Timeout(2.0, () => { ScreenMsg(1, Msg2r); ScreenMsg(2, Msg2b); }); } } #endregion /*=========================================*/ /*=========================================*/ #region Messages to army /* Bits with it... private const int All = -1; private const int Allies = 1; private const int Axis = 2; ScreenMsg(-1, "Test to All"); ScreenMsg(1, "test to red"); ScreenMsg(2, "test to blue"); */ //object[] parms private void ScreenMsg(int army, string msg) { if (army != -1) { //Singleplayer (for Testing) if (GamePlay.gpRemotePlayers() == null || GamePlay.gpRemotePlayers().Length <= 0) { if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == army) GamePlay.gpHUDLogCenter(null, msg); } else // Multiplayer { List<Player> Players = new List<Player>(); foreach (Player p in GamePlay.gpRemotePlayers()) { if (p.Army() == army) Players.Add(p); } GamePlay.gpHUDLogCenter(Players.ToArray(), msg); } } else GamePlay.gpHUDLogCenter(null, msg); } #endregion /*=========================================*/ } //note the last bracket wraps Amission Last edited by Smokeynz; 01-12-2012 at 09:13 PM. |
![]() |
|
|