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 03-10-2012, 12:22 PM
melasuda melasuda is offline
Approved Member
 
Join Date: Feb 2012
Posts: 44
Default NEed one scrip

Hi all, first sorry for my english.

I have no idea of ​​programming in c.

But i have a cuestion.

can someone make a script where ia is destroyed after 5 seconds of landing?

THX
Reply With Quote
  #2  
Old 03-10-2012, 12:46 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

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


public class Mission : AMission
{
    private bool IsDestroyable(AiAircraft aircraft)
    {
        bool Destroyable = true;

        //Check if actor is empty (no Player)

        if (aircraft.ExistCabin(0))
            for (int i = 0; i < aircraft.Places(); i++)
            {
                if (aircraft.Player(i) != null)
                {
                    Destroyable = false;
                    break;
                }
            }

        return Destroyable;
    }


    public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftCrashLanded(missionNumber, shortName, aircraft);

        if(IsDestroyable(aircraft))
            Timeout(5, () =>
                {
                    aircraft.Destroy();
                });
    }


    public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftLanded(missionNumber, shortName, aircraft);

        if (IsDestroyable(aircraft))
            Timeout(5, () =>
            {
                aircraft.Destroy();
            });
    }
}
Reply With Quote
  #3  
Old 03-10-2012, 01:22 PM
melasuda melasuda is offline
Approved Member
 
Join Date: Feb 2012
Posts: 44
Default

Thx.
But i have a problem.

When create a flight with the triggers,not disappear when it lands
Reply With Quote
  #4  
Old 03-10-2012, 09:42 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Ok, add this to the script:
Code:
    public override void OnBattleStarted()
    {
        base.OnBattleStarted();

        MissionNumberListener = -1;
    }
so the complete should look like
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
using maddox.GP;


public class Mission : AMission
{

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

        MissionNumberListener = -1;
    }

    private bool IsDestroyable(AiAircraft aircraft)
    {
        bool Destroyable = true;

        //Check if actor is empty (no Player)

        if (aircraft.ExistCabin(0))
            for (int i = 0; i < aircraft.Places(); i++)
            {
                if (aircraft.Player(i) != null)
                {
                    Destroyable = false;
                    break;
                }
            }

        return Destroyable;
    }


    public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftCrashLanded(missionNumber, shortName, aircraft);

        if(IsDestroyable(aircraft))
            Timeout(5, () =>
                {
                    aircraft.Destroy();
                });
    }


    public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftLanded(missionNumber, shortName, aircraft);

        if (IsDestroyable(aircraft))
            Timeout(5, () =>
            {
                aircraft.Destroy();
            });
    }
}
Reply With Quote
  #5  
Old 03-11-2012, 12:17 PM
melasuda melasuda is offline
Approved Member
 
Join Date: Feb 2012
Posts: 44
Default

Ok Thx,

this nigh test the scrip
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 02:21 PM.


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