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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #31  
Old 10-16-2011, 06:39 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Ok, i see couldn't work

this is the main block:

Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

public class Mission : AMission
{


}
You must place your code between the two brackets { ... }

so you must place
public override void OnActorCreated(....)
{
.....
.....
}

and
public override void OnTickGame(...)
{
.....
.....
}
between the brackets.
Your fault was that you placed the OnActorCreated into the OntickGame and this is not allowed in C#.
Hint: Open your Clod Console and you will see error messages if anything goes wrong.

So should your code look like:
Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

public class Mission : AMission
{

    public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorCreated(missionNumber, shortName, actor);

        if (actor is AiAircraft)
        {
            switch ((actor as AiAircraft).InternalTypeName())
            {

                case "bob:Aircraft.He-111P-2":

                    Timeout(600, () =>    // Time in Seconds
                         {
                             (actor as AiAircraft).Destroy();
                         });
                    break;
            }
        }
    }




    public override void OnTickGame()
    {

        // loads the 1st sub-mission in 10 min and repeates it every 60 min.
        if (Time.tickCounter() % 10800 == 180) // 108000 = 60 min repeat. 1800 = 10 min delay. 
        // pls. note!!! the 1st figure above must be always larger than 2nd!
        {
            GamePlay.gpPostMissionLoad("missions/Single/mission1.mis");

            // prints message on screen after mission load
            GamePlay.gpHUDLogCenter("Hello, world! Mission1.mis loaded!");

            // prints message on screen in 10 minutes
            double initTime = 0.0;
            Timeout(initTime += 600, () =>
            {
                GamePlay.gpHUDLogCenter("10 minutes into the 1st mission! Wow! It works!!!");
            });

            // prints message on screen in 5 minutes
            Timeout(initTime += 300, () =>
            {
                GamePlay.gpHUDLogCenter("Wholy s.. it works!!!");
            });

        }

        // loads the 2nd sub-mission, etc. the same way
        if (Time.tickCounter() % 10800 == 1000) //  108000 = 60 min repeat, 54000 = 30 min delay. 
        {
            GamePlay.gpPostMissionLoad("missions/Single/mission2.mis");
            GamePlay.gpHUDLogCenter("Mission2.mis loaded!");
            double initTime = 0.0;
            Timeout(initTime += 600, () =>
             {
                 GamePlay.gpHUDLogCenter("Mission2 10 min message!");
             });

            Timeout(initTime += 300, () =>
               {
                   GamePlay.gpHUDLogCenter("Mission2 15 min message!");
               });
        }

        // loads the 3rd sub-mission
        if (Time.tickCounter() % 10800 == 2000) // 60 min repeat, 50 min delay 
        {
            GamePlay.gpPostMissionLoad("missions/Multi/Single/mission3.mis");
            GamePlay.gpHUDLogCenter("Mission3.mis loaded!");

            double initTime = 0.0;
            Timeout(initTime += 600, () =>
            {
                GamePlay.gpHUDLogCenter("Mission3 10 min message!");
            });
            Timeout(initTime += 300, () =>
            {
                GamePlay.gpHUDLogCenter("Now it really works! You are a genius! Have fun!");
            });
        }
    }
}
btw i've not tested the script in Clod so may be there are other errors are present, but normaly it should work.
Reply With Quote
 

Thread Tools
Display Modes

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 11:27 AM.


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