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 08-18-2011, 05:05 AM
II./JG1_Krupinski II./JG1_Krupinski is offline
Approved Member
 
Join Date: Oct 2007
Posts: 86
Default Player's Aircraft

How can I find out what aircraft the player is in when they spawn in?

OnPlaceEnter

Player interface...

I can't figure out how to determine it.
Reply With Quote
  #2  
Old 08-18-2011, 05:22 AM
TheEnlightenedFlorist TheEnlightenedFlorist is offline
Approved Member
 
Join Date: May 2011
Location: SLC, Utah, USA
Posts: 143
Default

Are you looking for the type of aircraft the player is flying or the AiAircraft object?

In OnPlaceEnter(), actor can be cast as an AiAircraft. If you want the type of aircraft, cast actor to an AiAircraft and call InternalTypeName(). The string it gives you will look like this: "bob:Aircraft.Bf-109E-3".
Reply With Quote
  #3  
Old 08-18-2011, 07:57 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Quote:
Originally Posted by II./JG1_Krupinski View Post
How can I find out what aircraft the player is in when they spawn in?

OnPlaceEnter

Player interface...

I can't figure out how to determine it.
Code:
public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
{
        base.OnPlaceEnter(player, actor, placeIndex);

        GamePlay.gpLogServer(null, "{0} uses {1} Type {2}", new object[] { player.Name(), player.Place().Name(), (actor as AiAircraft).InternalTypeName() });
}
The example will shows following in chat with my callsign, Luftwaffe I/LG2 Nr.1 and a Ju-88A-1 as plane:
Kodiak uses 0:BoB_LW_LG2_I.000 Type bob:Aircraft.Ju-88A-1

player.Name() => player callsign
player.Place().Name() => 0:BoB_LW_LG2_I.000
(actor as AiAircraft).InternalTypeName() => bob:Aircraft.Ju-88A-1


You can get the actual playerplane with
AiAircraft airc1 = (AiAircraft)GamePlay.gpPlayer().Place();
also.

Last edited by FG28_Kodiak; 08-18-2011 at 08:14 AM.
Reply With Quote
  #4  
Old 08-18-2011, 04:06 PM
II./JG1_Krupinski II./JG1_Krupinski is offline
Approved Member
 
Join Date: Oct 2007
Posts: 86
Default

Thanks,

That'll probably do it. I'll try when I get home.

On a side note: What's the difference between AiAircraft.TypeName() and AiAircraft.InternalTypeName()?
Reply With Quote
  #5  
Old 08-18-2011, 04:36 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

TypedName() shows the tactical number of the plane.
Reply With Quote
  #6  
Old 08-18-2011, 08:34 PM
II./JG1_Krupinski II./JG1_Krupinski is offline
Approved Member
 
Join Date: Oct 2007
Posts: 86
Default

Thanks!
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 07:25 PM.


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