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 06-19-2012, 01:46 PM
David198502's Avatar
David198502 David198502 is offline
Approved Member
 
Join Date: Dec 2009
Location: Austria
Posts: 1,536
Default how to trigger the big yellow messages?

i have a training mission, where both sides have a restricted plane amount for their spawn areas(20 planes).
now i want that if one of both spawn areas has only 10 planes left, that a message pops up, warning the team just like "team red only 10 planes left"(although i would like to have this message visible for everybody)
and i want another message to pop up, when eventually one spawn area has all available plane used and when all planes of one side are destroyed just like "team blue has lost the war"

Edit: ok i just found out, that the limit of planes of a spawn area doesnt seem to work...
i restricted one spawn area to only 1 plane, but i could spawn several times from the same area without problems
__________________

Last edited by David198502; 06-19-2012 at 02:26 PM.
Reply With Quote
  #2  
Old 06-19-2012, 03:28 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

The number of planes is for how many planes a player can create at the same time.
Reply With Quote
  #3  
Old 06-19-2012, 03:59 PM
David198502's Avatar
David198502 David198502 is offline
Approved Member
 
Join Date: Dec 2009
Location: Austria
Posts: 1,536
Default

ah ok....is it then possible, to give a spawnerea a certain amount of planes?
__________________
Reply With Quote
  #4  
Old 06-19-2012, 04:10 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

äh yes you can destroy it. So it vanished from Map. Or destroy the new created planes instantly or block the planes via Player.PlaceLeave.
Reply With Quote
  #5  
Old 06-19-2012, 04:39 PM
David198502's Avatar
David198502 David198502 is offline
Approved Member
 
Join Date: Dec 2009
Location: Austria
Posts: 1,536
Default

Quote:
Originally Posted by FG28_Kodiak View Post
äh yes you can destroy it. So it vanished from Map. Or destroy the new created planes instantly or block the planes via Player.PlaceLeave.
thx Kodiak for your answer....but unfortunately i am way too stupid regarding scripting to make any use of this by myself, as you probably already noticed a while ago...
vanishing from the map, would be a fancy solution for this i think, coupled with a message that the opposite team won. but i guesss i would need your help for that...

Edit:
i would like to have this function included in my already excisting script:


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


public class Mission : AMission
{
    Stopwatch MissionTimer = new Stopwatch();

    public override void OnBattleStarted()
    {
        base.OnBattleStarted();
        MissionTimer.Start();
        MissionNumberListener = -1;
    }
   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":
                case "bob:Aircraft.BlenheimMkIV":

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

    public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftCrashLanded(missionNumber, shortName, aircraft);


        if(IsActorDestroyable(aircraft))
            aircraft.Destroy();
    }


    public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftLanded(missionNumber, shortName, aircraft);

        if (IsActorDestroyable(aircraft))
            aircraft.Destroy();
    }


    private bool IsActorDestroyable(AiActor actor)
    {
        bool actorDestroyable = true;

        //Check if actor is empty (no Player)
        if (actor is AiAircraft)
        {
            if ((actor as AiAircraft).ExistCabin(0))
                for (int i = 0; i < (actor as AiAircraft).Places(); i++)
                {
                    if ((actor as AiAircraft).Player(i) != null)
                    {
                        actorDestroyable = false;
                        break;
                    }
                }
        }
        else if (actor is AiGroundActor)
        {
            if ((actor as AiGroundActor).ExistCabin(0))
                for (int i = 0; i < (actor as AiGroundActor).Places(); i++)
                {
                    if ((actor as AiGroundActor).Player(i) != null)
                    {
                        actorDestroyable = false;
                        break;
                    }
                }
        }

        return actorDestroyable;
    }

// to remove GroundActors after their Task is completed
   public override void OnActorTaskCompleted(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorTaskCompleted(missionNumber, shortName, actor);

        if (actor is AiGroundActor)
            if (IsActorDestroyable(actor))
                (actor as AiGroundActor).Destroy(); 
    }

    public int GetSumAllPlanes()
    {
        int planeCount = 0;
        List<AiAirGroup> allAirgroups = new List<AiAirGroup>();

        if (GamePlay.gpAirGroups(1) != null)
            allAirgroups.AddRange(GamePlay.gpAirGroups(1));

        if (GamePlay.gpAirGroups(2) != null)
            allAirgroups.AddRange(GamePlay.gpAirGroups(2));


        allAirgroups.ForEach(item =>
            {
                foreach (AiAircraft ac in item.GetItems())
                {
                    planeCount++;
                }
            });

        return planeCount;
    }

public override void OnTickGame()
    {
    
        if(MissionTimer.Elapsed.TotalSeconds >= 130 && GetSumAllPlanes() < 30)  //Loads a mission every 130s and only if the sum of all planes < 30
        {
            Random ZufaelligeMission = new Random();

            MissionTimer.Restart(); // Sets timer to 0 and start again
    
            switch (ZufaelligeMission.Next(34,35))
            {
                case 1:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission1.mis");
                    break;
                case 2:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission2.mis");
                    break;
                case 3:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission3.mis");
                    break;
                case 4:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission4.mis");
                    break;
                case 5:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission5.mis");
                    break;
                case 6:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission6.mis");
                    break;
                case 7:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission7.mis");
                    break;
                case 8:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission8.mis");
                    break;
                case 9:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission9.mis");
                    break;
                case 10:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission10.mis");
                    break;
                case 11:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission11.mis");
                    break;
                case 12:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission12.mis");
                    break;
                case 13:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission13.mis");
                    break;
                case 14:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission14.mis");
                    break;
                case 15:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission15.mis");
                    break; 
                case 16:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission16.mis");
                    break;
                case 17:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission17.mis");
                    break;
                case 18:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission18.mis");
                    break;
                case 19:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission19.mis");
                    break;
                case 20:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission20.mis");
                    break;
                case 21:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission21.mis");
                    break;
                case 22:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission22.mis");
                    break;
                case 23:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission23.mis");
                    break;
                case 24:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission24.mis");
                    break;
                case 25:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission25.mis");
                    break;
                case 26:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission26.mis");
                    break;
                case 27:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission27.mis");
                    break;
                case 28:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission28.mis");
                    break;
                case 29:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission29.mis");
                    break;
                case 30:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission30.mis");
                    break;
                case 31:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission31.mis");
                    break;
                case 32:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission32.mis");
                    break;
                case 33:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission33.mis");
                    break;
                case 34:
                    GamePlay.gpPostMissionLoad("missions\\Blitzkrieg\\mission34.mis");
                    break;

            }
        }
    }
}

and maybe with the function included, that after one side has shot down a certain amount of AI planes(bombers), no bombers will spawn anymore....

i know i somehow ask for much, and if its sounding demanding in a way, i apologize, i can fully understand if you have better things to do
__________________

Last edited by David198502; 06-19-2012 at 04:49 PM.
Reply With Quote
  #6  
Old 06-20-2012, 11:05 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Hm saw your edit to late, so i created a mission (in attachment) without your new wishes.
Next time you should create a new post, so i see if there is anything new.
Attached Files
File Type: zip BirthPlaceLimits.zip (2.1 KB, 7 views)
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 09:38 AM.


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