![]() |
|
|
|
#1
|
|||
|
|||
|
first sorry for bumping an old thread.
im facing an issue implementing a "similar" (based) on this method script. my issue is, with multi-sit aircriaft. when you spawn in one of those and change seats with will result in decrease of 1 to the pool by each seat. much of the following CODE is not mine (around 90%) so no credit for it. Credit goes for Ataros, Kodiak, and some other guys, i cant recall everyone i steal from Quote:
|
|
#2
|
|||
|
|||
|
You can check if a player is already in a plane
Code:
public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceEnter(player, actor, placeIndex);
int playercount = 0;
if (actor != null && actor is AiAircraft)
{
AiAircraft aircraft = actor as AiAircraft;
for (int i = 0; i < aircraft.Places(); i++)
{
if (aircraft.Player(i) != null)
{
if (aircraft.Player(i) == player) playercount++;
}
}
}
if (playercount == 1) ..
}
or you check PlaceSecondary, PlaceSecondary is -1 if a player is 'new' in a plane, if not new PlaceSecondary gets the value of the last secondary place. Code:
if (player.PlaceSecondary() != -1)
..
Last edited by FG28_Kodiak; 05-20-2012 at 07:42 PM. |
|
#3
|
|||
|
|||
|
A bit unrelated to the actual discussion, but what you say about primary and secondary places confirms my observations about AI gunners.
We all know that if you switch to a gunner position the AI no longer mans the turret. Flying a Blenheim on ATAG one night, i happened to find out completely by chance that if your aircraft has a bombardier position you can give back gun control to the AI: simply cycle between pilot and bombardier once and your gunners will revert to AI control. This was also reflected on the net stats overlay, where next to my nickname i could see "pilot, gunner" initially and "pilot, bombardier" after cycling positions. Thanks for confirming my suspicions |
|
#4
|
|||
|
|||
|
thank you!
Worked like a charm! |
|
#5
|
|||
|
|||
|
Hi, still on the same topic, yet a differente type of code, im tryign to get a submenu to have an option to refly.
code Quote:
sorry, but im really noob in C# |
|
#6
|
|||
|
|||
|
you get the Aircraft via player.Place()
Code:
if (player.Place() != null && player.Place() is AiAircraft)
{
AiAircraft aircraft = player.Place() as AiAircraft;
}
|
|
#7
|
|||
|
|||
|
Thnak you Kodiak, will try that when i get home.
Where do you get all of this info? of what info is stored in wich class? and wich classes can be converted to others? from trial and error, and from seeing other people i get to learn some of them ( actor can be used as aircraft and such), but where does this knowledge comes from? trial and error? |
|
#8
|
|||
|
|||
|
Object-Explorer in Visual Studio and try and error (sometimes Cliffs don't react as expected
).
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|