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
  #21  
Old 09-09-2011, 05:01 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Maybe something like this would work?
Code:
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure);
I've seen it in another script working.
Reply With Quote
  #22  
Old 09-09-2011, 05:15 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

At my Testmission FuelPumpFailure works without a problem. So i dont know what's going wrong.
Reply With Quote
  #23  
Old 09-09-2011, 06:38 PM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

@Kodiak, nö, dann hätte er ja Fehlermeldungen rausgespuckt. I just get the usual "Object not set to a reference" messages as before, nothing unusual...

Does the script recognize that the player just spawned and wants to change the airfield, so didn´t even takeoff? Will the player get a penalty then also?

I attached the script below. I have also the "plane-destroy-after-abandoming" script running, so I have troubles with calling up the "OnPlayerLeave" parts twice.
Attached Files
File Type: zip Mid-July1940_v1.zip (22.4 KB, 7 views)
__________________
http://cornedebrouwer.nl/cf48e

Last edited by SNAFU; 09-09-2011 at 06:43 PM.
Reply With Quote
  #24  
Old 09-09-2011, 06:49 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

No the script uses Aircraft.IsAirborne, if true the plane is in the Air, if false the plane is on ground. But this works only again in the Beta Patch and then i hope so forever after the next reqular patch.

I will take a look at your script.

At the moment i work on your Death penalty -> Brzzzzlll and on the Arrest Count Down.
Reply With Quote
  #25  
Old 09-10-2011, 07:33 AM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

Nice!

If you need further infos let me know, I`ve got access to our server, but not the game installed on my notebook.
__________________
http://cornedebrouwer.nl/cf48e
Reply With Quote
  #26  
Old 09-10-2011, 01:03 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

New Version, added Player Countdown, changed Player in Prisoncell from object refence to Playername, so the penalty should be still active, even the player reconnected.

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() });
                        (actor as AiAircraft).hitNamed(part.NamedDamageTypes.FuelPumpFailure);
                    }
                    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
  #27  
Old 09-10-2011, 03:05 PM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

Thanks, I try now to load that script via submission and currently running on our server.

If someone is able to test, please report back...
__________________
http://cornedebrouwer.nl/cf48e
Reply With Quote
  #28  
Old 09-10-2011, 06:00 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

So another Script, Player Plane Memory function.
actual its a early 'alpha'
it's shows the playername after shootdown, even if the enemy player leaved the plane via esc or bailed out.
then a short message will shown playername1 shoot down by playername2.
the message is only shown if a human shoot down a human, the others are in work.
Knows anybody how to disable the gamemessages in chat or override them?
I actually hoped we get this possibility with the beta patch, so we can change the game messages against our own messages, but i don't find anything. But i look deeper in it

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


public class Mission : AMission
{

    public class AirplanePlayerName
    {
        public AiAircraft PlayerAirplane{ get; set; }
        public string PilotName { get; set; }
        public bool Removable { get; set; }
    }

    public List<AirplanePlayerName> UsedAirplanes = new List<AirplanePlayerName>();
    
    
    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);

        // Player enter Aircraft as Pilot
        if (actor != null && (actor is AiAircraft) && placeIndex == 0)
        {

            foreach (AirplanePlayerName actplane in UsedAirplanes)
            {
                if (actplane.PlayerAirplane == (actor as AiAircraft))  // plane is already in list
                {
                    actplane.PilotName = player.Name(); // change the pilot name
                    return;
                }
               
            }
        
            AirplanePlayerName NewAircraft = new AirplanePlayerName();
            NewAircraft.PilotName = player.Name();
            NewAircraft.PlayerAirplane = (actor as AiAircraft);

            UsedAirplanes.Add(NewAircraft);
        }
    }


    public override void OnActorDead(int missionNumber, string shortName, AiActor actor, System.Collections.Generic.List<DamagerScore> damages)
    {
        base.OnActorDead(missionNumber, shortName, actor, damages);

        

        if (actor is AiAircraft)
        {
            foreach (DamagerScore ds in damages)
            {
                if (ds.initiator.Player != null && (actor as AiAircraft).InternalTypeName() != null)
                {
                    foreach (AirplanePlayerName actPlane in UsedAirplanes)
                    {
                        if (actPlane.PlayerAirplane == (actor as AiAircraft) && !actPlane.Removable)
                        {

                            Timeout(1.0, () =>
                            {
                                GamePlay.gpLogServer(null, "\n\n===> Player: {0} was shoot down by {1} <===\n\n", new object[] { actPlane.PilotName, ds.initiator.Player.Name() });
                            });
                                                        
                            actPlane.Removable = true;
                        }
                    }
                }
            }
        }
        UsedAirplanes.RemoveAll(item => item.Removable == true);
    }


    public override void OnActorDestroyed(int missionNumber, string shortName, maddox.game.world.AiActor actor)
    {
        base.OnActorDestroyed(missionNumber, shortName, actor);

        if (actor is AiAircraft)
        {
            foreach (AirplanePlayerName actPlane in UsedAirplanes)
            {
                if (actPlane.PlayerAirplane == (actor as AiAircraft))
                {
                    actPlane.Removable = true;
                }
            }
        }
        UsedAirplanes.RemoveAll(item => item.Removable == true);
    }

}

Last edited by FG28_Kodiak; 09-10-2011 at 07:18 PM.
Reply With Quote
  #29  
Old 09-11-2011, 08:49 AM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

Allright, I just put these 2 scripst 1to1 into an empty submissions and load them into the main mission via mainscript.

Concerning your penalty script: Message and countdown works fine, only the fuelpump is still operable after penalty. I am now trying different damage types, will report back.

I added the other damagetypes as you see below, but they all are ignored, I just can take off as usual.

.
.
.

if (ArrestTime.TotalSeconds < TotalArrestTime)
{
TimeSpan RestTime = pri.ArrestEndTime.Subtract(DateTime.Now);
GamePlay.gpLogServer(null, "Player: {0} gets a time penalty for leaving Airplane in flight\n", new object[] { player.Name() });
(actor as AiAircraft).hitNamed (part.NamedDamageTypes.ControlsElevatorDisabled);
(actor as AiAircraft).hitNamed (part.NamedDamageTypes.ControlsAileronsDisabled);
(actor as AiAircraft).hitNamed (part.NamedDamageTypes.ControlsRudderDisabled);
(actor as AiAircraft).hitNamed (part.NamedDamageTypes.FuelPumpFailure);
(actor as AiAircraft).hitNamed (part.NamedDamageTypes.FuelTank0Exploded);
(actor as AiAircraft).hitNamed (part.NamedDamageTypes.Eng0TotalSeizure);
}

.
.
.

PS: Tested the script also on an empty mission, without any other script with the same results... no penalty. ;(
__________________
http://cornedebrouwer.nl/cf48e

Last edited by SNAFU; 09-11-2011 at 09:21 AM.
Reply With Quote
  #30  
Old 09-11-2011, 09:16 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Are the player planes created in Submission or Mainmission?
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 03:48 PM.


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