Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   Request for scripters: Death/ESC-Ban (http://forum.fulqrumpublishing.com/showthread.php?t=25996)

Ataros 09-09-2011 05:01 PM

Maybe something like this would work?
Code:

(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure);
I've seen it in another script working.

FG28_Kodiak 09-09-2011 05:15 PM

At my Testmission FuelPumpFailure works without a problem. So i dont know what's going wrong.

SNAFU 09-09-2011 06:38 PM

1 Attachment(s)
@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.

FG28_Kodiak 09-09-2011 06:49 PM

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.

SNAFU 09-10-2011 07:33 AM

Nice! :)

If you need further infos let me know, I`ve got access to our server, but not the game installed on my notebook.

FG28_Kodiak 09-10-2011 01:03 PM

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);
            }
        }
    }
}


SNAFU 09-10-2011 03:05 PM

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... ;)

FG28_Kodiak 09-10-2011 06:00 PM

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);
    }

}


SNAFU 09-11-2011 08:49 AM

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. ;(

FG28_Kodiak 09-11-2011 09:16 AM

Are the player planes created in Submission or Mainmission?


All times are GMT. The time now is 05:36 AM.

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