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 05-20-2011, 11:22 AM
SYN_Flashman SYN_Flashman is offline
Approved Member
 
Join Date: Feb 2011
Posts: 48
Default

Quote:
Originally Posted by TheEnlightenedFlorist View Post
Also, scripts are written in C#, not C++. C# is very much like Java and way easier to work with than C++. I don't want you to go learning C++ when you should be learning C#.
Now worries on that score, I wasn't planning on learning either, my brain isn't big enough! I learn just enough to make it appear i know what im doing when in fact I haven't a bloody clue. Mcuh like the rest of my life really....

I will have a look at using triggers and actions within the script itself as some are quite useful. I did have a mission where if one plane was shot down another would spawn... lots of potential with that one.

There is a lot to learn, but equally there is a lot we can do that is really interesting.

I will post up my next daft script and see what people think later on when im home. Cheers!
Reply With Quote
  #2  
Old 05-20-2011, 01:01 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

If you want to destroy aircraft loaded by submissions do not forget to include
Code:
//////////////////////////////////////////////////////////////////////////////////////////////////

    //Listen to events of every (sub)mission
    public override void Init(maddox.game.ABattle battle, int missionNumber)
    {
        base.Init(battle, missionNumber);
        MissionNumberListener = -1; //Listen to events of every mission
    }

 //////////////////////////////////////////////////////////////////////////////////////////////////
I made that mistake. Thanks to ZaltysZ for correcting it in my script!
Reply With Quote
  #3  
Old 05-20-2011, 01:22 PM
SYN_Flashman SYN_Flashman is offline
Approved Member
 
Join Date: Feb 2011
Posts: 48
Default

Quote:
Originally Posted by Ataros View Post
If you want to destroy aircraft loaded by submissions do not forget to include
Code:
//////////////////////////////////////////////////////////////////////////////////////////////////

    //Listen to events of every (sub)mission
    public override void Init(maddox.game.ABattle battle, int missionNumber)
    {
        base.Init(battle, missionNumber);
        MissionNumberListener = -1; //Listen to events of every mission
    }

 //////////////////////////////////////////////////////////////////////////////////////////////////
I made that mistake. Thanks to ZaltysZ for correcting it in my script!
How do I use this piece of script, do I just copy and paste it into mt script or do I need to make any changes?
Reply With Quote
  #4  
Old 05-20-2011, 01:27 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

@ Flashman
Just copy and past anywhere you like. You can always check out my recent script in Online Missions go here thread.


@all
It seems like this script I use does not destroy ships loaded by a submission. Other ground units are destroyed as intended. What can be wrong? IIRC ships belong to AiGroundActor

Code:
    //Ground objects (except AA Guns) will die after 55 min when counted from their birth

    public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorCreated(missionNumber, shortName, actor);
        //Ground objects (except AA Guns) will die after 55 min when counted from their birth
        if (actor is AiGroundActor)
            if ((actor as AiGroundActor).Type() != maddox.game.world.AiGroundActorType.AAGun)
                Timeout(3300, () =>
                {
                    if (actor != null)
                    { (actor as AiGroundActor).Destroy(); }
                }
                        );
    }
Complete code here http://forum.1cpublishing.eu/showpos...5&postcount=41

Last edited by Ataros; 05-20-2011 at 01:34 PM.
Reply With Quote
  #5  
Old 05-20-2011, 10:09 PM
335th_GRAthos 335th_GRAthos is offline
Approved Member
 
Join Date: Oct 2007
Posts: 1,240
Default

I think you got lucky guys....
(I can only think because I do not undestand the language you write in this thread... )

From the Hotfix:
Quote:
MULTIPLAYER
Improved server and client stability and performance;
Improved statistics;
Improved user interface;
Made parked planes disappear after a certain period of time so as not to clutter the airfields;
Fixed phantom crewmembers occasionally appearing in place of dropped planes;
Made sure airborne planes are created with sufficient airspeed in online games (born speed now tied to the plane's top speed);
Conversion settings should properly synchronize between all players;
Fixed the weapon selection grid in online games requiring an extra click to save;
Made sure all players see the same time of day in an online server.
Reply With Quote
  #6  
Old 05-22-2011, 11:07 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by Ataros View Post
It seems like this script I use does not destroy ships loaded by a submission. Other ground units are destroyed as intended. What can be wrong? IIRC ships belong to AiGroundActor

Code:
    //Ground objects (except AA Guns) will die after 55 min when counted from their birth

    public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorCreated(missionNumber, shortName, actor);
        //Ground objects (except AA Guns) will die after 55 min when counted from their birth
        if (actor is AiGroundActor)
            if ((actor as AiGroundActor).Type() != maddox.game.world.AiGroundActorType.AAGun)
                Timeout(3300, () =>
                {
                    if (actor != null)
                    { (actor as AiGroundActor).Destroy(); }
                }
                        );
    }
Complete code here http://forum.1cpublishing.eu/showpos...5&postcount=41
Confirmed, the script does not destroy ships. What can be the reason?
This is what happens in 3-4 hours after starting a mission.
https://lh4.googleusercontent.com/_S...5-21_00016.jpg
Reply With Quote
  #7  
Old 05-22-2011, 11:52 AM
ZaltysZ's Avatar
ZaltysZ ZaltysZ is offline
Approved Member
 
Join Date: Sep 2008
Location: Lithuania
Posts: 426
Default

Quote:
Originally Posted by Ataros View Post
Confirmed, the script does not destroy ships. What can be the reason?
Somehow game does not see ships as AiGroundActor. Ask naryv about this.
Reply With Quote
  #8  
Old 05-25-2011, 11:44 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Looks like the script we are running on Repka and Syndicate is not 100% compatible with multicrew aircraft.

Quote:
Originally Posted by JG53Frankyboy View Post
if you change positions in multicrew planes ONLINE (and only ONLINE !) the game sets the engine temperature to ZERO.
In the Blenheim for example, the causes the engines to stop.....
Can someone help to change the code in order not to damage engines and controls if a player remains inside an aircraft and only changes his position to gunner or navigator?

Code:
////////////////////////////////////////////////////////////////////////////////////////////////////

// destroys aircraft abandoned by a player.
    private bool isAiControlledPlane (AiAircraft aircraft) 
    {
		if (aircraft == null) 
        { 
			return false;
		}

		Player [] players = GamePlay.gpRemotePlayers ();
		foreach (Player p in players) 
        {    
			if (p != null && (p.Place () is AiAircraft) && (p.Place () as AiAircraft) == aircraft)
            { 
				return false;
			}
		}

		return true;
	}

	private void destroyPlane (AiAircraft aircraft) {
		if (aircraft != null) { 
			aircraft.Destroy ();
		}
	}

	private void explodeFuelTank (AiAircraft aircraft) 
    {
		if (aircraft != null) 
        { 
			aircraft.hitNamed (part.NamedDamageTypes.FuelTank0Exploded);
		}
	}

	private void destroyAiControlledPlane (AiAircraft aircraft) {
		if (isAiControlledPlane (aircraft)) {
			destroyPlane (aircraft);
		}
	}

	private void damageAiControlledPlane (AiActor actor) {
		if (actor == null || !(actor is AiAircraft)) { 
			return;
		}

		AiAircraft aircraft = (actor as AiAircraft);

		if (!isAiControlledPlane (aircraft)) {
			return;
		}

		if (aircraft == null) { 
			return;
		}

		aircraft.hitNamed (part.NamedDamageTypes.ControlsElevatorDisabled);
		aircraft.hitNamed (part.NamedDamageTypes.ControlsAileronsDisabled);
		aircraft.hitNamed (part.NamedDamageTypes.ControlsRudderDisabled);
		aircraft.hitNamed (part.NamedDamageTypes.FuelPumpFailure);

        int iNumOfEngines = (aircraft.Group() as AiAirGroup).aircraftEnginesNum();
        for (int i = 0; i < iNumOfEngines; i++)
        {
            aircraft.hitNamed((part.NamedDamageTypes)Enum.Parse(typeof(part.NamedDamageTypes), "Eng" + i.ToString() + "TotalFailure"));
        }

        /***Timeout (240, () =>
                {explodeFuelTank (aircraft);}
            );
         * ***/

        Timeout (300, () =>
				{destroyPlane (aircraft);}
			);
	}

    //////////////////////////////////////////

	public override void OnPlaceLeave (Player player, AiActor actor, int placeIndex) 
    {
		base.OnPlaceLeave (player, actor, placeIndex);
		Timeout (1, () =>
				{damageAiControlledPlane (actor);}
			);
	}

	public override void OnAircraftCrashLanded (int missionNumber, string shortName, AiAircraft aircraft) 
    {
		base.OnAircraftCrashLanded (missionNumber, shortName, aircraft);
		Timeout (300, () =>
            { destroyPlane(aircraft); }
			);
	}
    public override void OnAircraftLanded (int missionNumber, string shortName, AiAircraft aircraft) 
    {
        base.OnAircraftLanded(missionNumber, shortName, aircraft);
        Timeout(300, () =>
            { destroyPlane(aircraft); }
            );
    }
    
    
//////////////////////////////////////////////////////////////////////////////////////////////////

Last edited by Ataros; 05-25-2011 at 11:46 AM.
Reply With Quote
Reply

Thread Tools
Display Modes

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 01:56 PM.


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