View Single Post
  #34  
Old 10-16-2011, 05:01 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

@David:
I use the InternalTypeName of the plane, here others for the flyable planes:
bob:Aircraft.Bf-109E-3
bob:Aircraft.Bf-109E-3B
bob:Aircraft.Bf-109E-1
bob:Aircraft.Bf-109E-4
bob:Aircraft.Bf-109E-4B
bob:Aircraft.Bf-110C-4
bob:Aircraft.Bf-110C-7
bob:Aircraft.Ju-87B-2
bob:Aircraft.Ju-88A-1
bob:Aircraft.He-111H-2
bob:Aircraft.He-111P-2
bob:Aircraft.SpitfireMkIa
bob:Aircraft.SpitfireMkI
bob:Aircraft.HurricaneMkI
bob:Aircraft.HurricaneMkI_dH5-20
bob:Aircraft.BlenheimMkIV
bob:Aircraft.SpitfireMkIIa

to figure this out the KI-Only Planes you can add:
Code:
GamePlay.gpLogServer(null, "InternalTypeName: {0}", new object[]{(actor as AiAircraft).InternalTypeName()});
to OnActorCreated(...) so you see the internal name in the chatbar and in the log (if enabled in conf.ini).

To destroy the planes from a specific Airgroup is not possible in OnActorCreated(..) at the time of creation there is no Airgroup.
But you can use the ActorName
Code:
GamePlay.gpLogServer(null, "ActorName: {0}", new object[] { (actor as AiAircraft).Name() });
If i use:
Code:
    public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorCreated(missionNumber, shortName, actor);

        if (actor != null && actor is AiAircraft)
        {

            GamePlay.gpLogServer(null, "InternalTypeName: {0}", new object[] { (actor as AiAircraft).InternalTypeName() });

            GamePlay.gpLogServer(null, "ActorName: {0}", new object[] { (actor as AiAircraft).Name() });
        }
}
i get this in the chatbar (from earlier example)
Server: InternalTypeName: bob:Aircraft.Bf-109E-4
Server: ActorName: 0:BoB_LW_LG2_I.000
Server: InternalTypeName: bob:Aircraft.He-111H-2
Server: ActorName: 0:BoB_LW_KuFlGr_706.000
Server: InternalTypeName: bob:Aircraft.He-111H-2
Server: ActorName: 0:BoB_LW_KuFlGr_706.001
Server: InternalTypeName: bob:Aircraft.He-111H-2
Server: ActorName: 0:BoB_LW_KuFlGr_706.002
Server: InternalTypeName: bob:Aircraft.He-111H-2
Server: ActorName: 0:BoB_LW_KuFlGr_706.010
Server: InternalTypeName: bob:Aircraft.He-111H-2
Server: ActorName: 0:BoB_LW_KuFlGr_706.011
Server: InternalTypeName: bob:Aircraft.He-111H-2
Server: ActorName: 0:BoB_LW_KuFlGr_706.012

so if you like to destroy planes from a Airgroup you could use:
Code:
        if (actor is AiAircraft && actor.Name().Contains("BoB_LW_KuFlGr_706"))
        {
             Timeout(60, () =>    // Time in Seconds
                         {
                             (actor as AiAircraft).Destroy();
                         });
        }
or a specific plane
Code:
        if (actor is AiAircraft && actor.Name().Contains("BoB_LW_KuFlGr_706.010"))
        {
             Timeout(60, () =>    // Time in Seconds
                         {
                             (actor as AiAircraft).Destroy();
                         });
        }
Reply With Quote