View Single Post
  #5  
Old 02-27-2012, 12:29 AM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

The first part of my core is a simple timer to test time periods, intension is to edit out later but is there to check time mission has played. There is some error because of delays and it does not display every minute due to being overridden by mission loading text.

Now the core engine, note rt0 is repeat and dt0 is delay start, periods setup in previous code,
I set an “int” (interger) “i” as zero as a base of the random selection range, then call the SubM list through the classes input and it becomes SubMs, each mission in the list has its independent list number, this is the random range, zero =>number of missions in list(hence why nulls are important). A mission from the list is randomly selected then loaded, note mission path “MPsub +SubMs[i].MN”, “i” is the list number and MN is mission name, the following line is messages where it selects the mission and relative mission message, MM is mission message. I then wait 2 seconds and display messages to each team, MMR, message to red, MMB message to blue.

Code:
   /*=========================================*/

    #region Main mission operation

    public override void OnTickGame()
    {
        base.OnTickGame();

        /*=========================================*/
        /*    Server timer for mis time testing    */
        /*         rem out when not in use         */
        /*=========================================*/

        // Time. current() in seconds from Battle Start
        if (Time.current() >= ts)
        {
            GamePlay.gpHUDLogCenter("Elapsed Time:Min:" + ts / 60 + " Secs:" + ts + " Ticks:" + ts * 30);
            ts = ts + ts;
        }

        /*=========================================*/

        //tick counter mission random loader
       
        if (Time.tickCounter() % rt0 == dt0)
        {            
            int i = 0;
            if (SubMs.Count > 0)
                i = rand.Next(0, SubMs.Count);
            GamePlay.gpPostMissionLoad(MPsub + SubMs[i].MN);
            STxA(-1, SubMs[i].MM);  
            Timeout(2.0, () => { STxA(1, SubMs[i].MMR); STxA(2, SubMs[i].MMB); });
        }
        if (Time.tickCounter() % rt1 == dt1)
        {
            int i = 0;
            if (SubMs.Count > 0)
                i = rand.Next(0, SubMs.Count);
            GamePlay.gpPostMissionLoad(MPsub + SubMs[i].MN);
            STxA(-1, SubMs[i].MM);
            Timeout(2.0, () => { STxA(1, SubMs[i].MMR); STxA(2, SubMs[i].MMB); });
        }
        if (Time.tickCounter() % rt2 == dt2)
        {
            int i = 0;
            if (SubMs.Count > 0)
                i = rand.Next(0, SubMs.Count);
            GamePlay.gpPostMissionLoad(MPsub + SubMs[i].MN);
            STxA(-1, SubMs[i].MM);
            Timeout(2.0, () => { STxA(1, SubMs[i].MMR); STxA(2, SubMs[i].MMB); });
        }
        if (Time.tickCounter() % rt3 == dt3)
        {
            int i = 0;
            if (SubMs.Count > 0)
                i = rand.Next(0, SubMs.Count);
            GamePlay.gpPostMissionLoad(MPsub + SubMs[i].MN);
            STxA(-1, SubMs[i].MM);
            Timeout(2.0, () => { STxA(1, SubMs[i].MMR); STxA(2, SubMs[i].MMB); });
        }
    }
  
    #endregion

    /*=========================================*/

That is the core random engine, but I repeat these four times so as to have four timer periods which because of the timing sometimes happen at the same time. Note: messages that appear at the same will only show the last to load. Just one of those things, you could code around that if you wanted too.
So far the core operates quite well on its own without triggers and objectives, and on appearance in game behaves different every time I test it. This is even though in the test setup we have only 4 sub missions and 7 null missions. I anticipate having 50 or more in sub selection eventually with 50 nulls or something like that. Total user discretion.

Last edited by Smokeynz; 02-27-2012 at 12:40 AM.
Reply With Quote