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)

SNAFU 09-09-2011 01:49 PM

Thank you indeed Kodiak! I will try this as soon as I am home again (should not be before Sunday evening).

If you tell me how to extend this script with a kind of death-penalty (maybe "You are on Cloud 7 - Wait for the bells!")?

As a return I could offer a personalized 109 skin, maybe not the best, but certainly unique... :-P :cool:

FG28_Kodiak 09-09-2011 03:27 PM

Corrected Script after Ataros hint with bail out:
if the player bailed out OnPlaceLeave is also called and then OnPlaceEnter is called but the Actor is null. So i remove the player from prison if that's the case.

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 Player Prisoner { get; set; }
        public DateTime JailTime { 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 him from prison
        {
            if (PrisonCamp.Count != 0)
            {
                foreach (prisonCell pri in PrisonCamp)
                {
                    if (pri.Prisoner == player)
                    {
                            pri.Removable = true;
                    }
                }
                PrisonCamp.RemoveAll(item => item.Removable == true);
            }
        }

        if (PrisonCamp.Count != 0)
        {
            foreach (prisonCell pri in PrisonCamp)
            {
                if (pri.Prisoner == player)
                {
                    TimeSpan ArrestTime = DateTime.Now.Subtract(pri.JailTime);

                    if (ArrestTime.TotalSeconds < TotalArrestTime)
                    {
                        GamePlay.gpLogServer(null, "Player: {0} get a {1} sec. penalty for leaving Airplane in flight\n", new object[] { player.Name(), TotalArrestTime });
                        GamePlay.gpHUDLogCenter(new Player[] { player }, "{0} you are under Arrest!", 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.Prisoner = player;
            NewPrisoner.JailTime = DateTime.Now;

            PrisonCamp.Add(NewPrisoner);
        }
    }
}


Ze-Jamz 09-09-2011 03:31 PM

So for simpletons what does this mean..

A: If player bails out from plane after taking Dmg =?
B: If player creates another plane after Dmg which AI now fly the plane =?

Thanks for your work ~S~

FG28_Kodiak 09-09-2011 03:47 PM

After bailing the plane should hit the ground.
If the player leaves the plane and creates a new one the ai gets active. Or you destroy() the plane via script.

SNAFU 09-09-2011 03:54 PM

Thank you. Implemented this into my mission script and put it online, currently running on the III/JG27 Server. Unfortunatly I have no chance to test it.
But I got it to the "plane-destroy-after-ESCleaving-script" with its OnPlaceLeave- and OnPlayerEnter- Call-ups, without putting out error messages, so far.
So the plane is destroyed after abandoming and the player should get 10mins break, by blocked fuel pump in the next 10mins (I increased the time and that was what I thought the script does)

If someone is able to test it on our server, please report back.


My Mission-Skript looks following:

...Well, 169574 characters and only 50000 allowed....

FG28_Kodiak 09-09-2011 04:16 PM

Testing now - at the moment i've to wait 10min ;)

Ataros 09-09-2011 04:28 PM

Another suggestion is to print time left for player till he can create new plane on screen.

Is it possible to add the last damager to the chat message for everyone to let everyone know who shot him down?

Ataros 09-09-2011 04:29 PM

Quote:

Originally Posted by SNAFU (Post 333883)
My Mission-Skript looks following:

...Well, 169574 characters and only 50000 allowed....

LOL :grin: You can attach it as zip or maybe as txt as well :)

Ze-Jamz 09-09-2011 04:43 PM

Quote:

Originally Posted by Ataros (Post 333909)
Another suggestion is to print time left for player till he can create new plane on screen.

Is it possible to add the last damager to the chat message for everyone to let everyone know who shot him down?

Wouldnt that show the last person to get a plink on him to be the killer..I.e gets credited with the kill?

FG28_Kodiak 09-09-2011 04:51 PM

@SNAFU
The fuelpump doesn't block!
Haste mal wieder die Klammern durcheinandergebracht? :-P

Quote:

Another suggestion is to print time left for player till he can create new plane on screen.
Is on my todo list ;)

Quote:

Is it possible to add the last damager to the chat message for everyone to let everyone know who shot him down?
Without a problem ;)


All times are GMT. The time now is 07:21 PM.

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