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
  #7  
Old 06-20-2012, 11:39 AM
David198502's Avatar
David198502 David198502 is offline
Approved Member
 
Join Date: Dec 2009
Location: Austria
Posts: 1,536
Default

no worries Kodiak....
yeah i was just posting, when it came to my mind, that i should probably include all my wishes into one post, to save you workload,....unfortunately its now the other way round.sorry.
but i will have a look at your mission now...maybe its enough for my squad training mission anyway...
__________________
Reply With Quote
  #8  
Old 06-21-2012, 08:12 AM
David198502's Avatar
David198502 David198502 is offline
Approved Member
 
Join Date: Dec 2009
Location: Austria
Posts: 1,536
Default

hey Kodiak, i tried your script, and it seems to work...
i put it into my mission, and adjusted the names of the spawnareas in the script, as well as the messages which pop up.everything works like a treat, even with more waypoints on one side!
thank you very much, i think for now, this is perfect for my use....although if you have spare time and if you are in the mood, then i would really appreciate, if you could inlcude all my wishes from my above post,.....one day.


Edit: now that i have my big yellow messages, i wonder how it is possible, to change the server messages....
i saw on some servers, that the normal messages like "AI SpitfireIa has been destroyed by...."(the small white ones, which appear if you killed someone or get killed) were adjusted..i dont know anymore on which server i saw this, but there the server was stating something like "...JG26_DavidRed kicked Ki SpitfireIa in the ass...."
i will probably not use this phrase, but i think something more funny could be added than the default phrase...
__________________

Last edited by David198502; 06-21-2012 at 08:52 AM.
Reply With Quote
  #9  
Old 06-21-2012, 10:51 AM
David198502's Avatar
David198502 David198502 is offline
Approved Member
 
Join Date: Dec 2009
Location: Austria
Posts: 1,536
Default

thx Kodiak again for your limitbirthplace script...works great even with more spawnpoints on one side...
the only thing now is, that if i have more than one spawnpoint on one side, then the message, warining that only 5planes are left on the one side, is dependent on each spawnpoint, and not on the total number of planes available on one side....
i would like to keep the messages, warning that one spawnpoint has only x planes left, but would like to have the message included, warning the team, if the total number of available planes is left to 5....
__________________
Reply With Quote
  #10  
Old 06-21-2012, 11:30 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Change OnPlaceEnter to:
Code:
 public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);

        AiBirthPlace birthPlace = GetBirthplace(actor);


        AiCart cart = actor as AiCart;

        if(cart != null)
        AvailablePlanes.ForEach(place =>
                                    {
                                        if (place.BirthPlace == birthPlace.Name())
                                        {
                                            
                                            place.NumberOfPlanes--;

                                            int numberOfAllAvailablePlanes = CountAvailablePlanes(actor.Army());

                                            if (numberOfAllAvailablePlanes == 5)
                                            {
                                                if(actor.Army() == 1)
                                                    GamePlay.gpHUDLogCenter(null, "Attention Reds only {0} Planes are left", new object[] { numberOfAllAvailablePlanes });
                                                if(actor.Army() == 2)
                                                    GamePlay.gpHUDLogCenter(null, "Attention Blues only {0} Planes are left", new object[] { numberOfAllAvailablePlanes });
                                            }

                                            if (place.NumberOfPlanes == 0)
                                            {
                                                GamePlay.gpHUDLogCenter(null, "Attention {0} is no longer available", new object[]{place.BirthPlace});
                                                birthPlace.destroy();
                                            }
                                        }
                                    });
    }
Edith: Hatte die Seite bei der Meldung nicht berücksichtig.

Last edited by FG28_Kodiak; 06-21-2012 at 12:06 PM.
Reply With Quote
Reply

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 07:48 PM.


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