![]() |
|
|
|
#1
|
|||
|
|||
|
You can use the Player(int placeindex) member of the AiAircraft Class:
For example GamePlay.gpLogServer(new Player[] { (actor as AiAircraft).Player(0) }, " Test ", null); You should test the null value, if null no human player (Ai). To send the message to all possible players in an Aircraft: Code:
for (int i = 0; i < aircraft.Places(); i++)
if (aircraft.Player(i) != null)
GamePlay.gpLogServer(new Player[] {aircraft.Player(i)}, " Test ", null);
Last edited by FG28_Kodiak; 11-15-2011 at 09:33 AM. |
|
#3
|
|||
|
|||
|
C# allows for many methods, Kodiak always seems to come up with nice examples
I am using this method with success, it is from the collection of samples from this forum. What is nice is different msg's to team and plane type. Code:
public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceEnter(player, actor, placeIndex);
AiAircraft aircraft = actor as AiAircraft;
if (aircraft != null)
switch (aircraft.Army())
{
case 1:
if (aircraft.Type() == AircraftType.Bomber)
{ GamePlay.gpHUDLogCenter(new Player[] { player},"Red Bomber, Bomb it all, hitler caput"); }
else { GamePlay.gpHUDLogCenter(new Player[] { player }, "Red Fighter, fight them all"); }
break;
case 2:
if (aircraft.Type() == AircraftType.Bomber)
{ GamePlay.gpHUDLogCenter(new Player[] { player }, "Das bomber!"); }
else { GamePlay.gpHUDLogCenter(new Player[] { player }, "Das jager!"); }
break;
}
}
|
![]() |
|
|