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
  #31  
Old 09-11-2011, 09:42 AM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

Player planes are spawned on airfields of mainmission. But also didn´t work when I load the script as sole script of the main-mission, as mainscript, if you know what I mean.

MissionA.mis (spawn-airfield)
MissionA.cs (penalty script)
__________________
http://cornedebrouwer.nl/cf48e
Reply With Quote
  #32  
Old 09-11-2011, 04:15 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

So i tested the script as a single and a multiplayer version (as host) without any problem. But i don't have a dedicated server so i can not test this case.
Think we should meet us in ts, so we can run a test on a dedi.

Edit: Ok there is a problem with Dedicated Server, hitnamed seems to be ignored.

Last edited by FG28_Kodiak; 09-11-2011 at 04:50 PM.
Reply With Quote
  #33  
Old 09-11-2011, 07:01 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

So script modified, hitnamed not working on dedicated so i use cutlimb
On ground the Undercarriage is cut off and in Air the tail (@SNAFU: Works with Spitfires also, problem on spitfire was only one part should be cut off, all others are ignored).

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

public class Mission : AMission
{

    const int TotalArrestTime = 30;  // Time in seconds

    public class prisonCell
    {
        public string PrisonerName { get; set; }
        public DateTime ArrestBeginTime { get; set; }
        public DateTime ArrestEndTime { get; set; }
        public bool Removable { get; set; }
    }

    public List<prisonCell> PrisonCamp = new List<prisonCell>();


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

        if (actor == null) // if player bailed out the actor is null so remove the player from prison if he is in
        {
            if (PrisonCamp.Count != 0)
            {
                foreach (prisonCell pri in PrisonCamp)
                {
                    if (pri.PrisonerName.Equals(player.Name()))
                    {
                            pri.Removable = true;
                    }
                }
                PrisonCamp.RemoveAll(item => item.Removable == true);
            }
        }

        if (PrisonCamp.Count != 0)
        {
            foreach (prisonCell pri in PrisonCamp)
            {
                if (pri.PrisonerName.Equals(player.Name()))
                {
                    TimeSpan ArrestTime = DateTime.Now.Subtract(pri.ArrestBeginTime);

                    if (ArrestTime.TotalSeconds < TotalArrestTime)
                    {
                        TimeSpan RestTime = pri.ArrestEndTime.Subtract(DateTime.Now);
                        GamePlay.gpLogServer(null, "Player: {0} get a time penalty for leaving Airplane in flight\n", new object[] { player.Name() });
                        if (!(actor as AiAircraft).IsAirborne())
                        {
                            (actor as AiAircraft).cutLimb(part.LimbNames.UC0);
                            (actor as AiAircraft).cutLimb(part.LimbNames.UC1);
                            (actor as AiAircraft).cutLimb(part.LimbNames.UC2);
                            (actor as AiAircraft).cutLimb(part.LimbNames.UC3);
                            (actor as AiAircraft).cutLimb(part.LimbNames.UC4);
                            (actor as AiAircraft).cutLimb(part.LimbNames.UC5);
                        }
                        else
                        {
                            (actor as AiAircraft).cutLimb(part.LimbNames.Tail0);
                            (actor as AiAircraft).cutLimb(part.LimbNames.Tail1);
                            (actor as AiAircraft).cutLimb(part.LimbNames.Tail2);
                            (actor as AiAircraft).cutLimb(part.LimbNames.Tail3);
                            (actor as AiAircraft).cutLimb(part.LimbNames.Tail4);
                            (actor as AiAircraft).cutLimb(part.LimbNames.Tail5);
                            (actor as AiAircraft).cutLimb(part.LimbNames.Tail6);
                            (actor as AiAircraft).cutLimb(part.LimbNames.Tail7);
                        }
                        

                    }
                    else
                    {
                        pri.Removable = true;
                    }
                }
            }
            PrisonCamp.RemoveAll(item => item.Removable == true);
        }
    }


    public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceLeave(player, actor, placeIndex);

        if ((actor as AiAircraft).IsAirborne())
        {
            prisonCell NewPrisoner = new prisonCell();
            NewPrisoner.PrisonerName = player.Name();
            NewPrisoner.ArrestBeginTime = DateTime.Now;
            NewPrisoner.ArrestEndTime = DateTime.Now.AddSeconds(TotalArrestTime);

            PrisonCamp.Add(NewPrisoner);
        }
    }


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

        if (Time.tickCounter() % 34 == 0) // 34 Ticks should be a second
        {
            if (PrisonCamp.Count != 0)
            {
                foreach (prisonCell pri in PrisonCamp)
                {
                    foreach (Player aktplayer in GamePlay.gpRemotePlayers())
                    {
                        if (pri.PrisonerName.Equals(aktplayer.Name()))
                        {
                            TimeSpan RestTime = pri.ArrestEndTime.Subtract(DateTime.Now);
                            if (RestTime.TotalSeconds > 0.0)
                            {
                                GamePlay.gpHUDLogCenter(new Player[] { aktplayer }, "{0} Arrest ends in {1:00} min. {2:00} sec.", new object[] { aktplayer.Name(), RestTime.Minutes, RestTime.Seconds });
                            }
                            else
                            {
                                GamePlay.gpHUDLogCenter(new Player[] { aktplayer }, "{0} Arrest over - Have Fun!", new object[] { aktplayer.Name() });
                                pri.Removable = true;
                            }
                        }
                    }
                }
                PrisonCamp.RemoveAll(item => item.Removable == true);
            }
        }
    }
}
Reply With Quote
  #34  
Old 10-04-2011, 01:45 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

When tested the script on III./JG27 Server (iirc) I was still able to enter aircraft that were already flying in AI groups while under arrest.
Reply With Quote
  #35  
Old 10-04-2011, 01:47 PM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

The script is currently not used on our server, due to problems with changing place in mulitcrew planes, but Kodiak posted that is aware of this problem and is going to correct it.
__________________
http://cornedebrouwer.nl/cf48e
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:32 PM.


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