![]() |
|
#1
|
||||
|
||||
![]() Quote:
//SEND MESSAGE TO PLAYER WHEN THEY HAVE TAKEN OFF public override void OnAircraftTookOff(int missionNumber, string shortName, AiAircraft aircraft) { base.OnAircraftTookOff(missionNumber, shortName, aircraft); GamePlay.gpHUDLogCenter("Takeoff messages start."); //Test/debug Message if (aircraft.Name() == GamePlay.gpPlayer().Place().Name()) // if the plane took off - a player, then ... { GamePlay.gpHUDLogCenter("Switch section reached"); //Test/debug Message switch (aircraft.Army()) { case 1: if ((aircraft.Type() == AircraftType.Bomber) || (aircraft.Type() == AircraftType.DiveBomber)) // if Bomber or Divebomber { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Remember, Get Organised! Attack briefed targets!"); } else { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Organise Escorts and protect Convoy moving from Beachy Head to the Thames Estuary!"); } break; case 2: if ((aircraft.Type() == AircraftType.Bomber) || (aircraft.Type() == AircraftType.DiveBomber)) // if Bomber or Divebomber { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Remember, Get Organised and attack briefed Targets!"); } else { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Remember, Get Organised and protect our bombers by Escort or Frei Jagd!"); } break; } } } //end public override void OnAircraftTookOff
__________________
klem 56 Squadron RAF "Firebirds" http://firebirds.2ndtaf.org.uk/ ASUS Sabertooth X58 /i7 950 @ 4GHz / 6Gb DDR3 1600 CAS8 / EVGA GTX570 GPU 1.28Gb superclocked / Crucial 128Gb SSD SATA III 6Gb/s, 355Mb-215Mb Read-Write / 850W PSU Windows 7 64 bit Home Premium / Samsung 22" 226BW @ 1680 x 1050 / TrackIR4 with TrackIR5 software / Saitek X52 Pro & Rudders |
#2
|
|||
|
|||
![]()
Hi,
I have never tried scripting for Clod, but as a C# programer, I'm going to make an educated guess: Try changing this line: if (aircraft.Name() == GamePlay.gpPlayer().Place().Name() ) for this one: if ( aircraft.Name().Equals(GamePlay.gpPlayer().Place().Name()) ) I'm not sure of this because I don't know the types of the objects involved in the comparison (strings?), but try it anyway. (Check this for more info about why: C# Value Type vs Reference Type) Also you should check that aircraft is not null, and that GamePlay.gpPlayer().Place() is not null, for security reasons in order to avoid NullReference exceptions. Last edited by Iku_es; 05-24-2011 at 01:18 PM. |
#3
|
||||
|
||||
![]()
klem,
OnAircraftTookOff(() does not currently work for planes spawned at BirthPlaces. It should work for FMB planes with waypoints. I guess, you get first message showed because you have AI taking off. |
#4
|
||||
|
||||
![]()
Instead of;
Code:
if (aircraft.Name() == GamePlay.gpPlayer().Place().Name()) Code:
if (aircraft == GamePlay.gpPlayer().Place()) |
#5
|
||||
|
||||
![]() Quote:
It was for MP and for a BirthPlace so a double fail ![]() btw I had it report aircraft.Name() and GamePlay.gpPlayer().Place().Name() and they were the same string so 'If == ' should have worked ok.
__________________
klem 56 Squadron RAF "Firebirds" http://firebirds.2ndtaf.org.uk/ ASUS Sabertooth X58 /i7 950 @ 4GHz / 6Gb DDR3 1600 CAS8 / EVGA GTX570 GPU 1.28Gb superclocked / Crucial 128Gb SSD SATA III 6Gb/s, 355Mb-215Mb Read-Write / 850W PSU Windows 7 64 bit Home Premium / Samsung 22" 226BW @ 1680 x 1050 / TrackIR4 with TrackIR5 software / Saitek X52 Pro & Rudders |
![]() |
Thread Tools | |
Display Modes | |
|
|