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 04-19-2011, 02:20 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by ZaltysZ View Post
Spawn/despawn script is kinda "incomplete" and causes unwanted behavior: plane instantly disappearing on bail out or plane disappearing when single member of crew leaves the plane (i.e. one of bomber gunners leaves the plane) while other members are still inside.

Additionally checking if plane is manned before "killing" it should help with multicrew plane despawns. Bail out despawns probably will be a lot tricker.
Someone who knows C# can change it hopefully. I do not see much interest from community to this topic unfortunately. Hopefully when bugs are fixed and we have a stable dedi server things change.
Reply With Quote
  #2  
Old 04-19-2011, 06:35 PM
ZaltysZ's Avatar
ZaltysZ ZaltysZ is offline
Approved Member
 
Join Date: Sep 2008
Location: Lithuania
Posts: 426
Default

Script for despawning planes without humans inside. Multicrew friendly.

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

public class  Mission : AMission
{
	public void _DespawnEmptyPlane(AiActor actor)
	{
					if (actor == null)
						{ return;}

					Player[] Players = GamePlay.gpRemotePlayers();
					
					bool PlaneIsEmpty = true;
					
					foreach (Player i in Players)
					{	
						if ((i.Place() as AiAircraft) == (actor as AiAircraft))
							{ 
								PlaneIsEmpty = false;
								break;
							}
					}
					
					if (PlaneIsEmpty)
						{ (actor as AiAircraft).Destroy(); }
	}

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

Last edited by ZaltysZ; 04-20-2011 at 06:26 PM. Reason: Code change
Reply With Quote
  #3  
Old 04-19-2011, 09:48 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

WOW! Thanks a lot!!!
Reply With Quote
  #4  
Old 05-01-2011, 03:14 PM
No457_Squog No457_Squog is offline
Registered Member
 
Join Date: Mar 2010
Location: Melbourne, Australia
Posts: 10
Default

Quote:
Originally Posted by ZaltysZ View Post
Script for despawning planes without humans inside. Multicrew friendly.

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

public class  Mission : AMission
{
	public void _DespawnEmptyPlane(AiActor actor)
	{
					if (actor == null)
						{ return;}

					Player[] Players = GamePlay.gpRemotePlayers();
					
					bool PlaneIsEmpty = true;
					
					foreach (Player i in Players)
					{	
						if ((i.Place() as AiAircraft) == (actor as AiAircraft))
							{ 
								PlaneIsEmpty = false;
								break;
							}
					}
					
					if (PlaneIsEmpty)
						{ (actor as AiAircraft).Destroy(); }
	}

    public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceLeave(player, actor, placeIndex);
        Timeout(1, () =>
        {
         	_DespawnEmptyPlane(actor);
        });
    }
}
}
No457_Mako & myself tweaked this code so that the server is included in the workings. The Server isn't listed in the GamePlay.gpRemotePlayers() array.
Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

public class  Mission : AMission
{
	public void _DespawnEmptyPlane(AiActor actor)
	{
		if (actor == null)
			return;
		Player[] Players = GamePlay.gpRemotePlayers();
		bool PlaneIsEmpty = true;
		foreach (Player i in Players) {
			if (((i.Place() as AiAircraft) == (actor as AiAircraft)) || ((GamePlay.gpPlayer().Place() as AiAircraft) == (actor as AiAircraft))) {
				PlaneIsEmpty = false;
				break;
			}
		}
		if (PlaneIsEmpty) {
			(actor as AiAircraft).Destroy();
		}
	}

    public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex) {
		base.OnPlaceLeave(player, actor, placeIndex);
		Timeout(1, () => {
			_DespawnEmptyPlane(actor);
		});
    }
}
Reply With Quote
  #5  
Old 05-01-2011, 05:00 PM
Flashman Flashman is offline
Approved Member
 
Join Date: May 2010
Posts: 109
Default

HI Squoag,

I tried your version in nthe post above and it despawned the plane if I changed from pilot to a gunners position.

I tested this on my own 'server' and in single player. Obviously in MP this would not be desireable!
Reply With Quote
  #6  
Old 05-01-2011, 09:26 PM
No457_Squog No457_Squog is offline
Registered Member
 
Join Date: Mar 2010
Location: Melbourne, Australia
Posts: 10
Default

Hi Flashman,

Are you 100% sure that you used the second code block in my post and not the first? What you're seeing is very symptomatic of the first code block in my post. I put it there as a before/after for the original author but perhaps I should mark it more clearly...
Reply With Quote
  #7  
Old 05-02-2011, 05:16 PM
Flashman Flashman is offline
Approved Member
 
Join Date: May 2010
Posts: 109
Default

Quote:
Originally Posted by No457_Squog View Post
Hi Flashman,

Are you 100% sure that you used the second code block in my post and not the first? What you're seeing is very symptomatic of the first code block in my post. I put it there as a before/after for the original author but perhaps I should mark it more clearly...
Hi Sqouag,

Im pretty sure I tried both but truth be told you have me wondering now.... I will try this again when I get the time and see if it works for me.

Please note: i tried this on my own 'server' not on the Syndicate server.
Reply With Quote
  #8  
Old 05-02-2011, 11:47 AM
SC/JG Matoni SC/JG Matoni is offline
Approved Member
 
Join Date: Apr 2011
Posts: 29
Default

Quote:
Originally Posted by No457_Squog View Post
No457_Mako & myself tweaked this code so that the server is included in the workings. The Server isn't listed in the GamePlay.gpRemotePlayers() array.
Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

public class  Mission : AMission
{
	public void _DespawnEmptyPlane(AiActor actor)
	{
		if (actor == null)
			return;
		Player[] Players = GamePlay.gpRemotePlayers();
		bool PlaneIsEmpty = true;
		foreach (Player i in Players) {
			if (((i.Place() as AiAircraft) == (actor as AiAircraft)) || ((GamePlay.gpPlayer().Place() as AiAircraft) == (actor as AiAircraft))) {
				PlaneIsEmpty = false;
				break;
			}
		}
		if (PlaneIsEmpty) {
			(actor as AiAircraft).Destroy();
		}
	}

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

Will test on Australian Skies tomorrow

EDIT: This works for me, thanks No457_Mako & No457_Squog, has helped with server stability. Ran 3 maps no worries, we were having issues with loading new maps before this

Worked with Position swap ONLINE in the bf 110 as well.

Matoni

Last edited by SC/JG Matoni; 05-02-2011 at 02:03 PM.
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 11:39 AM.


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