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 09-13-2011, 01:55 PM
II./JG1_Krupinski II./JG1_Krupinski is offline
Approved Member
 
Join Date: Oct 2007
Posts: 86
Default OnAircraftTookOff / OnAircraftLanded / OnAircraftCrashLanded

Looks like the OnAircraftTookOff is now firing when a "player" takes off, which is great news.

Concerning OnAircraftLanded & OnAircraftCrashLanded, they will both fire off when i crash land. While I can work around this, it would make more sense that if a play crash lands, it doesn't fire the OnAircraftLanded too. Would be a lot cleaner and easier to manage. (coders will be able to depend on the method, rather than ever changing moving target of business rules as patches are released, the rules will be baked into the calls)

I haven't looked too terribly close, but it appears that OnAircraftTookOff, OnAircraftLanded, and OnAircraftCrashLanded are only working for "Player"? They don't seem to be fired off for AI aircraft? Does this sound accurate?
Reply With Quote
  #2  
Old 09-13-2011, 08:28 PM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

I am currently trying to use the OnAircraftTookOff Methode, but it doesn´t seem to work on a dedicated server. Did you try a dedicated server and if so, what code did you use?

I tried the following:

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

        if (GamePlay.gpPlayer().Place() != aircraft)
            return;
        
        switch (aircraft.Army())
              {                
                case 1:
                    if (aircraft.Type() == AircraftType.Bomber || aircraft.Type().ToString().Equals("Bomber, DiveBomber"))       //rote spieler
                    { 
                        GamePlay.gpHUDLogCenter(new Player[] {GamePlay.gpPlayer() }, "Fly a reccon to LeHavre (AN4)"); 
                    }        
                    else 
                    {
                        GamePlay.gpHUDLogCenter(new Player[] {GamePlay.gpPlayer() }, "Cover our shipping south of Isle of White (AD17)"); 
                    }    
                break;
                
                case 2:
                if (aircraft.Type() == AircraftType.Bomber || aircraft.Type().ToString().Equals("Bomber, DiveBomber"))           //blaue Spieler
                    { 
                        GamePlay.gpHUDLogCenter(new Player[] {GamePlay.gpPlayer() }, "Attack britisch shipping south of Isle of White - AD17"); 
                    }        
                    else 
                    {
                        GamePlay.gpHUDLogCenter(new Player[] {GamePlay.gpPlayer() }, "Escort Ju87 from AC6 to AE15. Stukas leave AC6 after 15mins into mission!"); 
                    }    
                    break;
            }
	}
__________________
http://cornedebrouwer.nl/cf48e
Reply With Quote
  #3  
Old 09-13-2011, 09:29 PM
II./JG1_Krupinski II./JG1_Krupinski is offline
Approved Member
 
Join Date: Oct 2007
Posts: 86
Default

Haven't tried on dedi server yet. I assumed that it's working in non-dedicated that it would in a dedicated. Boy this will be a let down if it doesn't work on dedicated server.

As far as what code I'm using, your's looks like mine, except that I get a reference to the "player" by looping through the aircraft.Places() and finding the first "place" that isn't null - that being the player or "a" player.

Code:
for (int i = 0; i < aircraft.Places(); i++)
{
	if (aircraft.Player(i) != null)
	{
		// TODO: Account for more than one player in an aircraft
		player = aircraft.Player(i);
		break;
	}
}

if (player != null)
{
	// do player specific code
	//blah, blah. blah
}
Reply With Quote
  #4  
Old 09-13-2011, 09:34 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Cannot work on dedi:
GamePlay.gpPlayer()
doesn't work in multiplayer
you must use:

GamePlay.gpRemotePlayers (Array of player so you must find out which player is the correct one)

or

aircraft.Player(0) // is the pilot of Aircraft

so
if (aircraft.Player(0) == null) // no human pilot
return;

GamePlay.gpHUDLogCenter(new Player[] {aircraft.Player(0) }, "Fly a reccon to LeHavre (AN4)");

Sorry posted at same time
so use Krupinsky method above

Last edited by FG28_Kodiak; 09-13-2011 at 09:40 PM.
Reply With Quote
  #5  
Old 09-14-2011, 09:24 AM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

Thanks, will try this.
__________________
http://cornedebrouwer.nl/cf48e
Reply With Quote
  #6  
Old 09-14-2011, 03:31 PM
II./JG1_Krupinski II./JG1_Krupinski is offline
Approved Member
 
Join Date: Oct 2007
Posts: 86
Default

I confirmed last night that the OnAircraftTookOff event is indeed fired off, on a dedicated server.
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 01:31 PM.


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